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
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.*
Dockerfile
dist/
12 changes: 5 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ jobs:

steps:
- name: Checkout source
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: "3.10"

- name: Install pypa/build and chartpress
run: python -m pip install build wheel chartpress pyyaml
run: python -m pip install hatch build wheel chartpress pyyaml

# chartpress pushes a packages Helm chart to dask/helm-chart's gh-pages
# branch, so we need to have a git user.email and user.name configured
Expand All @@ -27,14 +27,11 @@ jobs:

- name: Build distributions
shell: bash -l {0}
run: python setup.py sdist bdist_wheel
run: hatch build

- name: Publish package to PyPI
if: github.repository == 'dask/dask-kubernetes' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
uses: pypa/gh-action-pypi-publish@release/v1

- name: Get the version
id: get_version
Expand Down Expand Up @@ -63,6 +60,7 @@ jobs:
GITHUB_TOKEN: "${{ secrets.dask_bot_token }}"
PUBLISH: ${{ github.repository == 'dask/dask-kubernetes' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
run: |
pip install .
cd dask_kubernetes/operator/deployment/helm

if ${PUBLISH} == true; then
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,7 @@ credentials.csv

# IDEs
.idea/
.vscode/
.vscode/

# Version
_version.py
10 changes: 8 additions & 2 deletions dask_kubernetes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from warnings import warn

from . import config
from . import _version

from .common.auth import (
AutoRefreshConfiguration,
AutoRefreshKubeConfigLoader,
Expand All @@ -15,7 +15,13 @@
from .helm import HelmCluster

__all__ = ["HelmCluster", "KubeCluster"]
__version__ = _version.get_versions()["version"]

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)
Comment on lines +19 to +24
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.



def __getattr__(name):
Expand Down
Loading
Loading