From 222700169f99e93e60bfdbb2dcc5e7e95b848b9b Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Tue, 7 Nov 2023 21:18:28 +0000 Subject: [PATCH 1/7] migrate to poetry --- .gitignore | 2 + pyproject.toml | 56 +++++++++++-------- setup.py | 38 ------------- .../sphinxcontrib}/kroki/__init__.py | 0 .../sphinxcontrib}/kroki/kroki.py | 0 .../sphinxcontrib}/kroki/transform.py | 0 .../sphinxcontrib}/kroki/util.py | 0 7 files changed, 35 insertions(+), 61 deletions(-) delete mode 100644 setup.py rename {sphinxcontrib => src/sphinxcontrib}/kroki/__init__.py (100%) rename {sphinxcontrib => src/sphinxcontrib}/kroki/kroki.py (100%) rename {sphinxcontrib => src/sphinxcontrib}/kroki/transform.py (100%) rename {sphinxcontrib => src/sphinxcontrib}/kroki/util.py (100%) diff --git a/.gitignore b/.gitignore index 30b41d2..2aeb5e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .env .runner +poetry.lock +.venv __pycache__/ *.py[cod] diff --git a/pyproject.toml b/pyproject.toml index 943771c..3bf31da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,28 +1,33 @@ -[build-system] -requires = ["setuptools", "flit_core >=2,<4"] -build-backend = "setuptools.build_meta" - -[tool.flit.metadata] -module = "sphinxcontrib-kroki" -author = "Martin Hasoň" -author-email = "martin.hason@gmail.com" -home-page = "https://github.com/sphinx-contrib/kroki" -description-file = "README.md" -classifiers = ["License :: OSI Approved :: MIT License"] -requires-python = ">=3.6" -requires = [ - "sphinx", - "requests>=2.4.2", +[tool.poetry] +name = "sphinxcontrib-kroki" +version = "1.3.0" +description = "Kroki integration into sphinx" +license = "MIT" +authors = ["Martin Hasoň "] +readme = "README.md" +repository = "https://github.com/sphinx-contrib/kroki" +classifiers = [ + "Framework :: Sphinx :: Extension", + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", ] - -[tool.flit.metadata.requires-extra] -code = ["black", "flake8", "mypy"] -test = [ - "coverage", - "pytest", - "pytest-cov", +packages = [ + { include = "sphinxcontrib", from = "src" } ] -extra = [] + +[tool.poetry.dependencies] +python = "^3.6" +sphinx = "*" +requests = "^2.4.2" + +[tool.poetry.group.dev.dependencies] +black = "*" +flake8 = "*" +mypy = "*" +coverage = "*" +pytest = "*" +pytest-cov = "*" [tool.pytest.ini_options] markers = [ @@ -31,3 +36,8 @@ markers = [ [tool.black] line-length = 79 + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/setup.py b/setup.py deleted file mode 100644 index a2aa298..0000000 --- a/setup.py +++ /dev/null @@ -1,38 +0,0 @@ -from setuptools import find_namespace_packages, setup - -with open("README.md", "r") as fh: - long_description = fh.read() - -setup( - name="sphinxcontrib-kroki", - version="1.3.0", - author="Martin Hasoň", - author_email="martin.hason@gmail.com", - description="Kroki integration into sphinx", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/sphinx-contrib/kroki", - packages=find_namespace_packages(include=["sphinxcontrib.*"]), - classifiers=[ - "Framework :: Sphinx :: Extension", - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - python_requires=">=3.6", - install_requires=[ - "sphinx", - "requests>=2.4.2", - "pyyaml" - ], - extras_require={ - "code": ["black", "flake8", "mypy"], - "test": [ - "coverage", - "pytest", - "pytest-cov", - ], - "extra": [ - ], - }, -) diff --git a/sphinxcontrib/kroki/__init__.py b/src/sphinxcontrib/kroki/__init__.py similarity index 100% rename from sphinxcontrib/kroki/__init__.py rename to src/sphinxcontrib/kroki/__init__.py diff --git a/sphinxcontrib/kroki/kroki.py b/src/sphinxcontrib/kroki/kroki.py similarity index 100% rename from sphinxcontrib/kroki/kroki.py rename to src/sphinxcontrib/kroki/kroki.py diff --git a/sphinxcontrib/kroki/transform.py b/src/sphinxcontrib/kroki/transform.py similarity index 100% rename from sphinxcontrib/kroki/transform.py rename to src/sphinxcontrib/kroki/transform.py diff --git a/sphinxcontrib/kroki/util.py b/src/sphinxcontrib/kroki/util.py similarity index 100% rename from sphinxcontrib/kroki/util.py rename to src/sphinxcontrib/kroki/util.py From a53f01a5809d004e6dd1a69339c50f0a14f39138 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Tue, 7 Nov 2023 21:37:27 +0000 Subject: [PATCH 2/7] update ci --- .github/workflows/tests.yml | 30 +++++++++++---------- pyproject.toml | 1 + run | 53 ------------------------------------- 3 files changed, 17 insertions(+), 67 deletions(-) delete mode 100755 run diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 445ac66..538b9fe 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,18 +12,20 @@ jobs: fail-fast: false matrix: python: [ 3.6, 3.7, 3.8, 3.9 ] - sphinx: [ 1.*, 2.*, 3.*, 4.* ] + sphinx: [ ^1, ^2, ^3, ^4 ] steps: - - name: Update code - uses: actions/checkout@v2 - - name: Install dependencies (Sphinx ${{ matrix.sphinx }}) - env: - PYTHON_VERSION: ${{ matrix.python }} - SPHINX_VERSION: ${{ matrix.sphinx }} - run: | - ./run init - ./run deps - - name: Run tests - env: - PYTHON_VERSION: ${{ matrix.python }} - run: ./run tests + - uses: actions/checkout@v4 + - name: Set Up Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - name: Install Poetry + uses: snok/install-poetry@v1 + - name: Update build deps + run: poetry run python -m pip install --upgrade pip setuptools + - name: Install dependencies + run: poetry install + - name: Set sphinx version + run: poetry add sphinx@${{ matrix.sphinx }} + - name: Run Tests + run: poetry run pytest diff --git a/pyproject.toml b/pyproject.toml index 3bf31da..44becf1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ packages = [ python = "^3.6" sphinx = "*" requests = "^2.4.2" +pyyaml = "^6.0.1" [tool.poetry.group.dev.dependencies] black = "*" diff --git a/run b/run deleted file mode 100755 index 54c742d..0000000 --- a/run +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env sh -set -e - -url="https://raw.githubusercontent.com/webuni/shell-task-runner/master/runner" -[ -f ./.runner ] && [ .runner -nt "$0" ] || wget -q "$url" -O- > .runner || curl -fso .runner "$url" -. ./.runner - -_decorator()( _decorator_docker_compose_run "$@" ) - -# Install dependencies -task_deps()( _run pip install --ignore-installed --no-binary -e .[code,test,extra] "sphinx==${SPHINX_VERSION:-4.*}" 2>&1 ) - -# Update dependencies to the latest versions -task_deps__latest()( _run pip install --ignore-installed --upgrade -e .[code,test,extra] "sphinx==${SPHINX_VERSION:-4.*}" 2>&1 ) - -# Init virtual environment -# @service python -task_init()( python3 -m venv ./venv/ ) # --system-site-packages - -# Run pip -# @service python -task_pip()( pip3 "$@" ) - -# Publish package -# @service python -task_publish()( python setup.py sdist && twine check dist/* && twine upload dist/* ) # flit publish - -# Run flit -# @service python -task_flit()( flit "$@" ) - -# Run tests -# @service python -task_tests()( pytest "$@" ) - -# Fix code style -# @service python -task_cs()( black sphinxcontrib tests ) - -# Fix code style -# @service python -task_flake8()( flake8 sphinxcontrib tests ) - -# Analyse code -# @service python -task_analyse()( mypy sphinxcontrib ) - -# Remove all containers in project (use -v to remove volumes also) -task_clean()( _docker_compose down --remove-orphans "$@" ) - -# Run shell -# @service python -task_shell()( sh "$@" ) From 9fe7ab3baa8641f28b5c9ac6feb9a3a6e70dc082 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Tue, 7 Nov 2023 21:38:33 +0000 Subject: [PATCH 3/7] bump python versions --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 538b9fe..95f514a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python: [ 3.6, 3.7, 3.8, 3.9 ] + python: [ 3.8, 3.9, 3.10, 3.11, 3.12 ] sphinx: [ ^1, ^2, ^3, ^4 ] steps: - uses: actions/checkout@v4 From 4314b22f6112c6b6a7825ea1e0567fdcbe895231 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Tue, 7 Nov 2023 21:39:32 +0000 Subject: [PATCH 4/7] fixup --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 95f514a..430de94 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python: [ 3.8, 3.9, 3.10, 3.11, 3.12 ] + python: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] sphinx: [ ^1, ^2, ^3, ^4 ] steps: - uses: actions/checkout@v4 From 58848e6029abafd1f9daf512356f9e0f60462a02 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Tue, 7 Nov 2023 21:43:27 +0000 Subject: [PATCH 5/7] drop old sphinx versions --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 430de94..97b3c93 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: python: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] - sphinx: [ ^1, ^2, ^3, ^4 ] + sphinx: [ "^4", "^5", "^6", "^7" ] steps: - uses: actions/checkout@v4 - name: Set Up Python ${{ matrix.python }} From a177b619d0eaccfdf606bf4465870088fd0e0ade Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Tue, 7 Nov 2023 21:45:26 +0000 Subject: [PATCH 6/7] bump python versions --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 44becf1..f756ca2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ packages = [ ] [tool.poetry.dependencies] -python = "^3.6" +python = "^3.8" sphinx = "*" requests = "^2.4.2" pyyaml = "^6.0.1" From ed95c1cd007c287a6c9be062fa3324941861d1a9 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Tue, 7 Nov 2023 21:51:34 +0000 Subject: [PATCH 7/7] pin dependency versions --- pyproject.toml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f756ca2..6bcbcc9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,18 +17,19 @@ packages = [ ] [tool.poetry.dependencies] -python = "^3.8" -sphinx = "*" +python = "^3.8.1" +sphinx = "^6" requests = "^2.4.2" pyyaml = "^6.0.1" [tool.poetry.group.dev.dependencies] -black = "*" -flake8 = "*" -mypy = "*" -coverage = "*" -pytest = "*" -pytest-cov = "*" +black = "^23.10.1" +flake8 = "^6.1.0" +mypy = "^1.6.1" +coverage = "^7.3.2" +pytest = "^7.4.3" +pytest-cov = "^4.1.0" + [tool.pytest.ini_options] markers = [