Skip to content

Commit e598823

Browse files
authored
Merge pull request #23 from NCAS-CMS/basic_package
Basic python package with conda-forge environment file
2 parents 6c8af26 + 5386d0b commit e598823

File tree

4 files changed

+128
-1
lines changed

4 files changed

+128
-1
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: PyPi Build and Deploy 🐍📦
2+
3+
on:
4+
release:
5+
types: [published]
6+
# use this for testing
7+
push:
8+
branches:
9+
- main
10+
- basic_package
11+
12+
jobs:
13+
build-n-publish:
14+
name: Build and publish xconv2 on PyPi
15+
runs-on: ubuntu-latest
16+
environment:
17+
name: pypi
18+
url: https://pypi.org/project/xconv2/
19+
permissions:
20+
# IMPORTANT: this permission is mandatory for trusted publishing
21+
id-token: write
22+
steps:
23+
- uses: actions/checkout@v6
24+
with:
25+
fetch-depth: 0
26+
- name: Set up Python 3.14
27+
uses: actions/setup-python@v6
28+
with:
29+
python-version: "3.14"
30+
- name: Install pep517
31+
run: >-
32+
python -m
33+
pip install
34+
pep517
35+
--user
36+
- name: Build a binary wheel and a source tarball
37+
run: >-
38+
python -m
39+
pep517.build
40+
--source
41+
--binary
42+
--out-dir dist/
43+
.
44+
### test for Test PyPI
45+
# - name: Publish distribution to Test PyPI
46+
# uses: pypa/gh-action-pypi-publish@release/v1
47+
# with:
48+
# repository-url: https://test.pypi.org/legacy/
49+
###
50+
- name: Publish distribution 📦 to PyPI
51+
if: startsWith(github.ref, 'refs/tags')
52+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/pytest.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: xconv2 Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: '0 0 * * *' # nightly
12+
13+
# Required shell entrypoint to have properly configured bash shell
14+
defaults:
15+
run:
16+
shell: bash -l {0}
17+
18+
jobs:
19+
build:
20+
21+
name: Test Python ${{ matrix.python-version }}
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
python-version: ["3.12", "3.13", "3.14"]
27+
28+
steps:
29+
- uses: actions/checkout@v6
30+
with:
31+
fetch-depth: 0
32+
- uses: conda-incubator/setup-miniconda@v3
33+
with:
34+
activate-environment: xconv2
35+
environment-file: environment.yml
36+
python-version: ${{ matrix.python-version }}
37+
miniforge-version: "latest"
38+
use-mamba: true
39+
- name: Install xconv2
40+
run: pip install -e .
41+
- name: Run pip check
42+
run: pip check
43+
# - name: Run pre-commit with mypy
44+
# run: |
45+
# pre-commit install
46+
# pre-commit run -a
47+
- name: Check environment contents
48+
run: |
49+
conda list
50+
pip list
51+
- name: Test xconv2
52+
run: |
53+
which xconv2
54+
- name: Test with pytest
55+
run: pytest

environment.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: xconv2
3+
channels:
4+
- conda-forge
5+
- nodefaults
6+
7+
dependencies:
8+
- python >=3.12
9+
- pip !=21.3
10+
- cf-plot
11+
- cf-python
12+
- pandas
13+
- pyside6
14+
- setuptools >80 # cfplot imports distutils
15+
- superqt
16+
- zarr
17+
# testing
18+
- pytest

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=61.0"]
2+
requires = ["setuptools>=80"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -13,6 +13,8 @@ dependencies = [
1313
"cf-python",
1414
"cf-plot",
1515
"zarr",
16+
"pandas",
17+
"setuptools>80",
1618
]
1719

1820
[project.optional-dependencies]

0 commit comments

Comments
 (0)