Skip to content

Commit

Permalink
Merge pull request #210 from offbyone/hatch
Browse files Browse the repository at this point in the history
Switch from setuptools to hatch
  • Loading branch information
offbyone authored Aug 6, 2022
2 parents c2177fe + 9c81a38 commit 046e225
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 130 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- "3.11.0-beta.4"
- "pypy2"
- "pypy-3.7"
- "3.11.0-beta.5"
- "pypy3.9"
exclude:
- os: macos-latest
python-version: pypy3

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
- uses: "actions/checkout@v3"
with:
# We want our tags here
fetch-depth: 0
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
Expand All @@ -63,8 +65,8 @@ jobs:
- tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"

Expand Down Expand Up @@ -98,8 +100,11 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
- uses: "actions/checkout@v3"
with:
# We want our tags here
fetch-depth: 0
- uses: "actions/setup-python@v4"
with:
python-version: "3.10"

Expand All @@ -109,6 +114,7 @@ jobs:
if: "${{ env.TEST_PYPI_API_TOKEN != '' }}"
run: |
echo "DO_PUBLISH=yes" >> $GITHUB_ENV
echo "SETUPTOOLS_SCM_PRETEND_VERSION=0.0.1" >> $GITHUB_ENV
- name: "Install pep517 and twine"
run: "python -m pip install pep517 twine"
Expand Down Expand Up @@ -136,10 +142,10 @@ jobs:
runs-on: "${{ matrix.os }}"

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: "3.9"
python-version: "3.10"
- name: "Install in dev mode"
run: "python -m pip install -e .[dev]"
- name: "Import package"
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,12 @@ dist/
*~
.python-version
.mypy_cache/
.pytest_cache/
requirements.txt
requirements.in
.envrc
.direnv/
doc/_build/
htmlcov/
src/hamcrest/_version.py
.tool-versions
102 changes: 100 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,105 @@
[build-system]
requires = ["setuptools>=40.6.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "PyHamcrest"
description = "Hamcrest framework for matcher objects"
readme = "README.rst"
requires-python = ">= 3.6"
license = { file = "LICENSE.txt" }
keywords = [
"hamcrest",
"matchers",
"pyunit",
"unit",
"test",
"testing",
"unittest",
"unittesting",
]
authors = [
{ name = "Chris Rose", email="[email protected]" },
{ name = "Simon Brunning" },
{ name = "Jon Reid" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: Jython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
]
dynamic = ["version"]

[project.optional-dependencies]
docs = ["sphinx~=4.0", "alabaster~=0.7"]
tests = [
"pytest>=5.0",
"pytest-sugar",
"pytest-xdist",
"coverage[toml]",
# No point on Pypy thanks to https://github.com/python/typed_ast/issues/111
"pytest-mypy-plugins; platform_python_implementation != 'PyPy'",
# Can't use 0.940: https://github.com/python/mypy/issues/12339
"mypy!=0.940; platform_python_implementation != 'PyPy'",
"types-mock",
"dataclasses; python_version<'3.7'",
"types-dataclasses; python_version<'3.7'",
]
tests-numpy = [
"PyHamcrest[tests]",
"numpy",
]
dev = [
"PyHamcrest[docs,tests]",
"towncrier",
"twine",
"pytest-mypy",
"flake8",
"black",
"tox",
"tox-asdf",
]

[project.urls]
History = "https://github.com/hamcrest/PyHamcrest/blob/main/CHANGELOG.rst"
Source = "https://github.com/hamcrest/PyHamcrest/"
Issues = "https://github.com/hamcrest/PyHamcrest/issues"

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/hamcrest/_version.py"

[tool.hatch.build.targets.sdist]
exclude = [
"/changelog.d/*.rst",
"/release.sh",
"/.github",
]
[tool.hatch.build.targets.wheel]
exclude = [
"/examples",
]
packages = [
"src/hamcrest",
]

[tool.coverage.run]
parallel = true
Expand Down
111 changes: 0 additions & 111 deletions setup.py

This file was deleted.

3 changes: 2 additions & 1 deletion src/hamcrest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from hamcrest.core import *
from hamcrest.library import *
from hamcrest import core, library
from hamcrest._version import version

__version__ = "2.0.4"
__version__ = version
__author__ = "Chris Rose"
__copyright__ = "Copyright 2020 hamcrest.org"
__license__ = "BSD, see License.txt"
Expand Down
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ commands = coverage run -m pytest {posargs}
[testenv:py311]
# Python 3.6+ has a number of compile-time warnings on invalid string escapes.
# PYTHONWARNINGS=d and --no-compile below make them visible during the Tox run.
basepython = python3.10
basepython = python3.11
install_command = pip install --no-compile {opts} {packages}
setenv =
PYTHONWARNINGS=d
Expand All @@ -115,7 +115,6 @@ commands =
coverage combine
coverage report


[testenv:lint]
basepython = python3.9
skip_install = true
Expand All @@ -136,9 +135,11 @@ commands =

[testenv:manifest]
basepython = python3.9
deps = check-manifest
deps =
check-manifest
setuptools-scm
skip_install = true
commands = check-manifest
commands = check-manifest --ignore src/hamcrest/_version.py


[testenv:pypi-description]
Expand Down

0 comments on commit 046e225

Please sign in to comment.