Skip to content

Commit b770fc6

Browse files
committed
first commit
0 parents  commit b770fc6

20 files changed

+1779
-0
lines changed

.github/workflows/python-publish.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Upload Python Package
5+
6+
on:
7+
8+
push: {}
9+
10+
release:
11+
types: [created]
12+
13+
jobs:
14+
quality:
15+
name: Code QA
16+
runs-on: ubuntu-latest
17+
steps:
18+
- run: sudo apt-get install -y pandoc # Needed by sphinx for notebooks
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: 3.x
23+
- uses: pre-commit/[email protected]
24+
25+
checks:
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
platform: ["ubuntu-latest", "macos-latest"]
30+
python-version: ["3.10"]
31+
32+
name: Python ${{ matrix.python-version }} on ${{ matrix.platform }}
33+
runs-on: ${{ matrix.platform }}
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- uses: actions/setup-python@v2
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
42+
- name: Install
43+
run: |
44+
pip install pytest
45+
pip install -e .[all]
46+
pip install -r tests/requirements.txt
47+
pip freeze
48+
49+
- name: Tests
50+
run: pytest
51+
52+
deploy:
53+
54+
if: ${{ github.event_name == 'release' }}
55+
runs-on: ubuntu-latest
56+
needs: [checks, quality]
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: Set up Python
62+
uses: actions/setup-python@v2
63+
with:
64+
python-version: '3.10'
65+
66+
- name: Check that tag version matches code version
67+
run: |
68+
tag=${GITHUB_REF#refs/tags/}
69+
version=$(python setup.py --version)
70+
echo 'tag='$tag
71+
echo "version file="$version
72+
test "$tag" == "$version"
73+
74+
- name: Install dependencies
75+
run: |
76+
python -m pip install --upgrade pip
77+
pip install setuptools wheel twine
78+
- name: Build and publish
79+
env:
80+
TWINE_USERNAME: __token__
81+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
82+
run: |
83+
python setup.py sdist
84+
twine upload dist/*

.gitignore

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
154+
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158+
# and can be added to the global gitignore or merged into this file. For a more nuclear
159+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160+
#.idea/
161+
162+
*.grib
163+
*.onnx
164+
*.ckpt
165+
*.swp
166+
*.npy
167+
*.download
168+
?
169+
?.*
170+
foo
171+
bar
172+
*.grib
173+
*.nc
174+
*.npz
175+
*.json
176+
*.zarr/
177+
~$images.pptx
178+
test.py
179+
cutout.png
180+
*.out
181+
182+
_build/
183+
?
184+
?.*
185+
~*
186+
*.sync

.pre-commit-config.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
repos:
2+
3+
# Empty notebookds
4+
- repo: local
5+
hooks:
6+
- id: clear-notebooks-output
7+
name: clear-notebooks-output
8+
files: tools/.*\.ipynb$
9+
stages: [commit]
10+
language: python
11+
entry: jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace
12+
additional_dependencies: [jupyter]
13+
14+
15+
- repo: https://github.com/pre-commit/pre-commit-hooks
16+
rev: v4.4.0
17+
hooks:
18+
- id: check-yaml # Check YAML files for syntax errors only
19+
args: [--unsafe, --allow-multiple-documents]
20+
- id: debug-statements # Check for debugger imports and py37+ breakpoint()
21+
- id: end-of-file-fixer # Ensure files end in a newline
22+
- id: trailing-whitespace # Trailing whitespace checker
23+
- id: no-commit-to-branch # Prevent committing to main / master
24+
- id: check-added-large-files # Check for large files added to git
25+
- id: check-merge-conflict # Check for files that contain merge conflict
26+
27+
- repo: https://github.com/psf/black-pre-commit-mirror
28+
rev: 24.1.1
29+
hooks:
30+
- id: black
31+
args: [--line-length=120]
32+
33+
- repo: https://github.com/pycqa/isort
34+
rev: 5.13.2
35+
hooks:
36+
- id: isort
37+
args:
38+
- -l 120
39+
- --force-single-line-imports
40+
- --profile black
41+
42+
43+
- repo: https://github.com/astral-sh/ruff-pre-commit
44+
rev: v0.3.0
45+
hooks:
46+
- id: ruff
47+
exclude: '(dev/.*|.*_)\.py$'
48+
args:
49+
- --line-length=120
50+
- --fix
51+
- --exit-non-zero-on-fix
52+
- --preview
53+
54+
# For now, we use it. But it does not support a lot of sphinx features
55+
- repo: https://github.com/dzhu/rstfmt
56+
rev: v0.0.14
57+
hooks:
58+
- id: rstfmt

.readthedocs.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3.10"
7+
8+
sphinx:
9+
configuration: docs/conf.py
10+
11+
python:
12+
install:
13+
- requirements: docs/requirements.txt

0 commit comments

Comments
 (0)