diff --git a/.readthedocs.yaml b/.readthedocs.yaml index f861b63a..4da2dbd7 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -2,12 +2,18 @@ version: 2 python: install: - - requirements: docs/requirements.txt + - method: pip + path: . + extra_requirements: + - dev + - docs build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: - python: "3.10" + # Older Shpinx uses imghdr that was removed in Python 3.13 + # See e.g. https://github.com/python/cpython/issues/104818 + python: "3.12" sphinx: configuration: docs/conf.py diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 2ee6d200..00000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,16 +0,0 @@ -pytz -pymacaroons -sphinx==5.3.0 -sphinxcontrib-asyncio -sphinx_rtd_theme -websockets -typing-inspect -pyyaml -pyasn1 -pyrfc3339 -paramiko -macaroonbakery -toposort -python-dateutil -kubernetes -packaging diff --git a/pyproject.toml b/pyproject.toml index 47c22809..f3c1118e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,19 @@ dependencies = [ "hvac", "packaging", "typing-extensions>=4.5.0", - "backports.strenum>=1.3.1", + 'backports.strenum>=1.3.1; python_version < "3.11"', +] +[project.optional-dependencies] +dev = [ + "typing-inspect", + "pytest", + "pytest-asyncio", + "Twine", +] +docs = [ + "sphinx==5.3.0", + "sphinxcontrib-asyncio", + "sphinx_rtd_theme", ] [project.urls] diff --git a/setup.py b/setup.py index 5b845661..5ee1fe8c 100644 --- a/setup.py +++ b/setup.py @@ -32,8 +32,16 @@ "hvac", "packaging", "typing-extensions>=4.5.0", - "backports.strenum", + 'backports.strenum>=1.3.1; python_version < "3.11"', ], + extras_require={ + "dev": [ + "typing-inspect", + "pytest", + "pytest-asyncio", + "Twine", + ] + }, include_package_data=True, maintainer="Juju Ecosystem Engineering", maintainer_email="juju@lists.ubuntu.com", diff --git a/tests/integration/test_model.py b/tests/integration/test_model.py index e843a774..e4659480 100644 --- a/tests/integration/test_model.py +++ b/tests/integration/test_model.py @@ -10,7 +10,6 @@ from unittest import mock import paramiko -import pylxd import pytest from juju import jasyncio, tag, url @@ -29,6 +28,11 @@ from ..utils import GB, INTEGRATION_TEST_DIR, MB, OVERLAYS_DIR, SSH_KEY, TESTS_DIR +@pytest.fixture +def pylxd(): + return pytest.importorskip("pylxd") + + @base.bootstrapped async def test_model_name(): model = Model() @@ -532,7 +536,7 @@ async def test_add_machine(): assert len(model.machines) == 0 -async def add_manual_machine_ssh(is_root=False): +async def add_manual_machine_ssh(pylxd, is_root=False): # Verify controller is localhost async with base.CleanController() as controller: cloud = await controller.get_cloud() @@ -677,7 +681,7 @@ def wait_for_network(container, timeout=30): @base.bootstrapped -async def test_add_manual_machine_ssh(): +async def test_add_manual_machine_ssh(pylxd): """Test manual machine provisioning with a non-root user. Tests manual machine provisioning using a randomized username with @@ -687,9 +691,9 @@ async def test_add_manual_machine_ssh(): @base.bootstrapped -async def test_add_manual_machine_ssh_root(): +async def test_add_manual_machine_ssh_root(pylxd): """Test manual machine provisioning with the root user.""" - await add_manual_machine_ssh(is_root=True) + await add_manual_machine_ssh(pylxd, is_root=True) @base.bootstrapped diff --git a/tox.ini b/tox.ini index 43abbec2..1e6071c0 100644 --- a/tox.ini +++ b/tox.ini @@ -9,35 +9,19 @@ envlist = py3,py38,py39,py310,py311,docs skipsdist=True [testenv] -usedevelop=True -commands = - pip install urllib3<2 - pip install pylxd - pytest --tb native -s -k 'not integration' -m 'not serial' {posargs} +use_develop = True +# This should work, but doesn't. Hence the deps= below +# extras = dev +deps = + .[dev] passenv = HOME TEST_AGENTS LXD_DIR -# FIXME would it be easier to `pip install -e .`? -deps = - macaroonbakery - toposort - typing-inspect - paramiko - ipdb - pytest - pytest-asyncio - Twine - websockets<14.0 - kubernetes<31.0.0 - hvac - packaging - setuptools - backports.strenum [testenv:docs] deps = - -r docs/requirements.txt + .[dev,docs] allowlist_externals = rm commands = @@ -47,8 +31,6 @@ commands = [testenv:integration] envdir = {toxworkdir}/py3 commands = - pip install urllib3<2 - pip install pylxd pytest \ --tb native \ -k 'integration' \ @@ -60,8 +42,6 @@ commands = [testenv:integration-quarantine] envdir = {toxworkdir}/py3 commands = - pip install urllib3<2 - pip install pylxd pytest \ --tb native \ -m 'not serial' \ @@ -72,8 +52,6 @@ commands = [testenv:unit] envdir = {toxworkdir}/py3 commands = - pip install urllib3<2 - pip install pylxd pytest {toxinidir}/tests/unit {posargs} [testenv:serial] @@ -82,8 +60,6 @@ commands = # it doesn't get run in CI envdir = {toxworkdir}/py3 commands = - pip install urllib3<2 - pip install pylxd pytest --tb native -s {posargs:-m 'serial'} [testenv:validate]