diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..3ee7351 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,7 @@ +# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax + +# These owners will be the default owners for everything in +# the repo. Unless a later match takes precedence, + +* @nocollier +* @mgrover1 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..4f2bb24 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,35 @@ +name: Publish intake-esgf to PyPI + +on: + release: + types: + - published + +jobs: + deploy: + if: github.repository == 'esgf2-us/intake-esgf' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install setuptools setuptools-scm wheel twine check-manifest + - name: Build tarball and wheels + run: | + git clean -xdf + git restore -SW . + python -m build --sdist --wheel . + - name: Test the artifacts + run: | + python -m twine check dist/* + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@v1.8.11 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + verbose: true diff --git a/intake_esgf/__init__.py b/intake_esgf/__init__.py index 4921ce3..8820833 100644 --- a/intake_esgf/__init__.py +++ b/intake_esgf/__init__.py @@ -3,6 +3,7 @@ import warnings import xarray as xr +from pkg_resources import DistributionNotFound, get_distribution warnings.simplefilter("ignore", category=xr.SerializationWarning) @@ -26,3 +27,8 @@ def in_notebook() -> bool: from intake_esgf.catalog import ESGFCatalog # noqa __all__ = ["ESGFCatalog", "IN_NOTEBOOK"] + +try: + __version__ = get_distribution(__name__).version +except DistributionNotFound: # pragma: no cover + __version__ = "0.0.0" # pragma: no cover diff --git a/pyproject.toml b/pyproject.toml index 7c4095e..f0546a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,12 @@ # https://snarky.ca/what-the-heck-is-pyproject-toml/ [build-system] -requires = ["setuptools"] +requires = ["setuptools", "setuptools_scm", "wheel"] build-backend = "setuptools.build_meta" +[tool.setuptools_scm] +version_scheme = "no-guess-dev" + [tool.coverage.run] omit = ["*/intake_esgf/tests/*"]