Skip to content

Commit 4273f2a

Browse files
authored
Fix tarball and wheel (#295)
* add tarball test and factor out pypi GHA * fix wheel * pre-commit
1 parent 7cb16ef commit 4273f2a

File tree

4 files changed

+62
-23
lines changed

4 files changed

+62
-23
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,3 @@ jobs:
5757
env_vars: OS,PYTHON
5858
name: codecov-umbrella
5959
fail_ci_if_error: false
60-
61-
distribution:
62-
runs-on: ubuntu-latest
63-
needs: [pytest]
64-
65-
steps:
66-
- uses: actions/checkout@v3
67-
- name: Build distributions
68-
run: |
69-
$CONDA/bin/python -m pip install build
70-
$CONDA/bin/python -m build
71-
- name: Publish a Python distribution to PyPI
72-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
73-
uses: pypa/gh-action-pypi-publish@release/v1
74-
with:
75-
user: __token__
76-
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/pypi.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
release:
9+
types:
10+
- published
11+
12+
jobs:
13+
packages:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.x"
22+
23+
- name: Get tags
24+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
25+
shell: bash
26+
27+
- name: Install build tools
28+
run: |
29+
python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine
30+
shell: bash
31+
32+
- name: Build binary wheel
33+
run: python -m build --sdist --wheel . --outdir dist
34+
35+
- name: CheckFiles
36+
run: |
37+
ls dist
38+
shell: bash
39+
40+
- name: Test wheels
41+
run: |
42+
cd dist && python -m pip install oceanspy*.whl
43+
python -m twine check *
44+
python -c "import oceanspy; print(f'oceanspy v{oceanspy.__version__}')"
45+
shell: bash
46+
47+
- name: Publish a Python distribution to PyPI
48+
if: success() && github.event_name == 'release'
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
with:
51+
user: __token__
52+
password: ${{ secrets.PYPI_API_TOKEN }}

MANIFEST.in

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
include AUTHORS.rst
21
include CONTRIBUTING.rst
32
include HISTORY.rst
4-
include LICENSE
53
include README.rst
4+
include LICENSE
5+
6+
graft oceanspy
67

7-
recursive-include oceanspy/tests *
8-
recursive-exclude * __pycache__
9-
recursive-exclude * *.py[co]
8+
prune assets
9+
prune docs
10+
prune binder
11+
prune paper
12+
prune sciserver_catalogs/
13+
prune *.egg-info
1014

1115
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ testpaths = ["oceanspy/tests"]
3636
addopts = "-v --cov"
3737

3838
[tool.setuptools]
39-
py-modules = ["oceanspy"]
39+
packages = ["oceanspy"]
4040

4141
[tool.setuptools_scm]
4242
write_to = "oceanspy/version.py"

0 commit comments

Comments
 (0)