Skip to content

Commit

Permalink
add hatch-vcs for versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
offbyone committed Aug 6, 2022
1 parent 648e52d commit 9c81a38
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 18 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ requirements.in
.direnv/
doc/_build/
htmlcov/
src/hamcrest/_version.py
.tool-versions
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
Expand Down Expand Up @@ -82,7 +82,10 @@ Source = "https://github.com/hamcrest/PyHamcrest/"
Issues = "https://github.com/hamcrest/PyHamcrest/issues"

[tool.hatch.version]
path = "src/hamcrest/__init__.py"
source = "vcs"

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

[tool.hatch.build.targets.sdist]
exclude = [
Expand Down
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
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 9c81a38

Please sign in to comment.