From 117db56e0d18a3a4414d02b985d277e29c9465cf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 07:00:34 -0500 Subject: [PATCH 01/13] chore(deps): update dependency lint/ruff to v0.4.10 (#578) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 83d04bb9..98fb787e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ dev = [ lint = [ "black==24.4.2", "codespell[toml]==2.2.6", - "ruff==0.4.8", + "ruff==0.4.10", "yamllint==1.35.1", ] types = [ From c62b1e2bd5d6e2daeaabaea8a603d209ceea77d6 Mon Sep 17 00:00:00 2001 From: Claudio Matsuoka Date: Fri, 21 Jun 2024 14:25:59 -0300 Subject: [PATCH 02/13] fix: check if lxd snap is installed (#585) Check if the lxd snap is installed by querying the snapd socket instead of looking for an executable in the path, as lxd can use auto-installer stubs. Co-authored-by: Callahan Kovacs Signed-off-by: Claudio Matsuoka --- craft_providers/lxd/installer.py | 45 +++++++++++++++++++++++++++++-- pyproject.toml | 2 ++ tests/unit/lxd/test_installer.py | 46 +++++++++++++++++++++++++++----- 3 files changed, 85 insertions(+), 8 deletions(-) diff --git a/craft_providers/lxd/installer.py b/craft_providers/lxd/installer.py index 887cc592..71e3c4c8 100644 --- a/craft_providers/lxd/installer.py +++ b/craft_providers/lxd/installer.py @@ -19,10 +19,14 @@ import logging import os +import pathlib import shutil import subprocess import sys +import requests +import requests_unixsocket # type: ignore + from craft_providers.errors import details_from_called_process_error from . import errors @@ -52,6 +56,7 @@ def install(sudo: bool = True) -> str: cmd += ["snap", "install", "lxd"] + logger.debug("installing LXD") try: subprocess.run(cmd, check=True) except subprocess.CalledProcessError as error: @@ -62,6 +67,8 @@ def install(sudo: bool = True) -> str: lxd = LXD() lxd.wait_ready(sudo=sudo) + + logger.debug("initialising LXD") lxd.init(auto=True, sudo=sudo) if not is_user_permitted(): @@ -96,11 +103,45 @@ def is_initialized(*, remote: str, lxc: LXC) -> bool: def is_installed() -> bool: - """Check if LXD is installed (and found on PATH). + """Check if LXD is installed. :returns: True if lxd is installed. """ - return shutil.which("lxd") is not None + logger.debug("Checking if LXD is installed.") + + # check if non-snap lxd socket exists (for Arch or NixOS) + if ( + pathlib.Path("/var/lib/lxd/unix.socket").is_socket() + and shutil.which("lxd") is not None + ): + return True + + # query snapd API + url = "http+unix://%2Frun%2Fsnapd.socket/v2/snaps/lxd" + try: + snap_info = requests_unixsocket.get(url=url, params={"select": "enabled"}) + except requests.exceptions.ConnectionError as error: + raise errors.ProviderError( + brief="Unable to connect to snapd service." + ) from error + + try: + snap_info.raise_for_status() + except requests.exceptions.HTTPError as error: + logger.debug(f"Could not get snap info for LXD: {error}") + return False + + # the LXD snap should be installed and active but check the status + # for completeness + try: + status = snap_info.json()["result"]["status"] + except (TypeError, KeyError): + raise errors.ProviderError(brief="Unexpected response from snapd service.") + + logger.debug(f"LXD snap status: {status}") + # snap status can be "installed" or "active" - "installed" revisions + # are filtered from this API call with `select: enabled` + return bool(status == "active") and shutil.which("lxd") is not None def is_user_permitted() -> bool: diff --git a/pyproject.toml b/pyproject.toml index 98fb787e..29cdb69b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,8 @@ dynamic = ["version", "readme"] dependencies = [ "packaging>=14.1", "pydantic<2.0", + # see https://github.com/psf/requests/issues/6707 + "requests<2.32", "pyyaml", # see https://github.com/psf/requests/issues/6707 "requests<2.32", diff --git a/tests/unit/lxd/test_installer.py b/tests/unit/lxd/test_installer.py index b572408c..5f49c80e 100644 --- a/tests/unit/lxd/test_installer.py +++ b/tests/unit/lxd/test_installer.py @@ -16,11 +16,13 @@ # import os -import shutil import sys +from typing import Any, Dict from unittest import mock +from unittest.mock import call import pytest +from craft_providers.errors import ProviderError from craft_providers.lxd import ( LXC, LXD, @@ -301,13 +303,45 @@ def test_is_initialized_no_disk_device(devices): assert not initialized +@pytest.mark.parametrize(("has_lxd_executable"), [(True), (False)]) +@pytest.mark.parametrize(("has_nonsnap_socket"), [(True), (False)]) @pytest.mark.parametrize( - ("which", "installed"), [("/path/to/lxd", True), (None, False)] + ("status", "exception", "installed"), + [ + ({"result": {"status": "active"}}, None, True), + ({"result": {"status": "foo"}}, None, False), + ({}, ProviderError, False), + (None, ProviderError, False), + ], ) -def test_is_installed(which, installed, monkeypatch): - monkeypatch.setattr(shutil, "which", lambda x: which) - - assert is_installed() == installed +def test_is_installed( + mocker, has_nonsnap_socket, has_lxd_executable, status, exception, installed +): + class FakeSnapInfo: + def raise_for_status(self) -> None: + pass + + def json(self) -> Dict[str, Any]: + return status + + mock_get = mocker.patch("requests_unixsocket.get", return_value=FakeSnapInfo()) + mocker.patch("pathlib.Path.is_socket", return_value=has_nonsnap_socket) + mocker.patch("shutil.which", return_value="lxd" if has_lxd_executable else None) + + if has_nonsnap_socket and has_lxd_executable: + assert is_installed() + return + + if exception: + with pytest.raises(exception): + is_installed() + else: + assert is_installed() == (installed and has_lxd_executable) + + assert mock_get.mock_calls[0] == call( + url="http+unix://%2Frun%2Fsnapd.socket/v2/snaps/lxd", + params={"select": "enabled"}, + ) @pytest.mark.skipif(sys.platform != "linux", reason=f"unsupported on {sys.platform}") From 34cab4137ea57359a46aa78d01e95b5cf846f427 Mon Sep 17 00:00:00 2001 From: Tiago Nobrega Date: Tue, 25 Jun 2024 08:49:50 -0300 Subject: [PATCH 03/13] chore: point to correct readthedocs docs (#587) --- craft_providers/errors.py | 3 ++- docs/explanation/index.rst | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/craft_providers/errors.py b/craft_providers/errors.py index 59ac688f..a968e91a 100644 --- a/craft_providers/errors.py +++ b/craft_providers/errors.py @@ -125,8 +125,9 @@ def __init__(self) -> None: brief = "A network related operation failed in a context of no network access." # XXX Facundo 2022-12-13: need to improve the URL here once # we have the online docs updated + url = "https://canonical-craft-providers.readthedocs-hosted.com/en/latest/explanation/" resolution = ( "Verify that the environment has internet connectivity; " - "see https://craft-providers.readthedocs.io/ for further reference." + f"see {url} for further reference." ) super().__init__(brief=brief, resolution=resolution) diff --git a/docs/explanation/index.rst b/docs/explanation/index.rst index feedd10e..163dc3c6 100644 --- a/docs/explanation/index.rst +++ b/docs/explanation/index.rst @@ -6,6 +6,8 @@ Explanation .. toctree:: :maxdepth: 1 +.. _network-error: + Failure to properly execute commands that depend on network access ================================================================== From 88dfb55229d6e274754f58df4d21ec9b5a3696b7 Mon Sep 17 00:00:00 2001 From: Tiago Nobrega Date: Tue, 2 Jul 2024 10:31:04 -0300 Subject: [PATCH 04/13] docs(changelog): changelog entries for 1.24.1 --- docs/changelog.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 1d6f3d9f..9f293540 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,11 @@ Changelog See the `Releases page`_ on GitHub for a complete list of commits that are included in each version. +1.24.1 (2024-02-07) +------------------- +- Improve detection of installed LXD +- Update the link to the network troubleshooting docs + 1.24.0 (2024-06-18) ------------------- - Add support for Ubuntu 24.10 (Oracular) From ba20b6ac62c4f4bbe8324e7f2f6a91904462fbe4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:49:37 +0000 Subject: [PATCH 05/13] chore(deps): update dependency setuptools to v70.1.1 (#586) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 29cdb69b..5fcde2a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,7 +72,7 @@ docs = [ [build-system] requires = [ - "setuptools==70.0.0", + "setuptools==70.1.1", "setuptools_scm[toml]>=7.1" ] build-backend = "setuptools.build_meta" From 793825aa868866b8eed599881e36aab7bec1efdc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:50:03 +0000 Subject: [PATCH 06/13] chore(deps): update dependency tox-gh to v1.3.2 --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index a29c863f..cee12425 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ requires = # renovate: datasource=pypi tox-ignore-env-name-mismatch>=0.2.0.post2 # renovate: datasource=pypi - tox-gh==1.3.1 + tox-gh==1.3.2 # Allow tox to access the user's $TMPDIR environment variable if set. # This workaround is required to avoid circular dependencies for TMPDIR, # since tox will otherwise attempt to use the environment's TMPDIR variable. From 36ff7c7ff067f41e417653e0a560d6c15c4d43d4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:01:53 +0000 Subject: [PATCH 07/13] chore(deps): update dependency setuptools to v70.2.0 (#592) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5fcde2a9..47e04513 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,7 +72,7 @@ docs = [ [build-system] requires = [ - "setuptools==70.1.1", + "setuptools==70.2.0", "setuptools_scm[toml]>=7.1" ] build-backend = "setuptools.build_meta" From d0f1d47e3bec8078f1d410dc457b199501d006fc Mon Sep 17 00:00:00 2001 From: Callahan Date: Mon, 22 Jul 2024 12:59:59 -0500 Subject: [PATCH 08/13] tests: disable 24.10 integration tests (#599) tests: add xfail fixtures for LXD integration tests Signed-off-by: Callahan Kovacs --- tests/integration/lxd/conftest.py | 22 +++++++++++++++++++++- tests/integration/lxd/test_lxd_provider.py | 12 +++++------- tests/integration/lxd/test_remotes.py | 9 ++++----- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/tests/integration/lxd/conftest.py b/tests/integration/lxd/conftest.py index 94ecb66a..b598fae1 100644 --- a/tests/integration/lxd/conftest.py +++ b/tests/integration/lxd/conftest.py @@ -1,5 +1,5 @@ # -# Copyright 2021-2023 Canonical Ltd. +# Copyright 2021-2024 Canonical Ltd. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -25,11 +25,31 @@ from typing import Any, Dict, Optional import pytest +from craft_providers.bases import ubuntu from craft_providers.lxd import LXC from craft_providers.lxd import project as lxc_project from craft_providers.lxd.lxd_instance import LXDInstance from craft_providers.lxd.lxd_provider import LXDProvider +_xfail_bases = { + ubuntu.BuilddBaseAlias.XENIAL: "Fails to setup snapd (#582)", + ubuntu.BuilddBaseAlias.ORACULAR: "24.10 fails setup (#598)", + ubuntu.BuilddBaseAlias.DEVEL: "24.10 fails setup (#598)", +} +"""List of bases that are expected to fail and a reason why.""" + +UBUNTU_BASES_PARAM = [ + ( + pytest.param( + base, marks=pytest.mark.xfail(reason=_xfail_bases[base], strict=True) + ) + if base in _xfail_bases + else base + ) + for base in ubuntu.BuilddBaseAlias +] +"""List of testable Ubuntu bases.""" + @pytest.fixture(autouse=True, scope="module") def installed_lxd_required(installed_lxd): diff --git a/tests/integration/lxd/test_lxd_provider.py b/tests/integration/lxd/test_lxd_provider.py index 7a76fb55..f6d79dcf 100644 --- a/tests/integration/lxd/test_lxd_provider.py +++ b/tests/integration/lxd/test_lxd_provider.py @@ -1,6 +1,6 @@ # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # -# Copyright 2022-2023 Canonical Ltd. +# Copyright 2022-2024 Canonical Ltd. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,9 +17,11 @@ # import pytest -from craft_providers.bases import almalinux, get_base_from_alias, ubuntu +from craft_providers.bases import almalinux, get_base_from_alias from craft_providers.lxd import LXDProvider, is_installed +from .conftest import UBUNTU_BASES_PARAM + def test_ensure_provider_is_available_not_installed(uninstalled_lxd): """Verify lxd is installed and configured.""" @@ -42,11 +44,7 @@ def test_create_environment(installed_lxd, instance_name): @pytest.mark.parametrize( - "alias", - [ - *set(ubuntu.BuilddBaseAlias) - {ubuntu.BuilddBaseAlias.XENIAL}, - almalinux.AlmaLinuxBaseAlias.NINE, - ], + "alias", [*UBUNTU_BASES_PARAM, almalinux.AlmaLinuxBaseAlias.NINE] ) def test_launched_environment( alias, installed_lxd, instance_name, tmp_path, session_provider diff --git a/tests/integration/lxd/test_remotes.py b/tests/integration/lxd/test_remotes.py index 83e89a9c..9acf46d6 100644 --- a/tests/integration/lxd/test_remotes.py +++ b/tests/integration/lxd/test_remotes.py @@ -1,5 +1,5 @@ # -# Copyright 2021-2023 Canonical Ltd. +# Copyright 2021-2024 Canonical Ltd. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -21,6 +21,8 @@ from craft_providers import lxd from craft_providers.bases import ubuntu +from .conftest import UBUNTU_BASES_PARAM + # The LXD tests can be flaky, erroring out with a BaseCompatibilityError: # "Clean incompatible instance and retry the requested operation." # This is due to an upstream LXD bug that appears to still be present in LXD 5.14: @@ -28,10 +30,7 @@ pytestmark = pytest.mark.flaky(reruns=3, reruns_delay=2) -# exclude XENIAL because it is not supported for LXD -@pytest.mark.parametrize( - "alias", set(ubuntu.BuilddBaseAlias) - {ubuntu.BuilddBaseAlias.XENIAL} -) +@pytest.mark.parametrize("alias", UBUNTU_BASES_PARAM) def test_configure_and_launch_remote(instance_name, alias): """Verify remotes are configured and images can be launched.""" base_configuration = ubuntu.BuilddBase(alias=alias) From 14ee42b9fd5817d48483f79d7dc6b521e0c47266 Mon Sep 17 00:00:00 2001 From: Callahan Date: Tue, 23 Jul 2024 07:12:18 -0500 Subject: [PATCH 09/13] chore: drop Ubuntu 23.10 (Mantic) (#601) Ubuntu 23.10 reached end of life on 2024-Jul-11. Signed-off-by: Callahan Kovacs --- craft_providers/bases/__init__.py | 1 - craft_providers/bases/ubuntu.py | 1 - craft_providers/lxd/remotes.py | 8 -------- craft_providers/multipass/multipass_provider.py | 3 --- tests/integration/multipass/test_multipass_provider.py | 3 --- tests/unit/lxd/test_remotes.py | 4 ++-- 6 files changed, 2 insertions(+), 18 deletions(-) diff --git a/craft_providers/bases/__init__.py b/craft_providers/bases/__init__.py index c6974b12..ce2cc971 100644 --- a/craft_providers/bases/__init__.py +++ b/craft_providers/bases/__init__.py @@ -59,7 +59,6 @@ class BaseName(NamedTuple): BaseName("ubuntu", "18.04"): ubuntu.BuilddBaseAlias.BIONIC, BaseName("ubuntu", "20.04"): ubuntu.BuilddBaseAlias.FOCAL, BaseName("ubuntu", "22.04"): ubuntu.BuilddBaseAlias.JAMMY, - BaseName("ubuntu", "23.10"): ubuntu.BuilddBaseAlias.MANTIC, BaseName("ubuntu", "24.04"): ubuntu.BuilddBaseAlias.NOBLE, BaseName("ubuntu", "24.10"): ubuntu.BuilddBaseAlias.ORACULAR, BaseName("ubuntu", "devel"): ubuntu.BuilddBaseAlias.DEVEL, diff --git a/craft_providers/bases/ubuntu.py b/craft_providers/bases/ubuntu.py index 4285a007..60bcd71e 100644 --- a/craft_providers/bases/ubuntu.py +++ b/craft_providers/bases/ubuntu.py @@ -43,7 +43,6 @@ class BuilddBaseAlias(enum.Enum): BIONIC = "18.04" FOCAL = "20.04" JAMMY = "22.04" - MANTIC = "23.10" NOBLE = "24.04" ORACULAR = "24.10" DEVEL = "devel" diff --git a/craft_providers/lxd/remotes.py b/craft_providers/lxd/remotes.py index 272722ef..1c741d68 100644 --- a/craft_providers/lxd/remotes.py +++ b/craft_providers/lxd/remotes.py @@ -147,14 +147,6 @@ def add_remote(self, lxc: LXC) -> None: remote_address=BUILDD_DAILY_REMOTE_ADDRESS, remote_protocol=ProtocolType.SIMPLESTREAMS, ), - # mantic buildd daily blocked by - # https://bugs.launchpad.net/cloud-images/+bug/2007419 - ubuntu.BuilddBaseAlias.MANTIC: RemoteImage( - image_name="mantic", - remote_name=DAILY_REMOTE_NAME, - remote_address=DAILY_REMOTE_ADDRESS, - remote_protocol=ProtocolType.SIMPLESTREAMS, - ), ubuntu.BuilddBaseAlias.ORACULAR: RemoteImage( image_name="oracular", remote_name=BUILDD_DAILY_REMOTE_NAME, diff --git a/craft_providers/multipass/multipass_provider.py b/craft_providers/multipass/multipass_provider.py index 18e9e018..b147c63d 100644 --- a/craft_providers/multipass/multipass_provider.py +++ b/craft_providers/multipass/multipass_provider.py @@ -96,9 +96,6 @@ def name(self) -> str: ubuntu.BuilddBaseAlias.JAMMY: RemoteImage( remote=Remote.SNAPCRAFT, image_name="22.04" ), - ubuntu.BuilddBaseAlias.MANTIC: RemoteImage( - remote=Remote.RELEASE, image_name="mantic" - ), # this should use `image_name="24.04"` once noble is released (#511) ubuntu.BuilddBaseAlias.NOBLE: RemoteImage( remote=Remote.SNAPCRAFT, image_name="devel" diff --git a/tests/integration/multipass/test_multipass_provider.py b/tests/integration/multipass/test_multipass_provider.py index 06911686..967e330f 100644 --- a/tests/integration/multipass/test_multipass_provider.py +++ b/tests/integration/multipass/test_multipass_provider.py @@ -56,9 +56,6 @@ def test_launched_environment(alias, installed_multipass, instance_name, tmp_pat if sys.platform == "darwin" and alias == BuilddBaseAlias.NOBLE: pytest.skip(reason="Noble on MacOS are not available") - if sys.platform == "darwin" and alias == BuilddBaseAlias.MANTIC: - pytest.skip(reason="Mantic on MacOS are not available") - if sys.platform == "darwin" and alias == BuilddBaseAlias.DEVEL: pytest.skip(reason="snapcraft:devel is not working on MacOS (LP #2007419)") diff --git a/tests/unit/lxd/test_remotes.py b/tests/unit/lxd/test_remotes.py index 96516b1f..97014fef 100644 --- a/tests/unit/lxd/test_remotes.py +++ b/tests/unit/lxd/test_remotes.py @@ -145,8 +145,8 @@ def test_add_remote_race_condition_error(fake_remote_image, mock_lxc, logs): (ubuntu.BuilddBaseAlias.BIONIC, "core18"), (ubuntu.BuilddBaseAlias.FOCAL, "core20"), (ubuntu.BuilddBaseAlias.JAMMY, "core22"), - (ubuntu.BuilddBaseAlias.MANTIC, "mantic"), (ubuntu.BuilddBaseAlias.NOBLE, "core24"), + (ubuntu.BuilddBaseAlias.ORACULAR, "oracular"), (ubuntu.BuilddBaseAlias.DEVEL, "devel"), ], ) @@ -164,8 +164,8 @@ def test_get_image_remote(provider_base_alias, image_name): (ubuntu.BuilddBaseAlias.BIONIC, "core18"), (ubuntu.BuilddBaseAlias.FOCAL, "core20"), (ubuntu.BuilddBaseAlias.JAMMY, "core22"), - (ubuntu.BuilddBaseAlias.MANTIC, "mantic"), (ubuntu.BuilddBaseAlias.NOBLE, "core24"), + (ubuntu.BuilddBaseAlias.ORACULAR, "oracular"), (ubuntu.BuilddBaseAlias.DEVEL, "devel"), ], ) From a369826c84f6d4e68400f9fb2cf428edbd934362 Mon Sep 17 00:00:00 2001 From: Callahan Date: Tue, 23 Jul 2024 09:49:16 -0500 Subject: [PATCH 10/13] fix(multipass): use Ubuntu 24.04 image (#602) Signed-off-by: Callahan Kovacs --- craft_providers/multipass/multipass_provider.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/craft_providers/multipass/multipass_provider.py b/craft_providers/multipass/multipass_provider.py index b147c63d..ebcff004 100644 --- a/craft_providers/multipass/multipass_provider.py +++ b/craft_providers/multipass/multipass_provider.py @@ -96,9 +96,8 @@ def name(self) -> str: ubuntu.BuilddBaseAlias.JAMMY: RemoteImage( remote=Remote.SNAPCRAFT, image_name="22.04" ), - # this should use `image_name="24.04"` once noble is released (#511) ubuntu.BuilddBaseAlias.NOBLE: RemoteImage( - remote=Remote.SNAPCRAFT, image_name="devel" + remote=Remote.SNAPCRAFT, image_name="24.04" ), ubuntu.BuilddBaseAlias.ORACULAR: RemoteImage( remote=Remote.DAILY, image_name="oracular" From c5f35a0ad880edd2908c1eb730a7ccdf3648cb05 Mon Sep 17 00:00:00 2001 From: Alex Lowe Date: Tue, 23 Jul 2024 12:04:13 -0400 Subject: [PATCH 11/13] build(deps): use the ruff snap (#597) Co-authored-by: Dariusz Duda --- .github/workflows/tests.yaml | 1 + HACKING.rst | 4 ++-- pyproject.toml | 1 - tox.ini | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c223f225..ed9fb83d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -37,6 +37,7 @@ jobs: echo "Installing snaps in the background while running apt and pip..." sudo snap install --no-wait --classic pyright sudo snap install --no-wait shellcheck + sudo snap install --no-wait ruff echo "::endgroup::" echo "::group::pip install" python -m pip install 'tox>=4' diff --git a/HACKING.rst b/HACKING.rst index ff2e36b9..287ac973 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -25,6 +25,7 @@ you with tox, but you'll need to install: ``snap install --classic pyright``) - ShellCheck_ (also available via snap: ``snap install shellcheck``) - pre-commit_ +- ruff_ (also available via snap: ``snap install ruff``) Once you have all of those installed, you can install the necessary virtual environments for this repository using tox. @@ -35,7 +36,6 @@ Some other tools we use for code quality include: - Black_ for code formatting - pytest_ for testing -- ruff_ for linting (and some additional formatting) A complete list is kept in our pyproject.toml_ file in dev dependencies. @@ -130,7 +130,7 @@ Please follow these guidelines when committing code for this project: .. _pyproject.toml: ./pyproject.toml .. _Pyright: https://github.com/microsoft/pyright .. _pytest: https://pytest.org -.. _ruff: https://github.com/charliermarsh/ruff +.. _ruff: https://github.com/astral-sh/ruff .. _ShellCheck: https://www.shellcheck.net/ .. _`SSH access is limited`: https://github.com/marketplace/actions/debugging-with-tmate#use-registered-public-ssh-keys .. _`SSH key on GitHub`: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account diff --git a/pyproject.toml b/pyproject.toml index 47e04513..148cec9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,6 @@ dev = [ lint = [ "black==24.4.2", "codespell[toml]==2.2.6", - "ruff==0.4.10", "yamllint==1.35.1", ] types = [ diff --git a/tox.ini b/tox.ini index cee12425..99a885b3 100644 --- a/tox.ini +++ b/tox.ini @@ -93,6 +93,7 @@ base = testenv, lint labels = lint allowlist_externals = shellcheck: bash, xargs + ruff: ruff commands_pre = shellcheck: bash -c '{[shellcheck]find} | {[shellcheck]filter} > {env_tmp_dir}/shellcheck_files' commands = @@ -120,9 +121,11 @@ commands = description = Automatically format source code base = testenv, lint labels = format +allowlist_externals = + ruff: ruff commands = black: black {tty:--color} {posargs} . - ruff: ruff --fix --respect-gitignore {posargs} . + ruff: ruff check --fix --respect-gitignore {posargs} . codespell: codespell --toml {tox_root}/pyproject.toml --write-changes {posargs} [testenv:pre-commit] From 39852f7f12206e848b1f384828856fc6fc84e477 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 17:32:26 +0000 Subject: [PATCH 12/13] chore(deps): update dependency setuptools to v70.3.0 (#594) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 148cec9c..fff4d647 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,7 @@ docs = [ [build-system] requires = [ - "setuptools==70.2.0", + "setuptools==70.3.0", "setuptools_scm[toml]>=7.1" ] build-backend = "setuptools.build_meta" From 282913b3bbfdf893260618693738b08601c1ae2e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 24 Jul 2024 07:44:39 -0500 Subject: [PATCH 13/13] chore(deps): update dependency setuptools to v71 (#600) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fff4d647..8edf6916 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,7 @@ docs = [ [build-system] requires = [ - "setuptools==70.3.0", + "setuptools==71.1.0", "setuptools_scm[toml]>=7.1" ] build-backend = "setuptools.build_meta"