Skip to content

Commit 046e225

Browse files
authored
Merge pull request hamcrest#210 from offbyone/hatch
Switch from setuptools to hatch
2 parents c2177fe + 9c81a38 commit 046e225

File tree

6 files changed

+132
-130
lines changed

6 files changed

+132
-130
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ jobs:
2929
- "3.8"
3030
- "3.9"
3131
- "3.10"
32-
- "3.11.0-beta.4"
33-
- "pypy2"
34-
- "pypy-3.7"
32+
- "3.11.0-beta.5"
33+
- "pypy3.9"
3534
exclude:
3635
- os: macos-latest
3736
python-version: pypy3
3837

3938
steps:
40-
- uses: "actions/checkout@v2"
41-
- uses: "actions/setup-python@v2"
39+
- uses: "actions/checkout@v3"
40+
with:
41+
# We want our tags here
42+
fetch-depth: 0
43+
- uses: "actions/setup-python@v4"
4244
with:
4345
python-version: "${{ matrix.python-version }}"
4446
- name: "Install dependencies"
@@ -63,8 +65,8 @@ jobs:
6365
- tests
6466
runs-on: ubuntu-latest
6567
steps:
66-
- uses: actions/checkout@v2
67-
- uses: actions/setup-python@v2
68+
- uses: actions/checkout@v3
69+
- uses: actions/setup-python@v4
6870
with:
6971
python-version: "3.10"
7072

@@ -98,8 +100,11 @@ jobs:
98100
runs-on: "ubuntu-latest"
99101

100102
steps:
101-
- uses: "actions/checkout@v2"
102-
- uses: "actions/setup-python@v1"
103+
- uses: "actions/checkout@v3"
104+
with:
105+
# We want our tags here
106+
fetch-depth: 0
107+
- uses: "actions/setup-python@v4"
103108
with:
104109
python-version: "3.10"
105110

@@ -109,6 +114,7 @@ jobs:
109114
if: "${{ env.TEST_PYPI_API_TOKEN != '' }}"
110115
run: |
111116
echo "DO_PUBLISH=yes" >> $GITHUB_ENV
117+
echo "SETUPTOOLS_SCM_PRETEND_VERSION=0.0.1" >> $GITHUB_ENV
112118
113119
- name: "Install pep517 and twine"
114120
run: "python -m pip install pep517 twine"
@@ -136,10 +142,10 @@ jobs:
136142
runs-on: "${{ matrix.os }}"
137143

138144
steps:
139-
- uses: "actions/checkout@v2"
140-
- uses: "actions/setup-python@v2"
145+
- uses: "actions/checkout@v3"
146+
- uses: "actions/setup-python@v4"
141147
with:
142-
python-version: "3.9"
148+
python-version: "3.10"
143149
- name: "Install in dev mode"
144150
run: "python -m pip install -e .[dev]"
145151
- name: "Import package"

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,12 @@ dist/
99
*~
1010
.python-version
1111
.mypy_cache/
12+
.pytest_cache/
1213
requirements.txt
1314
requirements.in
15+
.envrc
16+
.direnv/
17+
doc/_build/
18+
htmlcov/
19+
src/hamcrest/_version.py
20+
.tool-versions

pyproject.toml

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,105 @@
11
[build-system]
2-
requires = ["setuptools>=40.6.0", "wheel"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["hatchling", "hatch-vcs"]
3+
build-backend = "hatchling.build"
44

5+
[project]
6+
name = "PyHamcrest"
7+
description = "Hamcrest framework for matcher objects"
8+
readme = "README.rst"
9+
requires-python = ">= 3.6"
10+
license = { file = "LICENSE.txt" }
11+
keywords = [
12+
"hamcrest",
13+
"matchers",
14+
"pyunit",
15+
"unit",
16+
"test",
17+
"testing",
18+
"unittest",
19+
"unittesting",
20+
]
21+
authors = [
22+
{ name = "Chris Rose", email="[email protected]" },
23+
{ name = "Simon Brunning" },
24+
{ name = "Jon Reid" },
25+
]
26+
classifiers = [
27+
"Development Status :: 5 - Production/Stable",
28+
"Environment :: Console",
29+
"Intended Audience :: Developers",
30+
"License :: OSI Approved :: BSD License",
31+
"Natural Language :: English",
32+
"Operating System :: OS Independent",
33+
"Programming Language :: Python :: 3",
34+
"Programming Language :: Python :: 3.6",
35+
"Programming Language :: Python :: 3.7",
36+
"Programming Language :: Python :: 3.8",
37+
"Programming Language :: Python :: 3.9",
38+
"Programming Language :: Python :: 3.10",
39+
"Programming Language :: Python :: 3.11",
40+
"Programming Language :: Python :: Implementation :: CPython",
41+
"Programming Language :: Python :: Implementation :: Jython",
42+
"Programming Language :: Python :: Implementation :: PyPy",
43+
"Topic :: Software Development",
44+
"Topic :: Software Development :: Quality Assurance",
45+
"Topic :: Software Development :: Testing",
46+
]
47+
dynamic = ["version"]
48+
49+
[project.optional-dependencies]
50+
docs = ["sphinx~=4.0", "alabaster~=0.7"]
51+
tests = [
52+
"pytest>=5.0",
53+
"pytest-sugar",
54+
"pytest-xdist",
55+
"coverage[toml]",
56+
# No point on Pypy thanks to https://github.com/python/typed_ast/issues/111
57+
"pytest-mypy-plugins; platform_python_implementation != 'PyPy'",
58+
# Can't use 0.940: https://github.com/python/mypy/issues/12339
59+
"mypy!=0.940; platform_python_implementation != 'PyPy'",
60+
"types-mock",
61+
"dataclasses; python_version<'3.7'",
62+
"types-dataclasses; python_version<'3.7'",
63+
]
64+
tests-numpy = [
65+
"PyHamcrest[tests]",
66+
"numpy",
67+
]
68+
dev = [
69+
"PyHamcrest[docs,tests]",
70+
"towncrier",
71+
"twine",
72+
"pytest-mypy",
73+
"flake8",
74+
"black",
75+
"tox",
76+
"tox-asdf",
77+
]
78+
79+
[project.urls]
80+
History = "https://github.com/hamcrest/PyHamcrest/blob/main/CHANGELOG.rst"
81+
Source = "https://github.com/hamcrest/PyHamcrest/"
82+
Issues = "https://github.com/hamcrest/PyHamcrest/issues"
83+
84+
[tool.hatch.version]
85+
source = "vcs"
86+
87+
[tool.hatch.build.hooks.vcs]
88+
version-file = "src/hamcrest/_version.py"
89+
90+
[tool.hatch.build.targets.sdist]
91+
exclude = [
92+
"/changelog.d/*.rst",
93+
"/release.sh",
94+
"/.github",
95+
]
96+
[tool.hatch.build.targets.wheel]
97+
exclude = [
98+
"/examples",
99+
]
100+
packages = [
101+
"src/hamcrest",
102+
]
5103

6104
[tool.coverage.run]
7105
parallel = true

setup.py

Lines changed: 0 additions & 111 deletions
This file was deleted.

src/hamcrest/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from hamcrest.core import *
22
from hamcrest.library import *
33
from hamcrest import core, library
4+
from hamcrest._version import version
45

5-
__version__ = "2.0.4"
6+
__version__ = version
67
__author__ = "Chris Rose"
78
__copyright__ = "Copyright 2020 hamcrest.org"
89
__license__ = "BSD, see License.txt"

tox.ini

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ commands = coverage run -m pytest {posargs}
100100
[testenv:py311]
101101
# Python 3.6+ has a number of compile-time warnings on invalid string escapes.
102102
# PYTHONWARNINGS=d and --no-compile below make them visible during the Tox run.
103-
basepython = python3.10
103+
basepython = python3.11
104104
install_command = pip install --no-compile {opts} {packages}
105105
setenv =
106106
PYTHONWARNINGS=d
@@ -115,7 +115,6 @@ commands =
115115
coverage combine
116116
coverage report
117117

118-
119118
[testenv:lint]
120119
basepython = python3.9
121120
skip_install = true
@@ -136,9 +135,11 @@ commands =
136135

137136
[testenv:manifest]
138137
basepython = python3.9
139-
deps = check-manifest
138+
deps =
139+
check-manifest
140+
setuptools-scm
140141
skip_install = true
141-
commands = check-manifest
142+
commands = check-manifest --ignore src/hamcrest/_version.py
142143

143144

144145
[testenv:pypi-description]

0 commit comments

Comments
 (0)