Skip to content

Commit ec528ae

Browse files
committed
refresh ncta
1 parent 0ec3b51 commit ec528ae

26 files changed

+827
-2979
lines changed

.cirrus.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Reference:
2+
# - https://cirrus-ci.org/guide/writing-tasks/
3+
# - https://cirrus-ci.org/guide/linux/
4+
# - https://hub.docker.com/_/gcc/
5+
# - https://hub.docker.com/_/python/
6+
7+
#
8+
# Global defaults.
9+
#
10+
container:
11+
image: python:latest
12+
cpu: 2
13+
memory: 4G
14+
15+
16+
env:
17+
# Maximum cache period (in weeks) before forcing a new cache upload.
18+
CACHE_PERIOD: "2"
19+
# Increment the build number to force new mambaforge cache upload.
20+
MAMBA_CACHE_BUILD: "0"
21+
# Increment the build number to force new mint cache upload.
22+
NCTA_CACHE_BUILD: "0"
23+
# Base environment conda packages to be installed
24+
MAMBA_CACHE_PACKAGES: "pip conda-lock"
25+
# Increment the build number to forve new pip cache upload.
26+
PIP_CACHE_BUILD: "0"
27+
# Linting packages to be installed.
28+
PIP_CACHE_PACKAGES: "black flake8 isort"
29+
30+
31+
#
32+
# Linting
33+
#
34+
lint_task:
35+
auto_cancellation: true
36+
name: "${CIRRUS_OS}: linting"
37+
pip_cache:
38+
folder: ~/.cache/pip
39+
fingerprint_script:
40+
- echo "${CIRRUS_TASK_NAME} py${PYTHON_VERSION}"
41+
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${PIP_CACHE_BUILD} ${PIP_CACHE_PACKAGES}"
42+
lint_script:
43+
- pip list
44+
- python -m pip install --retries 3 --upgrade ${PIP_CACHE_PACKAGES}
45+
- pip list
46+
- black --check ${CIRRUS_WORKING_DIR}
47+
- flake8 ${CIRRUS_WORKING_DIR}
48+
- isort --check ${CIRRUS_WORKING_DIR}
49+
50+
51+
#
52+
# Testing (Linux)
53+
#
54+
linux_task:
55+
auto_cancellation: true
56+
matrix:
57+
env:
58+
PY_VER: "3.7"
59+
env:
60+
PY_VER: "3.8"
61+
env:
62+
PY_VER: "3.9"
63+
COVERAGE: "codecov"
64+
name: "${CIRRUS_OS}: py${PY_VER}"
65+
container:
66+
image: gcc:latest
67+
env:
68+
PATH: ${HOME}/mambaforge/bin:${PATH}
69+
mamba_cache:
70+
folder: ${HOME}/mambaforge
71+
fingerprint_script:
72+
- wget --quiet https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O mambaforge.sh
73+
- echo "${CIRRUS_OS} $(sha256sum mambaforge.sh)"
74+
- echo "${MAMBA_CACHE_PACKAGES}"
75+
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${MAMBA_CACHE_BUILD}"
76+
populate_script:
77+
- bash mambaforge.sh -b -p ${HOME}/mambaforge
78+
- conda config --set always_yes yes --set changeps1 no
79+
- conda config --set show_channel_urls True
80+
- conda config --add channels conda-forge
81+
- conda install --quiet --name base ${MAMBA_CACHE_PACKAGES}
82+
check_script:
83+
- conda info --all
84+
- conda list --name base
85+
ncta_cache:
86+
folder: ${HOME}/mambaforge/envs/py${PY_VER}
87+
fingerprint_script:
88+
- echo "${CIRRUS_OS} py${PY_VER} tests"
89+
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${MINT_CACHE_BUILD}"
90+
- cat ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
91+
populate_script:
92+
- conda-lock --mamba --platform linux-64 --file ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
93+
- mamba create --name py${PY_VER} --quiet --file conda-linux-64.lock
94+
- cp conda-linux-64.lock ${HOME}/mambaforge/envs/py${PY_VER}
95+
test_script:
96+
- cat ${HOME}/mambaforge/envs/py${PY_VER}/conda-linux-64.lock >&2
97+
- source ${HOME}/mambaforge/etc/profile.d/conda.sh >/dev/null 2>&1
98+
- conda activate py${PY_VER} >/dev/null 2>&1
99+
- pip install --no-deps --editable .
100+
- pytest --cov-report=xml --cov
101+
- ${COVERAGE}

.coveragerc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#
44

55
[run]
6-
source = nc_time_axis
76
branch = True
7+
source = nc_time_axis
88
omit =
99
nc_time_axis/_version.py
1010
nc_time_axis/tests/*
11-
11+
setup.py
1212

1313
[report]
1414
exclude_lines =

.flake8

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[flake8]
2+
3+
# References:
4+
# https://flake8.readthedocs.io/en/latest/user/configuration.html
5+
# https://flake8.readthedocs.io/en/latest/user/error-codes.html
6+
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
7+
8+
select = C,D,E,F,W,B,B950
9+
ignore =
10+
# E203: whitespace before ':'
11+
E203,
12+
# E226: missing whitespace around arithmetic operator
13+
E226,
14+
# E231: missing whitespace after ',', ';', or ':'
15+
E231,
16+
# E402: module level imports on one line
17+
E402,
18+
# E501: line too long
19+
E501,
20+
# E731: do not assign a lambda expression, use a def
21+
E731,
22+
# W503: line break before binary operator
23+
W503,
24+
# W504: line break after binary operator
25+
W504
26+
exclude =
27+
.eggs
28+
build

.gitignore

Lines changed: 86 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
1+
# Directory-based project format:
2+
.idea/
3+
4+
# Created by editors
5+
*~
6+
\#*
7+
\.\#*
8+
*.swp
9+
10+
# setuptools-scm
11+
_version.py
12+
113
# Byte-compiled / optimized / DLL files
214
__pycache__/
315
*.py[cod]
16+
*$py.class
417

518
# C extensions
619
*.so
720

821
# Distribution / packaging
922
.Python
10-
env/
1123
build/
1224
develop-eggs/
1325
dist/
1426
downloads/
1527
eggs/
1628
.eggs/
29+
lib/
1730
lib64/
1831
parts/
1932
sdist/
2033
var/
34+
wheels/
35+
pip-wheel-metadata/
36+
share/python-wheels/
2137
*.egg-info/
2238
.installed.cfg
2339
*.egg
40+
MANIFEST
2441

2542
# PyInstaller
2643
# Usually these files are written by a python script from a template
@@ -35,28 +52,90 @@ pip-delete-this-directory.txt
3552
# Unit test / coverage reports
3653
htmlcov/
3754
.tox/
55+
.nox/
3856
.coverage
3957
.coverage.*
4058
.cache
4159
nosetests.xml
4260
coverage.xml
43-
*,cover
61+
*.cover
62+
*.py,cover
63+
.hypothesis/
64+
.pytest_cache/
4465

4566
# Translations
4667
*.mo
4768
*.pot
4869

4970
# Django stuff:
5071
*.log
72+
local_settings.py
73+
db.sqlite3
74+
db.sqlite3-journal
75+
76+
# Flask stuff:
77+
instance/
78+
.webassets-cache
79+
80+
# Scrapy stuff:
81+
.scrapy
5182

5283
# Sphinx documentation
5384
docs/_build/
5485

5586
# PyBuilder
5687
target/
5788

58-
# Created by editiors
59-
*~
60-
\#*
61-
\.\#*
62-
*.swp
89+
# Jupyter Notebook
90+
.ipynb_checkpoints
91+
92+
# IPython
93+
profile_default/
94+
ipython_config.py
95+
96+
# pyenv
97+
.python-version
98+
99+
# pipenv
100+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
101+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
102+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
103+
# install all needed dependencies.
104+
#Pipfile.lock
105+
106+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
107+
__pypackages__/
108+
109+
# Celery stuff
110+
celerybeat-schedule
111+
celerybeat.pid
112+
113+
# SageMath parsed files
114+
*.sage.py
115+
116+
# Environments
117+
.env
118+
.venv
119+
env/
120+
venv/
121+
ENV/
122+
env.bak/
123+
venv.bak/
124+
125+
# Spyder project settings
126+
.spyderproject
127+
.spyproject
128+
129+
# Rope project settings
130+
.ropeproject
131+
132+
# mkdocs documentation
133+
/site
134+
135+
# mypy
136+
.mypy_cache/
137+
.dmypy.json
138+
dmypy.json
139+
140+
# Pyre type checker
141+
.pyre/

.pre-commit-config.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: 'v4.0.1'
6+
hooks:
7+
# Prevent giant files from being committed.
8+
- id: check-added-large-files
9+
# Check whether files parse as valid Python.
10+
- id: check-ast
11+
# Check for file name conflicts on case-insensitive filesytems.
12+
- id: check-case-conflict
13+
# Check for files that contain merge conflict strings.
14+
- id: check-merge-conflict
15+
# Check for debugger imports and py37+ `breakpoint()` calls in Python source.
16+
- id: debug-statements
17+
# Don't commit to master branch.
18+
- id: no-commit-to-branch
19+
- repo: https://github.com/psf/black
20+
rev: '21.5b2'
21+
hooks:
22+
- id: black
23+
# Force black to run on whole repo, using settings from pyproject.toml
24+
pass_filenames: false
25+
args: [--config=./pyproject.toml, .]
26+
- repo: https://github.com/PyCQA/flake8
27+
rev: '3.9.2'
28+
hooks:
29+
# Run flake8.
30+
- id: flake8
31+
args: [--config=./.flake8]
32+
- repo: https://github.com/pycqa/isort
33+
rev: '5.8.0'
34+
hooks:
35+
- id: isort
36+
name: isort
37+
args: ["--profile", "black", "--filter-files"]

.travis.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

MANIFEST.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include LICENSE
2-
include versioneer.py
3-
include nc_time_axis/_version.py
2+
3+
recursive-include nc_time_axis/tests *.py
4+
graft requirements

0 commit comments

Comments
 (0)