From b1d7c05dccd44e4a058bdf519726ca70b3956963 Mon Sep 17 00:00:00 2001 From: Chris Withers Date: Tue, 15 Apr 2025 07:35:36 +0100 Subject: [PATCH 1/6] CI for release --- .github/workflows/ci.yml | 26 ++++++++++++++++++++ .github/workflows/release.yml | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95ffc74..10c9fa0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,3 +143,29 @@ jobs: runs-on: ubuntu-latest steps: - uses: cjw296/python-action/check-formatting@v1 + + build-and-inspect-package: + needs: + - tests + - coverage + - typing + - formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: hynek/build-and-inspect-python-package@v2 + + check-package: + needs: + - build-and-inspect-package + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.9" + - "3.13" + steps: + - uses: cjw296/python-action/check-distributions@v1 + with: + package: pytest_sqlalchemy + python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b42ebba --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: "Release" + +on: + workflow_run: + workflows: [Continuous Integration] + types: [completed] + branches: [main] + +jobs: + check: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + outputs: + tag: ${{ steps.carthorse.outputs.tag }} + steps: + - uses: cjw296/python-action/carthorse@main + id: carthorse + with: + check: "true" + tag-format: '{version}' + + release: + runs-on: ubuntu-latest + needs: check + if: ${{ needs.check.outputs.tag != '' }} + permissions: + contents: write + id-token: write + steps: + - name: Show tag + run: echo "${{ toJson(needs.check.carthorse.outputs) }}" + shell: bash + + - name: Download packages from CI run + uses: dawidd6/action-download-artifact@v9 + with: + run_id: ${{ github.event.workflow_run.id }} + name: Packages + path: dist + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + - uses: cjw296/python-action/carthorse@main + with: + tag-format: '{version}' From 821820e8c755c79da722bbac5680f1ef4f06ba21 Mon Sep 17 00:00:00 2001 From: Chris Withers Date: Tue, 15 Apr 2025 07:39:59 +0100 Subject: [PATCH 2/6] Fix ReST in README --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 5450c9c..03792bd 100644 --- a/README.rst +++ b/README.rst @@ -75,7 +75,7 @@ Or override the ``sqlalchemy_connect_url`` fixture on your ``conftest.py`` file: return 'postgresql://scott:tiger@localhost:5432/mydatabase' Development ----------- +----------- To get going, in a checkout: From f3f3b0255a922dd4a7a4d072ee2144fef2cc30af Mon Sep 17 00:00:00 2001 From: Chris Withers Date: Tue, 15 Apr 2025 08:06:29 +0100 Subject: [PATCH 3/6] Fix ordering of tool config in pyproject.toml --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d24c485..3989573 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,11 +55,11 @@ disallow_incomplete_defs = true module = "sqlalchemy_utils.*" ignore_missing_imports = true +[tool.pytest.ini_options] +norecursedirs = ["tests/examples"] + [tool.ruff] line-length = 100 [tool.ruff.format] quote-style = "preserve" - -[tool.pytest.ini_options] -norecursedirs = ["tests/examples"] From 4fc8c3894f5e38c385f8aae2df464088dd0bfd4e Mon Sep 17 00:00:00 2001 From: Chris Withers Date: Tue, 15 Apr 2025 08:35:20 +0100 Subject: [PATCH 4/6] Restructure to include py.typed end exclude junk from sdist --- .github/workflows/ci.yml | 2 +- pyproject.toml | 8 ++++++-- pytest_sqlalchemy.py => src/pytest_sqlalchemy/__init__.py | 0 src/pytest_sqlalchemy/py.typed | 0 4 files changed, 7 insertions(+), 3 deletions(-) rename pytest_sqlalchemy.py => src/pytest_sqlalchemy/__init__.py (100%) create mode 100644 src/pytest_sqlalchemy/py.typed diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10c9fa0..c6baba6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,7 +137,7 @@ jobs: run: uv sync --dev - name: Run tests - run: uv run mypy pytest_sqlalchemy.py tests + run: uv run mypy src tests formatting: runs-on: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index 3989573..aab27ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,13 +40,17 @@ docs = [ ] [build-system] -requires = ["setuptools>=61.0"] -build-backend = "setuptools.build_meta" +requires = ["hatchling"] +build-backend = "hatchling.build" [tool.coverage.run] source = ["pytest_sqlalchemy", "tests"] parallel = true +[tool.hatch.build.targets.sdist] +# paranoidly only include the package in the sdist: https://github.com/pypa/hatch/issues/304 +packages = ["src/pytest_sqlalchemy"] + [tool.mypy] disallow_untyped_defs = true disallow_incomplete_defs = true diff --git a/pytest_sqlalchemy.py b/src/pytest_sqlalchemy/__init__.py similarity index 100% rename from pytest_sqlalchemy.py rename to src/pytest_sqlalchemy/__init__.py diff --git a/src/pytest_sqlalchemy/py.typed b/src/pytest_sqlalchemy/py.typed new file mode 100644 index 0000000..e69de29 From 550fbfa29888c31d6330d2200e01be527e9bb100 Mon Sep 17 00:00:00 2001 From: Chris Withers Date: Wed, 16 Apr 2025 08:19:01 +0100 Subject: [PATCH 5/6] Tidy up CHANGELOG --- CHANGELOG.rst | 21 +++++++++++++++++++++ HISTORY.rst | 11 ----------- docs/conf.py | 1 + docs/index.rst | 2 ++ 4 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 CHANGELOG.rst delete mode 100644 HISTORY.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 0000000..66c1bea --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,21 @@ +Changes +------- + +0.2.1 (13.03.2018) +~~~~~~~~~~~~~~~~~~ + +* Fix behaviour under multiprocessing by recreating :class:`~sqlalchemy.engine.Engine` instance. + +0.2.0 (22.02.2018) +~~~~~~~~~~~~~~~~~~ +Feature release. Thanks to Sebastian Buczyński. + +* Added option to create the database on each run by using ``sqlalchemy-utils``. + +* Added option to run tests on multiple dynamically created databases + (``pytest-xdist``) like ``pytest-django`` does. + +0.1.1 (22.09.2017) +~~~~~~~~~~~~~~~~~~ + +Initial release. diff --git a/HISTORY.rst b/HISTORY.rst deleted file mode 100644 index 6c34a62..0000000 --- a/HISTORY.rst +++ /dev/null @@ -1,11 +0,0 @@ -0.2.0 (22.02.2018) -================== -Feature release. Thanks to Sebastian Buczyński. - -* Added option to create the database on each run by using sqlalchemy-utils. - -* Added option to run tests on multiple dynamically run databases - (pytest-xdist) like pytest-django does. - -0.1.1 -===== diff --git a/docs/conf.py b/docs/conf.py index b5cba32..5ace6d5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -7,6 +7,7 @@ intersphinx_mapping = { 'python': ('http://docs.python.org', None), + 'sqlalchemy': ('https://docs.sqlalchemy.org/en/20', None), } project = 'pytest-sqlalchemy' diff --git a/docs/index.rst b/docs/index.rst index 72a3355..9f0a7f0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1 +1,3 @@ .. include:: ../README.rst + +.. include:: ../CHANGELOG.rst From cbd0908ba384d85791b4e4de90722fcff8ce3df5 Mon Sep 17 00:00:00 2001 From: Chris Withers Date: Wed, 16 Apr 2025 08:43:56 +0100 Subject: [PATCH 6/6] Correct latest version in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index aab27ad..79ceee9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pytest-sqlalchemy" -version = "0.2.0" +version = "0.2.1" description = "pytest plugin with sqlalchemy related fixtures" authors = [ { name = "Torsten Irländer", email = "torsten.irlaender@googlemail.com" }