Skip to content

Commit d8ccbb3

Browse files
authored
ADD: Add versioning files (#17)
1 parent cdb8af6 commit d8ccbb3

4 files changed

Lines changed: 52 additions & 1 deletion

File tree

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
2+
3+
# These owners will be the default owners for everything in
4+
# the repo. Unless a later match takes precedence,
5+
6+
* @nocollier
7+
* @mgrover1

.github/workflows/pypi.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish intake-esgf to PyPI
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
deploy:
10+
if: github.repository == 'esgf2-us/intake-esgf'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.x"
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
python -m pip install setuptools setuptools-scm wheel twine check-manifest
22+
- name: Build tarball and wheels
23+
run: |
24+
git clean -xdf
25+
git restore -SW .
26+
python -m build --sdist --wheel .
27+
- name: Test the artifacts
28+
run: |
29+
python -m twine check dist/*
30+
- name: Publish package to PyPI
31+
uses: pypa/gh-action-pypi-publish@v1.8.11
32+
with:
33+
user: __token__
34+
password: ${{ secrets.PYPI_TOKEN }}
35+
verbose: true

intake_esgf/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import warnings
44

55
import xarray as xr
6+
from pkg_resources import DistributionNotFound, get_distribution
67

78
warnings.simplefilter("ignore", category=xr.SerializationWarning)
89

@@ -26,3 +27,8 @@ def in_notebook() -> bool:
2627
from intake_esgf.catalog import ESGFCatalog # noqa
2728

2829
__all__ = ["ESGFCatalog", "IN_NOTEBOOK"]
30+
31+
try:
32+
__version__ = get_distribution(__name__).version
33+
except DistributionNotFound: # pragma: no cover
34+
__version__ = "0.0.0" # pragma: no cover

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# https://snarky.ca/what-the-heck-is-pyproject-toml/
22

33
[build-system]
4-
requires = ["setuptools"]
4+
requires = ["setuptools", "setuptools_scm", "wheel"]
55
build-backend = "setuptools.build_meta"
66

7+
[tool.setuptools_scm]
8+
version_scheme = "no-guess-dev"
9+
710
[tool.coverage.run]
811
omit = ["*/intake_esgf/tests/*"]
912

0 commit comments

Comments
 (0)