diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 000000000..8fb235d70 --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1,4 @@ +node: $Format:%H$ +node-date: $Format:%cI$ +describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ +ref-names: $Format:%D$ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..a94cb2f8c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.git_archival.txt export-subst diff --git a/.github/workflows/deploy_release.yml b/.github/workflows/deploy_release.yml index 04a59d673..ef9490f0e 100644 --- a/.github/workflows/deploy_release.yml +++ b/.github/workflows/deploy_release.yml @@ -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 diff --git a/.github/workflows/run_all_tests.yml b/.github/workflows/run_all_tests.yml index 4ec03e45d..59d095c62 100644 --- a/.github/workflows/run_all_tests.yml +++ b/.github/workflows/run_all_tests.yml @@ -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 }} @@ -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 }} diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index e340f4ed1..8c7c437c3 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -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 @@ -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] diff --git a/.gitignore b/.gitignore index 0068da783..8257bc927 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,6 @@ coverage.xml #sqlite .sqlite + +# Version +_version.py diff --git a/CHANGELOG.md b/CHANGELOG.md index fbb687ce9..1e6fb3650 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - 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) @@ -17,6 +18,8 @@ ## 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) diff --git a/pyproject.toml b/pyproject.toml index 1c9d0fef2..672778849 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" @@ -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 @@ -83,8 +94,6 @@ exclude_lines = [ "@abstract" ] -[tool.setuptools_scm] - # [tool.black] # line-length = 120 # preview = true diff --git a/setup.py b/setup.py deleted file mode 100755 index 606849326..000000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() diff --git a/src/hdmf/__init__.py b/src/hdmf/__init__.py index d4aad2666..c29e21dd8 100644 --- a/src/hdmf/__init__.py +++ b/src/hdmf/__init__.py @@ -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