Repository: migros/fotoobo (language: python)

Issue:
Manage RTD dependencies with poetry
Patrik found a bit of documentation, describing how we can manage the dependencies for RTD installation with poetry:
https://docs.readthedocs.io/en/stable/build-customization.html#install-dependencies-with-poetry

To do this, we should move the documentation dependencies to a separate dependency group.

depends on #199 
Manage RTD dependencies with poetry
Patrik found a bit of documentation, describing how we can manage the dependencies for RTD installation with poetry:
https://docs.readthedocs.io/en/stable/build-customization.html#install-dependencies-with-poetry

To do this, we should move the documentation dependencies to a separate dependency group.

depends on #199 


Discussion / hints:

Fix patch:
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index 802f847..14cbbc9 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -1,6 +1,9 @@
 # .readthedocs.yaml
 # Read the Docs configuration file
 # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+#
+# To have an example on how to use this settings file with Poetry see:
+# https://docs.readthedocs.io/en/stable/build-customization.html#install-dependencies-with-poetry
 
 # Required
 version: 2
@@ -10,12 +13,18 @@ build:
   os: ubuntu-22.04
   tools:
     python: "3.10"
+  jobs:
+    post_create_environment:
+      # Install poetry
+      # https://python-poetry.org/docs/#installing-manually
+      - pip install poetry
+    post_install:
+      # Install dependencies with 'docs' dependency group
+      # https://python-poetry.org/docs/managing-dependencies/#dependency-groups
+      # VIRTUAL_ENV needs to be set manually for now.
+      # See https://github.com/readthedocs/readthedocs.org/pull/11152/
+      - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs
 
 # Build documentation in the docs/source/ directory with Sphinx
 sphinx:
   configuration: docs/source/conf.py
-
-# Declare the Python requirements required to build your docs
-python:
-  install:
-    - requirements: docs/requirements.txt
diff --git a/WHATSNEW.md b/WHATSNEW.md
index 1706537..2151d34 100644
--- a/WHATSNEW.md
+++ b/WHATSNEW.md
@@ -12,6 +12,7 @@
 - Improve error handling and tests for `Fortinet.api()`
 - Updated GitHub actions to latest major version due to Node.js 16 deprecation warning
 - Use new dependency groups for Poetry in pyproject.toml
+- Manage readthedocs dependencies with Poetry (instead of generated requirements.txt)
 
 ### Fixed
 
diff --git a/docs/requirements.txt b/docs/requirements.txt
deleted file mode 100644
index 5352edd..0000000
--- a/docs/requirements.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-astroid==2.13.5 ; python_full_version >= "3.8.0" and python_version < "3.13"
-attrs==23.2.0 ; python_full_version >= "3.8.0" and python_version < "3.13"
-black==22.10.0 ; python_full_version >= "3.8.0" and python_version < "3.13"
-cachetools==5.3.3 ; python_full_version >= "3.8.0" and python_version < "3.13"
-certifi==2024.2.2 ; python_full_version >= "3.8.0" and python_version < "3.13"
-chardet==5.2.0 ; python_full_version >= "3.8.0" and python_version < "3.13"
-charset-normalizer==3.3.2 ; python_full_version >= "3.8.0" and python_version < "3.13"
-click==8.1.7 ; python_full_version >= "3.8.0" and python_version < "3.13"
-colorama==0.4.6 ; python_full_version >= "3.8.0" and python_version < "3.13"
-commonmark==0.9.1 ; python_full_version >= "3.8.0" and python_version < "3.13"
-coverage[toml]==7.4.3 ; python_version >= "3.8" and python_version < "3.13"
-dill==0.3.8 ; python_version >= "3.8" and python_version < "3.13"
-distlib==0.3.8 ; python_full_version >= "3.8.0" and python_version < "3.13"
-exceptiongroup==1.2.0 ; python_full_version >= "3.8.0" and python_version < "3.11"
-filelock==3.13.1 ; python_version >= "3.8" and python_version < "3.13"
-idna==3.6 ; python_full_version >= "3.8.0" and python_version < "3.13"
-iniconfig==2.0.0 ; python_full_version >= "3.8.0" and python_version < "3.13"
-isort==5.10.1 ; python_full_version >= "3.8.0" and python_version < "3.13"
-jinja2==3.1.3 ; python_full_version >= "3.8.0" and python_version < "3.13"
-lazy-object-proxy==1.10.0 ; python_version >= "3.8" and python_version < "3.13"
-markupsafe==2.1.5 ; python_full_version >= "3.8.0" and python_version < "3.13"
-mccabe==0.7.0 ; python_full_version >= "3.8.0" and python_version < "3.13"
-mypy-extensions==1.0.0 ; python_full_version >= "3.8.0" and python_version < "3.13"
-mypy==0.991 ; python_full_version >= "3.8.0" and python_version < "3.13"
-packaging==23.2 ; python_version >= "3.8" and python_version < "3.13"
-pathspec==0.12.1 ; python_version >= "3.8" and python_version < "3.13"
-platformdirs==4.2.0 ; python_version >= "3.8" and python_version < "3.13"
-pluggy==1.4.0 ; python_version >= "3.8" and python_version < "3.13"
-pygments==2.17.2 ; python_full_version >= "3.8.0" and python_version < "3.13"
-pygount==1.5.1 ; python_full_version >= "3.8.0" and python_version < "3.13"
-pylint==2.15.10 ; python_full_version >= "3.8.0" and python_version < "3.13"
-pyproject-api==1.6.1 ; python_version >= "3.8" and python_version < "3.13"
-pytest-cov==4.0.0 ; python_full_version >= "3.8.0" and python_version < "3.13"
-pytest==7.2.2 ; python_full_version >= "3.8.0" and python_version < "3.13"
-pyyaml==6.0.1 ; python_full_version >= "3.8.0" and python_version < "3.13"
-requests==2.31.0 ; python_full_version >= "3.8.0" and python_version < "3.13"
-rich==12.5.1 ; python_full_version >= "3.8.0" and python_version < "3.13"
-tomli==2.0.1 ; python_version >= "3.8" and python_full_version < "3.11.0a7"
-tomlkit==0.12.4 ; python_full_version >= "3.8.0" and python_version < "3.13"
-tox==4.4.12 ; python_full_version >= "3.8.0" and python_version < "3.13"
-typer==0.6.1 ; python_full_version >= "3.8.0" and python_version < "3.13"
-types-pyyaml==6.0.12.12 ; python_full_version >= "3.8.0" and python_version < "3.13"
-types-requests==2.27.31 ; python_full_version >= "3.8.0" and python_version < "3.13"
-types-urllib3==1.26.25.14 ; python_full_version >= "3.8.0" and python_version < "3.13"
-typing-extensions==4.10.0 ; python_version >= "3.8" and python_version < "3.13"
-urllib3==2.2.1 ; python_version >= "3.8" and python_version < "3.13"
-virtualenv==20.25.1 ; python_full_version >= "3.8.0" and python_version < "3.13"
-wrapt==1.16.0 ; python_full_version >= "3.8.0" and python_version < "3.13"
diff --git a/pyproject.toml b/pyproject.toml
index df15137..568f45f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -94,7 +94,7 @@ disallow_untyped_decorators=false
 legacy_tox_ini = """[tox]
 
 isolated_build = True
-envlist = pylint, mypy, black, pytest, coverage, requirements, docs, stats
+envlist = pylint, mypy, black, pytest, coverage, docs, stats
 testpaths = "tests"
 
 [testenv:pylint]
@@ -139,12 +139,6 @@ allowlist_externals = poetry, pytest
 commands_pre = poetry install
 commands = pytest --cov-report term-missing --cov-fail-under 90 --cov=fotoobo --cov-config=.coverage_unittests_rc --ignore=tests/cli tests/ {posargs}
 
-[testenv:requirements]
-description = Create a requirements.txt from the Poetry dependencies (used for readthedocs)
-skip_install = True
-allowlist_externals = poetry
-commands = poetry export --without-hashes --with dev --format=requirements.txt --output=docs/requirements.txt
-
 [testenv:docs]
 description = Create the documentation with sphinx
 skip_install = True


Test patch:
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index 033b86c..8d33312 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -39,9 +39,6 @@ jobs:
       - name: Check code coverage
         run: |
           poetry run tox -e coverage
-      - name: Test create requirements file for readthedocs.io
-        run: |
-          poetry run tox -e requirements
-      - name: Test create docs
+      - name: Create documentation
         run: |
           poetry run tox -e docs