Skip to content

Commit d061e9d

Browse files
committed
Work on python packaging
1 parent df20466 commit d061e9d

11 files changed

+247
-0
lines changed

.conda/build.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
$PYTHON -m pip install py360convert numpy-quaternion

.conda/environment.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
channels:
2+
- conda-forge
3+
- accessnri
4+
- default
5+
6+
dependencies:
7+
- anaconda-client
8+
- conda-build
9+
- conda-verify

.conda/meta.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{% set data = load_setup_py_data(setup_file='../setup.py', from_recipe_dir=True) %}
2+
{% set version = data.get('version') %}
3+
4+
package:
5+
name: accessvis
6+
version: "{{ version }}"
7+
8+
source:
9+
#url: "https://pypi.io/packages/source/a/access-nri-intake/accessvis-{{ version }}.tar.gz"
10+
11+
build:
12+
noarch: python
13+
number: 0
14+
script: "{{ PYTHON }} -m pip install . -vv"
15+
16+
requirements:
17+
host:
18+
- python
19+
- pip
20+
- versioneer
21+
run:
22+
- python >=3.9
23+
- pillow
24+
- matplotlib
25+
- ipywidgets
26+
- astropy
27+
- xarray
28+
- tqdm
29+
- netcdf4
30+
- lavavu
31+
32+
33+
about:
34+
home: https://github.com/ACCESS-NRI/access-nri-intake-catalog
35+
license: Apache Software
36+
license_family: APACHE
37+
summary: "Visualisation Package for ACCESS models"
38+
doc_url: https://access-vis.readthedocs.io/en/latest
39+
40+
extra:
41+
recipe-maintainers:
42+
- rbeucher

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.github/workflows/CD.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CD
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
pypi:
7+
name: build and deploy to PyPI
8+
if: github.repository == 'ACCESS-NRI/ACCESS-Vis' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
9+
runs-on: "ubuntu-latest"
10+
permissions:
11+
id-token: write
12+
13+
steps:
14+
- name: Checkout source
15+
uses: actions/[email protected]
16+
17+
- name: Set up Python 3.11
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: 3.11
21+
22+
- name: Install build dependencies
23+
run: python -m pip install build twine
24+
25+
- name: Build distributions
26+
shell: bash -l {0}
27+
run: |
28+
git clean -xdf
29+
pyproject-build
30+
31+
- name: Publish package to PyPI
32+
uses: pypa/gh-action-pypi-publish@release/v1
33+
34+
conda:
35+
name: build and deploy to conda
36+
needs: pypi
37+
if: always() && needs.pypi.result == 'success'
38+
runs-on: "ubuntu-latest"
39+
40+
steps:
41+
- name: Checkout source
42+
uses: actions/[email protected]
43+
44+
- name: Setup conda environment
45+
uses: conda-incubator/setup-miniconda@v3
46+
with:
47+
miniconda-version: "latest"
48+
python-version: 3.11
49+
environment-file: .conda/environment.yml
50+
auto-update-conda: false
51+
auto-activate-base: false
52+
show-channel-urls: true
53+
54+
- name: Build and upload the conda package
55+
uses: uibcdf/[email protected]
56+
with:
57+
meta_yaml_dir: .conda
58+
python-version: 3.11
59+
user: accessnri
60+
label: main
61+
token: ${{ secrets.anaconda_token }}

.github/workflows/CI.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on: [pull_request, push, workflow_dispatch]
4+
5+
jobs:
6+
pre-commit:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/[email protected]
10+
- uses: actions/setup-python@v5
11+
- uses: pre-commit/[email protected]
12+
13+
test:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: true
17+
matrix:
18+
python-version: ["3.9", "3.10", "3.11", "3.12"]
19+
20+
steps:
21+
- name: Checkout source
22+
uses: actions/[email protected]
23+
24+
- name: Setup conda environment
25+
uses: conda-incubator/setup-miniconda@v3
26+
with:
27+
miniconda-version: "latest"
28+
python-version: ${{ matrix.python-version }}
29+
environment-file: ci/environment-${{ matrix.python-version }}.yml
30+
activate-environment: access-vis-test
31+
auto-activate-base: false
32+
33+
- name: Install source
34+
shell: bash -l {0}
35+
run: python -m pip install -e .
36+
37+
- name: List installed packages
38+
shell: bash -l {0}
39+
run: conda list
40+
41+
- name: Run tests
42+
shell: bash -l {0}
43+
run: python -m pytest -s .
44+
45+
- name: Upload code coverage
46+
uses: codecov/codecov-action@v4
47+
with:
48+
token: ${{ secrets.codecov_token }}
49+
files: ./coverage.xml

.pre-commit-config.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/charliermarsh/ruff-pre-commit
3+
rev: 'v0.0.238'
4+
hooks:
5+
- id: ruff
6+
args: ['--fix']
7+
8+
- repo: https://github.com/psf/black
9+
rev: 22.12.0
10+
hooks:
11+
- id: black
12+
language_version: python3
13+
# Mypy
14+
- repo: https://github.com/pre-commit/mirrors-mypy
15+
rev: 'v1.11.2'
16+
hooks:
17+
- id: mypy
18+
name: mypy
19+
additional_dependencies: [types-PyYAML==6.0.12.20240808]

.zenodo.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"creators": [
3+
{
4+
"orcid": "0000-0001-6303-5671",
5+
"affiliation": "ACCESS-NRI",
6+
"name": "Kaluza, Owen"
7+
},
8+
{
9+
"orcid": "0000-0003-3891-5444",
10+
"affiliation": "ACCESS-NRI",
11+
"name": "Beucher, Romain"
12+
}
13+
],
14+
15+
"license": "Apache-2.0",
16+
17+
"title": "ACCESS-NRI ACCESS-Vis Python Package",
18+
19+
"keywords": ["Climate", "Science", "Model Evaluation", "Visualisation", "ACCESS-NRI"],
20+
21+
"communities": [
22+
{"identifier": "access-nri"}
23+
],
24+
25+
"grants": [{"id":""}]
26+
}

COPYRIGHT

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2024 ACCESS-NRI
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

tests/conftest.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2023 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
import os
5+
from pathlib import Path
6+
7+
from pytest import fixture
8+
9+
here = os.path.abspath(os.path.dirname(__file__))
10+
11+
12+
@fixture(scope="session")
13+
def test_data():
14+
return Path(os.path.join(here, "data"))

tests/data/.gitignore

Whitespace-only changes.

0 commit comments

Comments
 (0)