Skip to content

Commit

Permalink
Use hatch versioning, drop setuptools (#890)
Browse files Browse the repository at this point in the history
  • Loading branch information
rly committed Jul 10, 2023
1 parent 1c7895f commit bc45bba
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git_archival.txt export-subst
4 changes: 4 additions & 0 deletions .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
run: |
tox -e wheelinstall --recreate --installpkg dist/*-none-any.whl
- name: Test installation from a source distribution
run: |
tox -e wheelinstall --recreate --installpkg dist/*.tar.gz
- name: Upload wheel and source distributions to PyPI
run: |
python -m pip install twine
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/run_all_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ jobs:
run: |
tox -e wheelinstall --recreate --installpkg dist/*-none-any.whl
- name: Test installation from a source distribution
run: |
tox -e wheelinstall --recreate --installpkg dist/*.tar.gz
run-all-gallery-tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -185,6 +189,10 @@ jobs:
run: |
tox -e wheelinstall --recreate --installpkg dist/*-none-any.whl
- name: Test installation from a source distribution
run: |
tox -e wheelinstall --recreate --installpkg dist/*.tar.gz
run-gallery-ros3-tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ jobs:
run: |
tox -e wheelinstall --recreate --installpkg dist/*-none-any.whl
- name: Test installation from a source distribution
run: |
tox -e wheelinstall --recreate --installpkg dist/*.tar.gz
- name: Upload distribution as a workspace artifact
if: ${{ matrix.upload-wheels }}
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -165,6 +169,10 @@ jobs:
run: |
tox -e wheelinstall --recreate --installpkg dist/*-none-any.whl
- name: Test installation from a source distribution
run: |
tox -e wheelinstall --recreate --installpkg dist/*.tar.gz
deploy-dev:
name: Deploy pre-release from dev
needs: [run-tests, run-gallery-tests, run-tests-on-conda]
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ coverage.xml

#sqlite
.sqlite

# Version
_version.py
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
- Allow for `datetime.date` to be used instead of `datetime.datetime`. @bendichter [#874](https://github.com/hdmf-dev/hdmf/pull/874)
- Updated `HDMFIO` and `HDF5IO` to support `ExternalResources`. @mavaylon1 [#895](https://github.com/hdmf-dev/hdmf/pull/895)
- Dropped Python 3.7 support. @rly [#897](https://github.com/hdmf-dev/hdmf/pull/897)
- Added HTML repr to `Container` objects which displays an interactive tree of a container's values and children in a Jupyter notebook and other HTML representations. @edeno [#883](https://github.com/hdmf-dev/hdmf/pull/883)

### Documentation and tutorial enhancements:
- Added tutorial for the new `TermSet` class @mavaylon1 [#880](https://github.com/hdmf-dev/hdmf/pull/880)

## Bug fixes
- Fixed CI testing of minimum installation requirements, and removed some gallery tests run on each PR. @rly
[#877](https://github.com/hdmf-dev/hdmf/pull/877)
- Fixed reporting of version when installed using conda. @rly [#890](https://github.com/hdmf-dev/hdmf/pull/890)


## HMDF 3.6.1 (May 18, 2023)

Expand Down
21 changes: 15 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "hdmf"
Expand Down Expand Up @@ -51,8 +51,19 @@ linkml = ["linkml-runtime>=1.5.0"]
[project.scripts]
validate_hdmf_spec = "hdmf.testing.validate_spec:main"

[tool.setuptools.package-data]
hdmf = ["common/hdmf-common-schema/common/*.yaml", "common/hdmf-common-schema/common/*.json"]
[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
# this file is created/updated when the package is installed and used in
# src/hdmf/__init__.py to set `hdmf.__version__`
version-file = "src/hdmf/_version.py"

[tool.hatch.build.targets.sdist]
exclude = [".git_archival.txt"]

[tool.hatch.build.targets.wheel]
packages = ["src/hdmf"]

# [tool.mypy]
# no_incremental = true # needed b/c mypy and ruamel.yaml do not play nice. https://github.com/python/mypy/issues/12664
Expand Down Expand Up @@ -83,8 +94,6 @@ exclude_lines = [
"@abstract"
]

[tool.setuptools_scm]

# [tool.black]
# line-length = 120
# preview = true
Expand Down
3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

9 changes: 5 additions & 4 deletions src/hdmf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ def get_region_slicer(**kwargs):
return None


from importlib.metadata import version # noqa: E402

__version__ = version(__package__)
del version
try:
# see https://effigies.gitlab.io/posts/python-packaging-2023/
from ._version import __version__
except ImportError: # pragma: no cover
pass


from ._due import BibTeX, due # noqa: E402
Expand Down

0 comments on commit bc45bba

Please sign in to comment.