diff --git a/.github/workflows/cla-check.yml b/.github/workflows/cla-check.yml deleted file mode 100644 index 6b767cce..00000000 --- a/.github/workflows/cla-check.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: cla-check - -on: [pull_request] - -jobs: - cla-check: - runs-on: ubuntu-latest - steps: - - name: Check if CLA signed - uses: canonical/has-signed-canonical-cla@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..fa95dc2a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +name: Release version + +on: + workflow_dispatch: + inputs: + newversion: + description: 'New version' + required: true + +jobs: + release-version: + runs-on: ubuntu-latest + steps: + - name: Repository checkout + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.6" + + - name: Install dependencies + run: | + pip install --upgrade pip tox bump2version + + - name: Test latest version + run: | + make test + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: 'Get Previous version tag' + id: previousversion + uses: "WyriHaximus/github-action-get-previous-tag@v1" + + - name: Bump setup.py version + run: | + bump2version --current-version ${previousversion} --new-version ${newversion} setup.py + + - name: Tag latest version + uses: EndBug/latest-tag@latest + with: + tag-name: ${newversion} + + - name: Update docs + run: / + make docs-to-github + + - name: Upload to pypi + run: / + make upload diff --git a/.github/workflows/stale-cron.yaml b/.github/workflows/stale-cron.yaml deleted file mode 100644 index f5579966..00000000 --- a/.github/workflows/stale-cron.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: Close inactive issues -on: - schedule: - - cron: "0 0 * * *" - -jobs: - close-issues: - uses: canonical/maas-github-workflows/.github/workflows/stale-cron.yaml@v0 - secrets: inherit diff --git a/README b/README index 3b292a58..fb3fce35 100644 --- a/README +++ b/README @@ -2,8 +2,8 @@ Python client API library made especially for [MAAS][]. -[![CI tests](https://github.com/canonical/python-libmaas/workflows/CI%20tests/badge.svg)](https://github.com/canonical/python-libmaas/actions?query=workflow%3A%22CI+tests%22) -[![codecov.io](https://codecov.io/github/canonical/python-libmaas/coverage.svg?branch=master)](https://codecov.io/github/maas/python-libmaas?branch=master) +[![CI tests](https://github.com/maas/python-libmaas/workflows/CI%20tests/badge.svg)](https://github.com/maas/python-libmaas/actions?query=workflow%3A%22CI+tests%22) +[![codecov.io](https://codecov.io/github/maas/python-libmaas/coverage.svg?branch=master)](https://codecov.io/github/maas/python-libmaas?branch=master) ## Installation @@ -14,7 +14,7 @@ with [pip](https://pip.pypa.io/). Python 3.5+ is required. When working from master it can be helpful to use a virtualenv: $ python3 -m venv ve && source ve/bin/activate - $ pip install git+https://github.com/canonical/python-libmaas.git + $ pip install git+https://github.com/maas/python-libmaas.git $ maas --help Releases are periodically made to [PyPI](https://pypi.python.org/) but, diff --git a/debian/control b/debian/control index 40fe1c62..daaebe58 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: Andres Rodriguez Build-Depends: debhelper (>= 10), dh-python, python3-all, python3-setuptools Standards-Version: 4.1.3 -Homepage: https://github.com/canonical/python-libmaas +Homepage: https://github.com/maas/python-libmaas X-Python3-Version: >= 3.2 Package: python3-libmaas diff --git a/debian/copyright b/debian/copyright index 8af8f6a0..9d516845 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,6 +1,6 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: python-libmaas -Source: https://github.com/canonical/python-libmaas +Source: https://github.com/maas/python-libmaas Files: * Copyright: 2017-2018 Canonical Ltd. diff --git a/debian/watch b/debian/watch index 929cbb7a..78f8221f 100644 --- a/debian/watch +++ b/debian/watch @@ -6,5 +6,5 @@ version=4 # GitHub hosted projects opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%python-libmaas-$1.tar.gz%" \ - https://github.com/canonical/python-libmaas/tags \ + https://github.com/maas/python-libmaas/tags \ (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate diff --git a/doc.yaml b/doc.yaml index d39de881..531676a3 100644 --- a/doc.yaml +++ b/doc.yaml @@ -3,7 +3,7 @@ markdown_extensions: - codehilite - sane_lists - smarty -repo_url: https://github.com/canonical/python-libmaas +repo_url: https://github.com/maas/python-libmaas site_name: MAAS Client Library & CLI strict: true theme: readthedocs diff --git a/doc/index.md b/doc/index.md index 5813d83e..9720c9c5 100644 --- a/doc/index.md +++ b/doc/index.md @@ -27,7 +27,7 @@ until we release a beta all APIs could change. Either work from a branch: ```console -$ git clone https://github.com/canonical/python-libmaas.git +$ git clone https://github.com/maas/python-libmaas.git $ cd python-libmaas $ make ``` @@ -37,7 +37,7 @@ Or install with [pip](https://pip.pypa.io/) into a ```console $ virtualenv --python=python3 amc && source amc/bin/activate -$ pip install git+https://github.com/canonical/python-libmaas.git +$ pip install git+https://github.com/maas/python-libmaas.git ``` Or install from [PyPI](https://pypi.python.org/): diff --git a/maas/client/flesh/tables.py b/maas/client/flesh/tables.py index 70047590..bad12037 100644 --- a/maas/client/flesh/tables.py +++ b/maas/client/flesh/tables.py @@ -11,7 +11,6 @@ class NodeTypeColumn(Column): - nice_names = { NodeType.MACHINE: "Machine", NodeType.DEVICE: "Device", @@ -68,7 +67,6 @@ def render(self, target, memory): class NodeStatusNameColumn(Column): - colours = { # "New": "", # White. "Commissioning": "autoyellow", @@ -100,7 +98,6 @@ def render(self, target, datum): class NodePowerColumn(Column): - colours = { PowerState.ON: "autogreen", # PowerState.OFF: "", # White. @@ -387,7 +384,6 @@ def get_rows(self, target, files): class UserIsAdminColumn(Column): - yes, no = "Yes", "Np" yes_pretty = Color("{autogreen}Yes{/autogreen}") diff --git a/maas/client/flesh/tabular.py b/maas/client/flesh/tabular.py index a59c097d..4b1ca89c 100644 --- a/maas/client/flesh/tabular.py +++ b/maas/client/flesh/tabular.py @@ -17,7 +17,6 @@ class RenderTarget(enum.Enum): - # Human-readable tabluar output. plain = "plain" pretty = "pretty" diff --git a/maas/client/utils/__init__.py b/maas/client/utils/__init__.py index 1ae5a928..290d20f9 100644 --- a/maas/client/utils/__init__.py +++ b/maas/client/utils/__init__.py @@ -338,7 +338,7 @@ class Spinner: Use as a context manager. """ - def __init__(self, frames=r"/-\|", stream=sys.stdout): + def __init__(self, frames="/-\|", stream=sys.stdout): super(Spinner, self).__init__() self.frames = frames self.stream = stream diff --git a/maas/client/utils/tests/test_async.py b/maas/client/utils/tests/test_async.py index 6bf464ee..c50a25f7 100644 --- a/maas/client/utils/tests/test_async.py +++ b/maas/client/utils/tests/test_async.py @@ -73,7 +73,6 @@ def test_callable_attributes_are_wrapped(self): # `Asynchronous` groks class- and static-methods. class Class(metaclass=maas_async.Asynchronous): - attribute = 123 def imethod(self): diff --git a/maas/client/viscera/__init__.py b/maas/client/viscera/__init__.py index 40edd6fc..0c7967dc 100644 --- a/maas/client/viscera/__init__.py +++ b/maas/client/viscera/__init__.py @@ -158,7 +158,6 @@ def bind(cls, origin, handler, handlers, *, name=None): class ObjectBasics: - __slots__ = () def __dir__(self): diff --git a/maas/client/viscera/boot_resources.py b/maas/client/viscera/boot_resources.py index 2ab51c40..9ff72b94 100644 --- a/maas/client/viscera/boot_resources.py +++ b/maas/client/viscera/boot_resources.py @@ -38,7 +38,6 @@ def calc_size_and_sha265(content: io.IOBase, chunk_size: int): class BootResourceFileType(enum.Enum): - TGZ = "tgz" DDTGZ = "ddtgz" diff --git a/maas/client/viscera/maas.py b/maas/client/viscera/maas.py index e9604333..9a1e6cfd 100644 --- a/maas/client/viscera/maas.py +++ b/maas/client/viscera/maas.py @@ -252,7 +252,6 @@ async def set_ntp_server(cls, server: str): await cls.set_config("ntp_server", server) class StorageLayout(DescriptiveEnum): - FLAT = "flat", "Flat layout" LVM = "lvm", "LVM layout" BCACHE = "bcache", "Bcache layout" diff --git a/maas/client/viscera/machines.py b/maas/client/viscera/machines.py index f9ac96dc..db42cc28 100644 --- a/maas/client/viscera/machines.py +++ b/maas/client/viscera/machines.py @@ -480,9 +480,7 @@ async def deploy( comment: str = None, wait: bool = False, install_kvm: bool = False, - wait_interval: int = 5, - ephemeral_deploy: bool = False, - enable_hw_sync: bool = False + wait_interval: int = 5 ): """Deploy this machine. @@ -496,8 +494,6 @@ async def deploy( :param comment: A comment for the event log. :param wait: If specified, wait until the deploy is complete. :param wait_interval: How often to poll, defaults to 5 seconds - :param ephemeral_deploy: Deploy a machine in Ephemeral mode - :param enable_hw_sync: Enables periodic hardware sync """ params = {"system_id": self.system_id} @@ -517,11 +513,6 @@ async def deploy( params["hwe_kernel"] = hwe_kernel if comment is not None: params["comment"] = comment - if ephemeral_deploy: - params["ephemeral_deploy"] = ephemeral_deploy - if enable_hw_sync: - params["enable_hw_sync"] = enable_hw_sync - self._reset(await self._handler.deploy(**params)) if not wait: return self diff --git a/maas/client/viscera/spaces.py b/maas/client/viscera/spaces.py index bfb27943..0eba1881 100644 --- a/maas/client/viscera/spaces.py +++ b/maas/client/viscera/spaces.py @@ -37,7 +37,6 @@ class Spaces(ObjectSet, metaclass=SpacesType): class SpaceType(ObjectType): - _default_space_id = 0 async def get_default(cls): diff --git a/maas/client/viscera/tests/test.py b/maas/client/viscera/tests/test.py index 62611720..e8140bab 100644 --- a/maas/client/viscera/tests/test.py +++ b/maas/client/viscera/tests/test.py @@ -1051,7 +1051,6 @@ def test__overrides_value_to_daturm(self): self.assertThat(field.value_to_datum(None, 1), Equals(2)) def test__works_in_place(self): - # Deltas to apply to datums and values. datum_to_value_delta = 2 value_to_datum_delta = 3 diff --git a/maas/client/viscera/tests/test_machines.py b/maas/client/viscera/tests/test_machines.py index 62d97ad5..082c907a 100644 --- a/maas/client/viscera/tests/test_machines.py +++ b/maas/client/viscera/tests/test_machines.py @@ -203,7 +203,7 @@ def test__commission_with_wait_failed(self): ) def test__commission_with_no_tests(self): - # Regression test for https://github.com/canonical/python-libmaas/issues/185 + # Regression test for https://github.com/maas/python-libmaas/issues/185 system_id = make_name_without_spaces("system-id") hostname = make_name_without_spaces("hostname") data = { @@ -259,46 +259,6 @@ def test__deploy_with_kvm_install(self): system_id=machine.system_id, install_kvm=True ) - def test__deploy_with_ephemeral_deploy(self): - system_id = make_name_without_spaces("system-id") - hostname = make_name_without_spaces("hostname") - data = { - "system_id": system_id, - "hostname": hostname, - "status": NodeStatus.READY, - } - deploying_data = { - "system_id": system_id, - "hostname": hostname, - "status": NodeStatus.DEPLOYING, - } - machine = make_machines_origin().Machine(data) - machine._handler.deploy.return_value = deploying_data - machine.deploy(ephemeral_deploy=True, wait=False) - machine._handler.deploy.assert_called_once_with( - system_id=machine.system_id, ephemeral_deploy=True - ) - - def test__deploy_with_enable_hw_sync(self): - system_id = make_name_without_spaces("system-id") - hostname = make_name_without_spaces("hostname") - data = { - "system_id": system_id, - "hostname": hostname, - "status": NodeStatus.READY, - } - deploying_data = { - "system_id": system_id, - "hostname": hostname, - "status": NodeStatus.DEPLOYING, - } - machine = make_machines_origin().Machine(data) - machine._handler.deploy.return_value = deploying_data - machine.deploy(enable_hw_sync=True, wait=False) - machine._handler.deploy.assert_called_once_with( - system_id=machine.system_id, enable_hw_sync=True - ) - def test__deploy_with_wait_failed(self): system_id = make_name_without_spaces("system-id") hostname = make_name_without_spaces("hostname") @@ -906,7 +866,6 @@ def test__unlock(self): class TestMachine_APIVersion(TestCase): - scenarios = tuple( (name, dict(version=version, description=description)) for name, version, description in api_descriptions diff --git a/maas/client/viscera/tests/test_vlans.py b/maas/client/viscera/tests/test_vlans.py index 750e7081..9bf4c699 100644 --- a/maas/client/viscera/tests/test_vlans.py +++ b/maas/client/viscera/tests/test_vlans.py @@ -220,7 +220,7 @@ def test__vlan_update_relay_vlan_with_object(self): self.assertThat(vlan.relay_vlan.id, Equals(relay_vlan.id)) def test__vlan_update_relay_vlan_with_integer_id(self): - self.skip("see https://github.com/canonical/python-libmaas/issues/180") + self.skip("see https://github.com/maas/python-libmaas/issues/180") origin = make_origin() Vlan = origin.Vlan Vlan._handler.params = ["fabric_id", "vid"] diff --git a/setup.py b/setup.py index 071f10e9..e535d67d 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def read(filename): name='python-libmaas', author='MAAS Developers', author_email='maas-devel@lists.launchpad.net', - url='https://github.com/canonical/python-libmaas', + url='https://github.com/maas/python-libmaas', version="0.6.8", classifiers=[ 'Development Status :: 3 - Alpha', @@ -40,7 +40,6 @@ def read(filename): 'Programming Language :: Python :: 3.9', 'Topic :: Software Development :: Libraries', ], - namespace_packages=['maas'], packages=find_packages( include={"maas", "maas.*"}, exclude={"*.tests", "*.testing"}, @@ -58,13 +57,14 @@ def read(filename): "pymongo >= 3.5.1", # for bson "pytz >= 2014.10", "PyYAML >= 3.11", + "setuptools >= 58.2.0", "terminaltables >= 2.1.0", ], test_suite="maas.client", tests_require=[ "django >= 2.2.4, < 3.0", "fixtures >= 1.0.0", - "setuptools", + "setuptools >= 58.2.0", "testscenarios", "testtools", "Twisted<23.0.0", diff --git a/tox.ini b/tox.ini index 485859e4..c19d5f54 100644 --- a/tox.ini +++ b/tox.ini @@ -28,6 +28,7 @@ skip_install = True deps = black [testenv:imports] +allowlist_externals = {toxinidir}/scripts/check-imports commands = {toxinidir}/scripts/check-imports setenv = PYTHONPATH={toxinidir} sitepackages = False