Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to hatch #889

Merged
merged 8 commits into from
Apr 30, 2024
Merged

Migrate to hatch #889

merged 8 commits into from
Apr 30, 2024

Conversation

jacobtomlinson
Copy link
Member

Upgrading project to a modern build system.

  • Use hatch for building
  • Use hatch new --init to migrate setup.py, setup.cfg and requirements.txt to pyproject.toml
  • Replace versioneer with hatch-vcs
  • Use hatch build in CI release process
  • Added workflow to PyPI trusted publish management and remove secret

Comment on lines +19 to +24
try:
from ._version import version as __version__ # noqa
from ._version import version_tuple as __version_tuple__ # noqa
except ImportError:
__version__ = "0.0.0"
__version_tuple__ = (0, 0, 0)
Copy link
Member Author

@jacobtomlinson jacobtomlinson Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _version.py file is no longer kept in version control and instead is generated when running pip install -e . or by hatch build when packaging the distribution for PyPI/Conda Forge. So it's possible to clone the repo and never install it, so we catch the ImportError and use a null version so imports at least work.

@@ -1,2 +1,2 @@
.*
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was stopping the .git directory from being copied in which is needed to correctly resolve the version number. To avoid this blowing up the container size I've switched the Dockerfile to do a multi-stage build where we build the distributions and then only copy those over to the final container image.

@jacobtomlinson jacobtomlinson merged commit ef41984 into dask:main Apr 30, 2024
25 checks passed
@jacobtomlinson jacobtomlinson deleted the hatch-pyprojct branch April 30, 2024 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant