From ad391a852bb37114250fdcf5dd7c48c999ac4836 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 17:08:01 -0500 Subject: [PATCH 01/24] Switching to poetry dev deps group --- Makefile | 43 ++++++++++++++++++++++++++----------------- poetry.lock | 17 +++++++---------- pyproject.toml | 22 +++++++++------------- 3 files changed, 42 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index bb6c132..da80c13 100644 --- a/Makefile +++ b/Makefile @@ -4,53 +4,62 @@ export POETRY_VIRTUALENVS_IN_PROJECT = true ## Dependencies +init: _HELP = Initialize Python VirtualEnv via Poetry (optional PROJECT_PY_PATH env var) +init: +ifdef PROJECT_PY_PATH + poetry env use $(PROJECT_PY_PATH) +else + command -V python3 < /dev/null + poetry env use $(shell command -v python3 < /dev/null) +endif + poetry.lock: _HELP = Lock dependency versions to file poetry.lock: poetry lock +.PHONY: relock +relock: _HELP = Delete and recreate poetry lock file +relock: + rm -f poetry.lock && $(MAKE) poetry.lock + .PHONY: deps deps: _HELP = Install project dependencies deps: - poetry install -E docs - poetry run python -V - -requirements.txt: _HELP = Generate development requirements.txt -requirements.txt: poetry.lock - poetry export --dev --without-hashes -o $@ + poetry install --with dev ## Testing .PHONY: lint lint: _HELP = Run linters -lint: deps +lint: poetry check poetry run black --check --color --diff . - poetry run flake8 --application-import-names $(PROJECT_NAME),tests - poetry run pylint $(PROJECT_NAME) tests docs/conf.py + poetry run flake8 --application-import-names $(PROJECT_NAME),docs,tests + poetry run pylint $(PROJECT_NAME) docs tests .PHONY: test test: _HELP = Run unit tests -test: deps +test: poetry run pytest --cov=$(PROJECT_NAME) --cov-report=html --cov-report=xml tests/unit_tests .PHONY: testpdb testpdb: _HELP = Run unit tests and drop into the debugger on failure -testpdb: deps +testpdb: poetry run pytest --pdb tests/unit_tests .PHONY: it it: _HELP = Run integration tests -it: deps +it: poetry run pytest tests/integration_tests .PHONY: itpdb itpdb: _HELP = Run integration tests and drop into the debugger on failure -itpdb: deps +itpdb: poetry run pytest --pdb tests/integration_tests .PHONY: all all: _HELP = Run linters, unit tests, integration tests, and builds -all: lint test it docs build +all: test it lint docs build ## Build @@ -59,7 +68,7 @@ build: _HELP = Build Python package (sdist and wheel) build: poetry build -n -vvv -docs/_build/html/index.html: deps +docs/_build/html/index.html:: poetry run sphinx-build -a -E -n -W docs $(@D) @echo Documentation available here: $@ @@ -71,8 +80,8 @@ docs: docs/_build/html/index.html clean: _HELP = Remove temporary files clean: - rm -rfv *.egg-info/ *cache*/ .*cache*/ .coverage coverage.xml htmlcov/ dist/ docs/_build requirements.txt - find . -name __pycache__ -type d -exec rm -r {} + + rm -rfv *.egg-info/ *cache*/ .*cache*/ .coverage* coverage.xml htmlcov/ dist/ docs/_build/ requirements.txt + find . -path '*/.*' -prune -o -name __pycache__ -type d -exec rm -r {} + distclean: _HELP = Remove temporary files including virtualenv distclean: clean diff --git a/poetry.lock b/poetry.lock index fb2949c..7795883 100644 --- a/poetry.lock +++ b/poetry.lock @@ -856,7 +856,7 @@ test = ["cython", "html5lib", "pytest", "pytest-cov", "typed-ast"] name = "sphinx-copybutton" version = "0.5.2" description = "Add a copy button to each of your code cells." -optional = true +optional = false python-versions = ">=3.7" files = [ {file = "sphinx-copybutton-0.5.2.tar.gz", hash = "sha256:4cf17c82fb9646d1bc9ca92ac280813a3b605d8c421225fd9913154103ee1fbd"}, @@ -874,7 +874,7 @@ rtd = ["ipython", "myst-nb", "sphinx", "sphinx-book-theme", "sphinx-examples"] name = "sphinx-notfound-page" version = "0.8.3" description = "Sphinx extension to build a 404 page with absolute URLs" -optional = true +optional = false python-versions = "*" files = [ {file = "sphinx-notfound-page-0.8.3.tar.gz", hash = "sha256:f728403280026b84c234540bebbed7f710b9ea582e7348a35a5becefe4024332"}, @@ -892,7 +892,7 @@ test = ["tox"] name = "sphinx-panels" version = "0.6.0" description = "A sphinx extension for creating panels in a grid layout." -optional = true +optional = false python-versions = "*" files = [ {file = "sphinx-panels-0.6.0.tar.gz", hash = "sha256:d36dcd26358117e11888f7143db4ac2301ebe90873ac00627bf1fe526bf0f058"}, @@ -913,7 +913,7 @@ themes = ["myst-parser (>=0.12.9,<0.13.0)", "pydata-sphinx-theme (>=0.4.0,<0.5.0 name = "sphinx-rtd-theme" version = "1.3.0" description = "Read the Docs theme for Sphinx" -optional = true +optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" files = [ {file = "sphinx_rtd_theme-1.3.0-py2.py3-none-any.whl", hash = "sha256:46ddef89cc2416a81ecfbeaceab1881948c014b1b6e4450b815311a89fb977b0"}, @@ -977,7 +977,7 @@ test = ["html5lib", "pytest"] name = "sphinxcontrib-jquery" version = "4.1" description = "Extension to include jQuery on newer Sphinx releases" -optional = true +optional = false python-versions = ">=2.7" files = [ {file = "sphinxcontrib-jquery-4.1.tar.gz", hash = "sha256:1620739f04e36a2c779f1a131a2dfd49b2fd07351bf1968ced074365933abc7a"}, @@ -1035,7 +1035,7 @@ test = ["pytest"] name = "toml" version = "0.10.2" description = "Python Library for Tom's Obvious, Minimal Language" -optional = true +optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" files = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, @@ -1092,10 +1092,7 @@ h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] -[extras] -docs = ["sphinx-copybutton", "sphinx-notfound-page", "sphinx-panels", "sphinx-rtd-theme", "toml"] - [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "0e5cb16e4d39f145e9c460ddcb746d5363873ad4506f7ed01c09a60bd933a4a9" +content-hash = "55d67eb6dc0113902363596fb9e3660a5eda1e99ebd65ac9a2cb2eea6491fc18" diff --git a/pyproject.toml b/pyproject.toml index 0b1c3b4..2398680 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["poetry>=0.12"] -build-backend = "poetry.masonry.api" +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" [tool.poetry] name = "sphinx-disqus" @@ -35,19 +35,15 @@ repository = "https://github.com/Robpol86/sphinx-disqus" [tool.poetry.dependencies] python = "^3.8" -# Project dependencies. sphinx = "*" -# Docs. -sphinx-copybutton = {version = "*", optional = true} -sphinx-notfound-page = {version = "*", optional = true} -sphinx-panels = {version = "*", optional = true} -sphinx-rtd-theme = {version = "*", optional = true} -toml = {version = "*", optional = true} - -[tool.poetry.extras] -docs = ["sphinx-notfound-page", "sphinx-panels", "sphinx-rtd-theme", "sphinx-copybutton", "toml"] -[tool.poetry.dev-dependencies] +[tool.poetry.group.dev.dependencies] +# Docs. +sphinx-copybutton = "*" +sphinx-notfound-page = "*" +sphinx-panels = "*" +sphinx-rtd-theme = "*" +toml = "*" # Linters. black = "*" # not semver flake8 = ">=4.0.1" From 4178b5f234d41ce9e1805c77ced485a95149df84 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 17:23:59 -0500 Subject: [PATCH 02/24] reformat ci --- .github/workflows/ci.yml | 51 +++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 923c4ef..2dffc28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,30 +1,53 @@ name: Continuous Integration + on: pull_request: push: + jobs: - test: - name: Test + Test: strategy: matrix: os: [ubuntu-latest, windows-latest] python: ["3.8", "3.9", "3.10"] - runs-on: "${{matrix.os}}" - env: - PY_COLORS: 1 + runs-on: "${{ matrix.os }}" steps: - - {name: Check out repository code, uses: actions/checkout@v4} - - {name: Install Python, uses: actions/setup-python@v5, with: {python-version: "${{matrix.python}}"}, id: py} - - {name: Install Poetry, uses: abatilo/actions-poetry@v3} - - {name: Install dependencies, run: make deps} - - {name: Run lints, run: make lint} - - {name: Run tests, run: make test} - - {name: Run integration tests, run: make it} - - {name: Build docs, run: make docs} - - {name: Build package, run: make build} + + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Install Python + id: py + uses: actions/setup-python@v5 + with: + python-version: "${{matrix.python}}" + + - name: Install Poetry + uses: abatilo/actions-poetry@v3 + + - name: Install dependencies + run: make deps + + - name: Run lints + run: make lint + + - name: Run tests + env: + PY_COLORS: 1 + run: make test + + - name: Run integration tests + run: make it + + - name: Build docs + run: make docs + + - name: Build package + run: make build + - name: Upload coverage uses: codecov/codecov-action@v4 with: From 5d4864165bbb830af279a42098b5c59326d1bd99 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 17:44:01 -0500 Subject: [PATCH 03/24] moving to poetry.toml --- Makefile | 1 - poetry.toml | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 poetry.toml diff --git a/Makefile b/Makefile index da80c13..4bf4ec3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ .DEFAULT_GOAL = help PROJECT_NAME = sphinx_disqus -export POETRY_VIRTUALENVS_IN_PROJECT = true ## Dependencies diff --git a/poetry.toml b/poetry.toml new file mode 100644 index 0000000..53b35d3 --- /dev/null +++ b/poetry.toml @@ -0,0 +1,3 @@ +[virtualenvs] +create = true +in-project = true From 3cd3d9c8d601e729492b622e9aa237ad03703a6a Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 17:56:26 -0500 Subject: [PATCH 04/24] use cache --- .github/workflows/ci.yml | 12 ++++++------ Makefile | 9 --------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2dffc28..02e9841 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,14 +19,14 @@ jobs: - name: Check out repository code uses: actions/checkout@v4 + - name: Install Poetry + uses: abatilo/actions-poetry@v3 + - name: Install Python - id: py uses: actions/setup-python@v5 with: - python-version: "${{matrix.python}}" - - - name: Install Poetry - uses: abatilo/actions-poetry@v3 + python-version: "${{ matrix.python }}" + cache: poetry - name: Install dependencies run: make deps @@ -51,5 +51,5 @@ jobs: - name: Upload coverage uses: codecov/codecov-action@v4 with: - name: "coverage-${{runner.os}}-py${{steps.py.outputs.python-version}}" + name: "coverage-${{ runner.os }}-py${{ matrix.python }}" token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Makefile b/Makefile index 4bf4ec3..805b7f0 100644 --- a/Makefile +++ b/Makefile @@ -3,15 +3,6 @@ PROJECT_NAME = sphinx_disqus ## Dependencies -init: _HELP = Initialize Python VirtualEnv via Poetry (optional PROJECT_PY_PATH env var) -init: -ifdef PROJECT_PY_PATH - poetry env use $(PROJECT_PY_PATH) -else - command -V python3 < /dev/null - poetry env use $(shell command -v python3 < /dev/null) -endif - poetry.lock: _HELP = Lock dependency versions to file poetry.lock: poetry lock From e6dc3d38aff912bf30ad7d2a0b77aa4b51598ba8 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:04:26 -0500 Subject: [PATCH 05/24] upload artifact --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02e9841..bded4c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,3 +53,10 @@ jobs: with: name: "coverage-${{ runner.os }}-py${{ matrix.python }}" token: ${{ secrets.CODECOV_TOKEN }} + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist + if-no-files-found: error From 2e462ffb5f2e80bffa6092dc7e7168f2ed553255 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:08:29 -0500 Subject: [PATCH 06/24] style --- .github/workflows/ci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bded4c1..f079b57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: runs-on: "${{ matrix.os }}" steps: - - name: Check out repository code + - name: Checkout uses: actions/checkout@v4 - name: Install Poetry @@ -28,33 +28,33 @@ jobs: python-version: "${{ matrix.python }}" cache: poetry - - name: Install dependencies + - name: Install Dependencies run: make deps - - name: Run lints + - name: Run Lints run: make lint - - name: Run tests + - name: Run Tests env: PY_COLORS: 1 run: make test - - name: Run integration tests + - name: Run Integration Tests run: make it - - name: Build docs + - name: Build Docs run: make docs - - name: Build package + - name: Build Package run: make build - - name: Upload coverage + - name: Upload Coverage uses: codecov/codecov-action@v4 with: name: "coverage-${{ runner.os }}-py${{ matrix.python }}" token: ${{ secrets.CODECOV_TOKEN }} - - name: Upload artifact + - name: Upload Artifact uses: actions/upload-artifact@v4 with: name: dist From 5be797863ada2b3b70ccb8251706f3dbeee740f9 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:10:29 -0500 Subject: [PATCH 07/24] fix --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f079b57..5a48860 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} - name: Upload Artifact + if: runner.os == 'Linux' && matrix.python == '3.10' uses: actions/upload-artifact@v4 with: name: dist From 68300ea0f211e3bb3766224906b4fb0e5ba47ef7 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:21:36 -0500 Subject: [PATCH 08/24] validate --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a48860..f22c9e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,3 +61,27 @@ jobs: name: dist path: dist if-no-files-found: error + + Validate: + needs: Test + runs-on: ubuntu-latest + steps: + + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: dist + + - name: Extract + working-directory: dist + run: | + unzip -t *.whl + unzip -p *.whl '*/METADATA' + + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Pip Install + run: pip install dist/*.whl From e0f37c14d2d0da1c728dc1e1d98dcc3f0cc857a6 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:24:38 -0500 Subject: [PATCH 09/24] VALIDATE_PY_VERSION --- .github/workflows/ci.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f22c9e3..78963b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,10 @@ on: push: +env: + VALIDATE_PY_VERSION: "3.10" + + jobs: Test: @@ -55,7 +59,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} - name: Upload Artifact - if: runner.os == 'Linux' && matrix.python == '3.10' + if: runner.os == 'Linux' && matrix.python == env.VALIDATE_PY_VERSION uses: actions/upload-artifact@v4 with: name: dist @@ -73,15 +77,15 @@ jobs: name: dist - name: Extract - working-directory: dist run: | + ls -lah unzip -t *.whl unzip -p *.whl '*/METADATA' - name: Install Python uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "${{ env.VALIDATE_PY_VERSION }}" - name: Pip Install run: pip install dist/*.whl From a48a44811fdd9049e7b4d5f5820ddafa201bdfa2 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:28:25 -0500 Subject: [PATCH 10/24] fix pip install --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78963b3..ae6a396 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,4 +88,4 @@ jobs: python-version: "${{ env.VALIDATE_PY_VERSION }}" - name: Pip Install - run: pip install dist/*.whl + run: pip install *.whl From 27f5c90a3ee03576fb1da11d1db79aba276b87e1 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:41:48 -0500 Subject: [PATCH 11/24] asdf plugin poetry --- .readthedocs.yaml | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 67ce7c3..8e97259 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,37 +1,17 @@ -# Read the Docs configuration file for Sphinx projects -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -# Required version: 2 -# Set the OS, Python version and other tools you might need build: os: ubuntu-22.04 tools: - python: "3.12" - # You can also specify other tool versions: - # nodejs: "20" - # rust: "1.70" - # golang: "1.20" + python: "3.10" + jobs: + pre_create_environment: + - asdf plugin add poetry + - asdf install poetry latest + - asdf global poetry latest + post_install: + - poetry install --with dev -# Build documentation in the "docs/" directory with Sphinx sphinx: configuration: docs/conf.py - # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs - # builder: "dirhtml" - # Fail on all warnings to avoid broken references - # fail_on_warning: true - -# Optionally build your docs in additional formats such as PDF and ePub -# formats: -# - pdf -# - epub - -# Optional but recommended, declare the Python requirements required -# to build your documentation -# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html -python: - install: - - method: pip - path: . - extra_requirements: [docs] + fail_on_warning: true From aaf6f63d4e8f6513617c449fc2158291ffa3cf1a Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:43:29 -0500 Subject: [PATCH 12/24] create false --- .readthedocs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 8e97259..c206dd1 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,6 +9,7 @@ build: - asdf plugin add poetry - asdf install poetry latest - asdf global poetry latest + - poetry config virtualenvs.create false post_install: - poetry install --with dev From 0df1dc961c651ab1ced475cf36342144241f20dc Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:46:09 -0500 Subject: [PATCH 13/24] no create --- poetry.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/poetry.toml b/poetry.toml index 53b35d3..ab1033b 100644 --- a/poetry.toml +++ b/poetry.toml @@ -1,3 +1,2 @@ [virtualenvs] -create = true in-project = true From dd79b9dc07610ff80f3394aeff670fa952b3ff66 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:48:56 -0500 Subject: [PATCH 14/24] local --- .readthedocs.yaml | 2 +- poetry.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index c206dd1..26230aa 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ build: - asdf plugin add poetry - asdf install poetry latest - asdf global poetry latest - - poetry config virtualenvs.create false + - poetry config --local virtualenvs.create false post_install: - poetry install --with dev diff --git a/poetry.toml b/poetry.toml index ab1033b..53b35d3 100644 --- a/poetry.toml +++ b/poetry.toml @@ -1,2 +1,3 @@ [virtualenvs] +create = true in-project = true From 9775cbb35f1ed486bf1cf96856fd42268e22123e Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:52:55 -0500 Subject: [PATCH 15/24] INVESTIGATE --- .readthedocs.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 26230aa..3add148 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -11,7 +11,13 @@ build: - asdf global poetry latest - poetry config --local virtualenvs.create false post_install: + - which sphinx-build + - sphinx-build --version - poetry install --with dev + - ls -lah + - pwd + - which sphinx-build + - sphinx-build --version sphinx: configuration: docs/conf.py From 902dad760bb89e4bedda56ae3807e649016db027 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:56:43 -0500 Subject: [PATCH 16/24] which --- .readthedocs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 3add148..1e22dec 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -11,6 +11,7 @@ build: - asdf global poetry latest - poetry config --local virtualenvs.create false post_install: + - which python - which sphinx-build - sphinx-build --version - poetry install --with dev From 4c293a1382cfff5a8941403cb2411f165c7a646a Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 18:57:53 -0500 Subject: [PATCH 17/24] poetry run which python --- .readthedocs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 1e22dec..368246e 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -15,6 +15,7 @@ build: - which sphinx-build - sphinx-build --version - poetry install --with dev + - poetry run which python - ls -lah - pwd - which sphinx-build From 17c5f39808b9d7f527dedfb9f93725469703aa8c Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 19:00:15 -0500 Subject: [PATCH 18/24] vvv --- .readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 368246e..5808312 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -14,7 +14,7 @@ build: - which python - which sphinx-build - sphinx-build --version - - poetry install --with dev + - poetry install -vvv --with dev - poetry run which python - ls -lah - pwd From 9f9f9c8541b3779096951731abc4a7246a154680 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 19:27:22 -0500 Subject: [PATCH 19/24] VIRTUAL_ENV --- .readthedocs.yaml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 5808312..636a044 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -11,15 +11,7 @@ build: - asdf global poetry latest - poetry config --local virtualenvs.create false post_install: - - which python - - which sphinx-build - - sphinx-build --version - - poetry install -vvv --with dev - - poetry run which python - - ls -lah - - pwd - - which sphinx-build - - sphinx-build --version + - VIRTUAL_ENV="$READTHEDOCS_VIRTUALENV_PATH" poetry install --with dev sphinx: configuration: docs/conf.py From 288b1dc278cf6699ceb0193d8b0a7412a326985a Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 19:30:17 -0500 Subject: [PATCH 20/24] test removing config override --- .readthedocs.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 636a044..7efe3e1 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,6 @@ build: - asdf plugin add poetry - asdf install poetry latest - asdf global poetry latest - - poetry config --local virtualenvs.create false post_install: - VIRTUAL_ENV="$READTHEDOCS_VIRTUALENV_PATH" poetry install --with dev From a9e9779069d1b339aee9a22292c23e40e3199680 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 20:00:37 -0500 Subject: [PATCH 21/24] style --- .github/workflows/pypi.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 82c500c..b792733 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -5,25 +5,23 @@ on: jobs: - build: - name: Build + Build: runs-on: ubuntu-latest steps: - - {name: Check out repository code, uses: actions/checkout@v4} - - {name: Install Python, uses: actions/setup-python@v5, with: {python-version: "3.10"}} + - {name: Checkout, uses: actions/checkout@v4} - {name: Install Poetry, uses: abatilo/actions-poetry@v3} + - {name: Install Python, uses: actions/setup-python@v5, with: {python-version: "3.10", cache: poetry}} - {name: Copy LICENSE to COPYING, run: cp --no-clobber --verbose LICENSE COPYING} # For Python wheel. - - {name: Build package, run: make build} - - name: Store artifacts + - {name: Build Package, run: make build} + - name: Upload Artifact uses: actions/upload-artifact@v4 - with: {name: dist, path: dist/, if-no-files-found: error} + with: {name: dist, path: dist, if-no-files-found: error} - publish: - name: Publish to PyPI - needs: build + Publish: + needs: Build runs-on: ubuntu-latest steps: - - {name: Fetch packages, uses: actions/download-artifact@v4, with: {name: dist, path: dist}} + - {name: Download Artifact, uses: actions/download-artifact@v4, with: {name: dist, path: dist}} - name: Publish packages to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: From 6dd4c9c89399966e9395532f8e53c7acca2a1ba8 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 20:04:26 -0500 Subject: [PATCH 22/24] style --- .github/workflows/pypi.yml | 39 ++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index b792733..0d364a4 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -8,25 +8,44 @@ jobs: Build: runs-on: ubuntu-latest steps: - - {name: Checkout, uses: actions/checkout@v4} - - {name: Install Poetry, uses: abatilo/actions-poetry@v3} - - {name: Install Python, uses: actions/setup-python@v5, with: {python-version: "3.10", cache: poetry}} - - {name: Copy LICENSE to COPYING, run: cp --no-clobber --verbose LICENSE COPYING} # For Python wheel. - - {name: Build Package, run: make build} + - name: Checkout + uses: actions/checkout@v4 + - name: Install Poetry + uses: abatilo/actions-poetry@v3 + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache: poetry + - name: Copy LICENSE to COPYING # For Python wheel + run: cp --no-clobber --verbose LICENSE COPYING + - name: Build Package + run: make build - name: Upload Artifact uses: actions/upload-artifact@v4 - with: {name: dist, path: dist, if-no-files-found: error} + with: + name: dist + path: dist + if-no-files-found: error Publish: needs: Build runs-on: ubuntu-latest steps: - - {name: Download Artifact, uses: actions/download-artifact@v4, with: {name: dist, path: dist}} - - name: Publish packages to PyPI + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: dist + path: dist + - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} - - name: Upload packages to Release + - name: Upload to Release uses: svenstaro/upload-release-action@v2 - with: {file: dist/*, file_glob: true, repo_token: "${{ secrets.GITHUB_TOKEN }}", tag: "${{ github.ref }}"} + with: + file: dist/* + file_glob: true + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref }} From 2bc660d176fdbdddffb11696faa43772dc15c302 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 20:14:53 -0500 Subject: [PATCH 23/24] done --- .github/workflows/pypi.yml | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 0d364a4..533bf68 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -5,6 +5,29 @@ on: jobs: + Docs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Poetry + uses: abatilo/actions-poetry@v3 + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache: poetry + - name: Build Docs + run: make docs + - name: Compress + run: tar -C docs/_build -czvf docs.tar.gz --transform s/^html/docs/ html/ + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: docs + path: docs.tar.gz + if-no-files-found: error + Build: runs-on: ubuntu-latest steps: @@ -29,10 +52,10 @@ jobs: if-no-files-found: error Publish: - needs: Build + needs: [Build, Docs] runs-on: ubuntu-latest steps: - - name: Download Artifact + - name: Download Build Artifact uses: actions/download-artifact@v4 with: name: dist @@ -42,6 +65,11 @@ jobs: with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} + - name: Download Documentation Artifact + uses: actions/download-artifact@v4 + with: + name: docs + path: dist - name: Upload to Release uses: svenstaro/upload-release-action@v2 with: From 37134e02a03be5e39e97e73293359ba588ef836f Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Thu, 4 Jul 2024 20:28:07 -0500 Subject: [PATCH 24/24] update contrib --- CONTRIBUTING.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b162dc4..6ab9acb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,25 +8,23 @@ You may follow these steps if you wish to create a pull request. Fork the repo a in the project's directory run this if you're on macOS (requires [Homebrew](https://brew.sh)): ```bash -brew install python@3.7 +brew install python brew install poetry # More info: https://python-poetry.org make clean -POETRY_VIRTUALENVS_IN_PROJECT=true poetry env use "$(brew --prefix)/opt/python@3.7/bin/python3" ``` On Ubuntu (including Windows WSL2): ```bash -sudo apt-get update && sudo apt-get install make python3-virtualenv python3.9 -curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python3 - +sudo apt-get update && sudo apt-get install make python3-virtualenv python3 +curl -sSL https://install.python-poetry.org | python3 - make clean -POETRY_VIRTUALENVS_IN_PROJECT=true poetry env use "$(which python3.9)" ``` Then see if you can run lints and tests: ```bash -make all +make deps all ``` ## Writing Tests