Skip to content

Commit e09d203

Browse files
committed
drop osx, add ci linting
1 parent 18a86c8 commit e09d203

File tree

6 files changed

+44
-56
lines changed

6 files changed

+44
-56
lines changed

.cirrus.yml

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#
1010
container:
1111
image: python:3.8
12+
cpu: 2
13+
memory: 4G
1214

1315
env:
1416
# Maximum cache period (in weeks) before forcing a new cache upload.
@@ -18,9 +20,32 @@ env:
1820
# Increment the build number to force new stratify cache upload.
1921
STRATIFY_CACHE_BUILD: "0"
2022
# Base environment conda packages to be installed.
21-
MAMBA_CACHE_PACKAGES: "pip conda-lock"
23+
MAMBA_CACHE_PACKAGES: "conda-lock"
2224
# Enable Cython code coverage.
2325
CYTHON_COVERAGE: "1"
26+
# Increment the build number to force new pip cache upload.
27+
PIP_CACHE_BUILD: "0"
28+
29+
30+
#
31+
# Linting
32+
#
33+
lint_task:
34+
auto_cancellation: true
35+
name: "${CIRRUS_OS}: black, flake8 and isort"
36+
pip_cache:
37+
folder: ~/.cache/pip
38+
fingerprint_script:
39+
- echo "${CIRRUS_TASK_NAME}"
40+
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${PIP_CACHE_BUILD}"
41+
lint_script:
42+
- pip list
43+
- python -m pip install --editable .[lint]
44+
- pip list
45+
- black .
46+
- flake8 .
47+
- isort .
48+
2449

2550
#
2651
# Testing (Linux)
@@ -33,7 +58,7 @@ linux_task:
3358
env:
3459
PY_VER: "3.9"
3560
COVERAGE: "1"
36-
name: "Linux: py${PY_VER}"
61+
name: "${CIRRUS_OS}: py${PY_VER}"
3762
container:
3863
image: gcc:latest
3964
env:
@@ -69,53 +94,6 @@ linux_task:
6994
- source ${HOME}/mambaforge/etc/profile.d/conda.sh >/dev/null 2>&1
7095
- conda activate py${PY_VER} >/dev/null 2>&1
7196
- python setup.py build_ext --inplace
72-
- pip install --no-deps --editable .
97+
- python -m pip install --no-deps --editable .
7398
- if [ -n "${COVERAGE}" ]; then pytest --cov-report=xml --cov; else pytest; fi
7499
- if [ -n "${COVERAGE}" ]; then codecov; fi
75-
76-
#
77-
# Testing (macOS)
78-
#
79-
osx_task:
80-
auto_cancellation: true
81-
matrix:
82-
env:
83-
PY_VER: "3.8"
84-
name: "OSX: py${PY_VER}"
85-
osx_instance:
86-
image: catalina-xcode
87-
env:
88-
PATH: ${HOME}/mambaforge/bin:${PATH}
89-
mamba_cache:
90-
folder: ${HOME}/mambaforge
91-
fingerprint_script:
92-
- wget --quiet https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-MacOSX-x86_64.sh -O mambaforge.sh
93-
- echo "${CIRRUS_OS} $(shasum -a 256 mambaforge.sh)"
94-
- echo "${MAMBA_CACHE_PACKAGES}"
95-
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${MAMBA_CACHE_BUILD}"
96-
populate_script:
97-
- bash mambaforge.sh -b -p ${HOME}/mambaforge
98-
- conda config --set always_yes yes --set changeps1 no
99-
- conda config --set show_channel_urls True
100-
- conda config --add channels conda-forge
101-
- conda install --quiet --name base ${MAMBA_CACHE_PACKAGES}
102-
check_script:
103-
- conda info --all
104-
- conda list --name base
105-
stratify_cache:
106-
folder: ${HOME}/mambaforge/envs/py${PY_VER}
107-
fingerprint_script:
108-
- echo "${CIRRUS_OS} py${PY_VER} tests"
109-
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${STRATIFY_CACHE_BUILD}"
110-
- cat ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
111-
populate_script:
112-
- conda-lock --mamba --platform osx-64 --file ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
113-
- mamba create --yes --name py${PY_VER} --quiet --file conda-osx-64.lock
114-
- cp conda-osx-64.lock ${HOME}/mambaforge/envs/py${PY_VER}
115-
test_script:
116-
- cat ${HOME}/mambaforge/envs/py${PY_VER}/conda-osx-64.lock >&2
117-
- source ${HOME}/mambaforge/etc/profile.d/conda.sh >/dev/null 2>&1
118-
- conda activate py${PY_VER} >/dev/null 2>&1
119-
- python setup.py build_ext --inplace
120-
- pip install --no-deps --editable .
121-
- pytest

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
# Don't commit to master branch.
1818
- id: no-commit-to-branch
1919
- repo: https://github.com/psf/black
20-
rev: '21.5b1'
20+
rev: '21.5b0'
2121
hooks:
2222
- id: black
2323
# Force black to run on whole repo, using settings from pyproject.toml
@@ -34,6 +34,7 @@ repos:
3434
hooks:
3535
- id: isort
3636
name: isort (python)
37+
args: ["--profile", "black", "--filter-files"]
3738
- id: isort
3839
name: isort (cython)
3940
types: [cython]

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ exclude = '''
3636

3737
[tool.isort]
3838
profile = "black"
39+
skip_gitignore = "True"
40+
verbose = "True"

requirements/py38.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ dependencies:
1414
- numpy
1515
- cython
1616

17-
# Test dependencies.
17+
# Developer dependencies.
1818
- black=21.5b0
19-
- codecov
2019
- flake8=3.9.2
2120
- isort=5.8.0
21+
- pip
2222
- pre-commit
23+
24+
# Test dependencies.
25+
- codecov
2326
- pytest
2427
- pytest-cov

requirements/py39.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ dependencies:
1414
- numpy
1515
- cython
1616

17-
# Test dependencies.
17+
# Developer dependencies.
1818
- black=21.5b0
19-
- codecov
2019
- flake8=3.8.2
2120
- isort=5.8.0
21+
- pip
2222
- pre-commit
23+
24+
# Test dependencies.
25+
- codecov
2326
- pytest
2427
- pytest-cov

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ install_requires =
3535
numpy
3636

3737
[options.extras_require]
38-
dev =
38+
lint =
3939
black==21.5b0
4040
flake8==3.9.2
4141
isort==5.8.0
42+
dev =
4243
pre-commit
4344
pytest
4445
pytest-cov

0 commit comments

Comments
 (0)