Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include *.py CONTRIBUTORS LICENSE README.rst VERSION
include *.py CONTRIBUTORS LICENSE README.rst
recursive-include juju *.py
recursive-include examples *.py
recursive-include docs *.rst
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BIN := .tox/py3/bin
PY := $(BIN)/python3
PIP := $(BIN)/pip3
VERSION=$(shell cat VERSION)
VERSION := $(shell $(PY) -c "from juju.version import CLIENT_VERSION; print(CLIENT_VERSION)")

.PHONY: clean
clean:
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@
from pathlib import Path

here = Path(__file__).absolute().parent
version = (here.parent / 'VERSION').read_text().strip()


# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))

from juju.version import CLIENT_VERSION
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imports should be at the top no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should stay there because it won't work before the sys.path.insert(0, os.path.abspath('..')) line above

version = CLIENT_VERSION

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand Down
3 changes: 2 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ paramiko
macaroonbakery
toposort
python-dateutil
kubernetes
kubernetes
packaging
13 changes: 1 addition & 12 deletions juju/version.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
# Copyright 2023 Canonical Ltd.
# Licensed under the Apache V2, see LICENCE file for details.

import pathlib
import re

LTS_RELEASES = ["jammy", "focal", "bionic", "xenial", "trusty", "precise"]

DEFAULT_ARCHITECTURE = 'amd64'

# CLIENT_VERSION (that's read from the VERSION file) is the highest Juju server
# version that this client supports.
# Note that this is a ceiling. CLIENT_VERSION <= juju-controller-version works.
# For CLIENT_VERSION < juju-controller-version (strictly smaller), we emit a warning
# to update the client to the latest.
# However, for any CLIENT_VERSION > juju-controller-version, a "client incompatible
# with server" will be returned by the juju controller.
VERSION_FILE_PATH = pathlib.Path(__file__).parent.parent / 'VERSION'
CLIENT_VERSION = re.search(r'\d+\.\d+\.\d+', open(VERSION_FILE_PATH).read().strip()).group()
CLIENT_VERSION = "3.3.1.0"
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from setuptools import find_packages, setup

from juju.version import CLIENT_VERSION

here = Path(__file__).absolute().parent
readme = here / 'docs' / 'readme.rst'
changelog = here / 'docs' / 'changelog.rst'
Expand All @@ -13,11 +15,10 @@
changelog.read_text()
)
long_description_content_type = 'text/x-rst'
version = here / 'VERSION'

setup(
name='juju',
version=version.read_text().strip(),
version=CLIENT_VERSION.strip(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to strip?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently don't need to, but the line that's coming from will be manually edited by people who're making releases (replaces the file VERSION) in the future, so I thought this would cleanup any silly mistakes like "4.2.0 " (whitespace in the end).

packages=find_packages(
exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
package_data={'juju': ['py.typed']},
Expand All @@ -32,6 +33,7 @@
'typing_inspect>=0.6.0',
'kubernetes>=12.0.1',
'hvac',
'packaging',
],
include_package_data=True,
maintainer='Juju Ecosystem Engineering',
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ deps =
websockets
kubernetes
hvac
packaging

[testenv:docs]
deps =
Expand Down