Skip to content

Commit

Permalink
Use Hatch instead of Tox
Browse files Browse the repository at this point in the history
- Removes the old setup.[py,cfg] in favour of a modern pyproject.toml
- Remove Tox in favour of Hatch
  • Loading branch information
juledwar committed Jul 22, 2024
1 parent 986181a commit 07948c7
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 114 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.8, 3.9, 3.10, 3.11, 3.12]

steps:
- uses: actions/checkout@v3
Expand All @@ -22,9 +22,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
pip install hatch
- name: Run Tox
- name: Run tests
run: |
tox
hatch run ci
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.tox/
.hatch/
db_testtools.egg-info/
__pycache__/
*.pyc
dbtesttools/_version.py
dist/
19 changes: 12 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
{
"python.pythonPath": "${workspaceFolder}/.tox/py3/bin/python3",
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
},
"black-formatter.args": [
"--line-length",
"79"
],
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.testing.pytestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.unittestEnabled": true,
"files.watcherExclude": {
"**/.coverage/**": true,
"**/.eggs": true,
"**/.stestr/**": true,
"**/.testrepository/**": true,
"**/.tox/**": true
"${workspaceFolder}/build/**": true,
"**/.hatch/**": true
},
"git.allowForcePush": true,
"editor.wordWrapColumn": 79,
"vim.textwidth": 79,
"githubPullRequests.defaultMergeMethod": "rebase"
}

6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGES
=======

2024.07.21
----------
* Use Hatch to test and build the project
* Replace Black with Ruff for formatting and checking
* Allow overriding of the PG server IP address

2023.01.27
----------

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ after each test completes.
Requirements
------------

Python 3.7 and beyond should work.
Python 3.8 and beyond should work.

Quickstart
----------
Expand Down Expand Up @@ -101,5 +101,5 @@ stable.
Copyright
---------

db-testtools is copyright (c) 2021-2023 Cisco Systems, Inc. and its affiliates
db-testtools is copyright (c) 2021-2024 Cisco Systems, Inc. and its affiliates
All rights reserved.
17 changes: 7 additions & 10 deletions RELEASING.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ To release a new version of db-testtools:
1. Tag the current revision with the required release number, e.g.
`git tag 2021.09.29`
2. Build the package:
`tox -e build-python-package`
3. This will generate a new ChangeLog file. It needs to be committed as
a new revision.
4. After committing, move the tag: `git tag -f 2021.09.29`
5. Build the package again because PBR.
6. Upload the package to testpyi first to make sure it is ok:
`tox -e testpypi dist/*2021.9.29*`
7. If that looks ok, upload to the real pypi:
`tox -e pypi dist/*2021.9.29*`
8. Push the new tag to Github:
`hatch build`
3. Upload the package to testpyi first to make sure it is ok:
`hatch run testpypi dist/*2021.9.29*`
4. If that looks ok, upload to the real pypi:
`hatch run pypi dist/*2021.9.29*`
5. Push the new tag to Github:
`git push origin 2021.09.29`
6. Make a Github release
80 changes: 80 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,83 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "db-testtools"
dynamic = ["version"]
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.8"
authors = [
{ name = "Julian Edwards", email = "[email protected]" },
]
maintainers = [
{ name = "Julian Edwards", email = "[email protected]" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Framework :: Hatch",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Utilities",
]
urls.Source = "https://github.com/juledwar/db-testtools"

dependencies = [
"docker>=5.0.2",
"fixtures>=3.0.0",
"psycopg2-binary>=2.9.1",
"retry>=0.9.2",
"sqlalchemy>=1.4.23",
"testresources>=2.0.1",
]
[project.optional-dependencies]
test = [
"build>=0.7.0",
"coverage[toml]>=6.0.2",
"ipython>=7.28.0",
"pdbpp>=0.10.3",
"ruff>=0.5.3",
"stestr>=3.2.1",
"testscenarios>=0.5.0",
"testtools>=2.5.0",
"twine>=3.4.2",

]

[tool.hatch.version]
source = "vcs"
[tool.hatch.build.hooks.vcs]
version-file = "dbtesttools/_version.py"
[tool.hatch.build.targets.sdist]
include = ["/dbtesttools"]
exclude = ["tests"]

[tool.hatch.envs.default]
path = ".hatch"
features = ["test"]

scripts.formatcheck = [
"ruff format --check dbtesttools",
"ruff check --select I --show-fixes dbtesttools"
]
scripts.format = [
"ruff check --select I --fix-only --show-fixes dbtesttools",
"ruff format dbtesttools",
]
scripts.ci = ["formatcheck"]
scripts.testpypi = ["twine upload --repository testpypi {args}"]
scripts.pypi = ["twine upload --repository pypi {args}"]

[tool.coverage.run]
omit = [
'*dbtesttools/tests*',
Expand Down
6 changes: 0 additions & 6 deletions requirements.txt

This file was deleted.

33 changes: 0 additions & 33 deletions setup.cfg

This file was deleted.

11 changes: 0 additions & 11 deletions setup.py

This file was deleted.

9 changes: 0 additions & 9 deletions test-requirements.txt

This file was deleted.

31 changes: 0 additions & 31 deletions tox.ini

This file was deleted.

0 comments on commit 07948c7

Please sign in to comment.