Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Reference:
# - https://cirrus-ci.org/guide/writing-tasks/
# - https://cirrus-ci.org/guide/linux/
# - https://hub.docker.com/_/gcc/
# - https://hub.docker.com/_/python/

#
# Global defaults.
#
container:
image: python:3.8
cpu: 2
memory: 4G

env:
# Maximum cache period (in weeks) before forcing a new cache upload.
CACHE_PERIOD: "2"
# Increment the build number to force new mambaforge cache upload.
MAMBA_CACHE_BUILD: "0"
# Increment the build number to force new stratify cache upload.
STRATIFY_CACHE_BUILD: "0"
# Base environment conda packages to be installed.
MAMBA_CACHE_PACKAGES: "conda-lock"
# Enable Cython code coverage.
CYTHON_COVERAGE: "1"
# Increment the build number to force new pip cache upload.
PIP_CACHE_BUILD: "0"


#
# Linting
#
lint_task:
auto_cancellation: true
name: "${CIRRUS_OS}: black, flake8 and isort"
pip_cache:
folder: ~/.cache/pip
fingerprint_script:
- echo "${CIRRUS_TASK_NAME}"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${PIP_CACHE_BUILD}"
lint_script:
- pip list
- python -m pip install --editable .[lint]
- pip list
- black .
- flake8 .
- isort .


#
# Testing (Linux)
#
linux_task:
auto_cancellation: true
matrix:
env:
PY_VER: "3.8"
env:
PY_VER: "3.9"
COVERAGE: "1"
name: "${CIRRUS_OS}: py${PY_VER}"
container:
image: gcc:latest
env:
PATH: ${HOME}/mambaforge/bin:${PATH}
mamba_cache:
folder: ${HOME}/mambaforge
fingerprint_script:
- wget --quiet https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O mambaforge.sh
- echo "${CIRRUS_OS} $(sha256sum mambaforge.sh)"
- echo "${MAMBA_CACHE_PACKAGES}"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${MAMBA_CACHE_BUILD}"
populate_script:
- bash mambaforge.sh -b -p ${HOME}/mambaforge
- conda config --set always_yes yes --set changeps1 no
- conda config --set show_channel_urls True
- conda config --add channels conda-forge
- conda install --quiet --name base ${MAMBA_CACHE_PACKAGES}
check_script:
- conda info --all
- conda list --name base
stratify_cache:
folder: ${HOME}/mambaforge/envs/py${PY_VER}
fingerprint_script:
- echo "${CIRRUS_OS} py${PY_VER} tests"
- echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${STRATIFY_CACHE_BUILD}"
- cat ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
populate_script:
- conda-lock --mamba --platform linux-64 --file ${CIRRUS_WORKING_DIR}/requirements/py$(echo ${PY_VER} | tr -d ".").yml
- mamba create --name py${PY_VER} --quiet --file conda-linux-64.lock
- cp conda-linux-64.lock ${HOME}/mambaforge/envs/py${PY_VER}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, so you're caching the lock info in the CI 👍

test_script:
- cat ${HOME}/mambaforge/envs/py${PY_VER}/conda-linux-64.lock >&2
- source ${HOME}/mambaforge/etc/profile.d/conda.sh >/dev/null 2>&1
- conda activate py${PY_VER} >/dev/null 2>&1
- python setup.py build_ext --inplace
- python -m pip install --no-deps --editable .
- if [ -n "${COVERAGE}" ]; then pytest --cov-report=xml --cov; else pytest; fi
- if [ -n "${COVERAGE}" ]; then codecov; fi
18 changes: 0 additions & 18 deletions .coveragerc

This file was deleted.

28 changes: 28 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[flake8]

# References:
# https://flake8.readthedocs.io/en/latest/user/configuration.html
# https://flake8.readthedocs.io/en/latest/user/error-codes.html
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes

select = C,D,E,F,W,B,B950
ignore =
# E203: whitespace before ':'
E203,
# E226: missing whitespace around arithmetic operator
E226,
# E231: missing whitespace after ',', ';', or ':'
E231,
# E402: module level imports on one line
E402,
# E501: line too long
E501,
# E731: do not assign a lambda expression, use a def
E731,
# W503: line break before binary operator
W503,
# W504: line break after binary operator
W504
exclude =
.eggs
build
138 changes: 132 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,136 @@
# setuptools-scm
_version.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file and why explicitly ignored?

Copy link
Member Author

@bjlittle bjlittle May 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used by scm and you do not place it under source code control.

It's like a scratch file that scm uses, as per your configuration, to dump its versioning metadata, see pyproject.toml:line+14.

This is then parsed by stratify.init:line+2


# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so
__pycache__
*.egg-info
build
*.swp
.ipynb_checkpoints
*.pyc
*.c

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# PyCharm
.idea
40 changes: 40 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.0.1'
hooks:
# Prevent giant files from being committed.
- id: check-added-large-files
# Check whether files parse as valid Python.
- id: check-ast
# Check for file name conflicts on case-insensitive filesytems.
- id: check-case-conflict
# Check for files that contain merge conflict strings.
- id: check-merge-conflict
# Check for debugger imports and py37+ `breakpoint()` calls in Python source.
- id: debug-statements
# Don't commit to master branch.
- id: no-commit-to-branch
- repo: https://github.com/psf/black
rev: '21.5b0'
hooks:
- id: black
# Force black to run on whole repo, using settings from pyproject.toml
pass_filenames: false
args: [--config=./pyproject.toml, .]
- repo: https://github.com/PyCQA/flake8
rev: '3.9.2'
hooks:
# Run flake8.
- id: flake8
args: [--config=./.flake8]
- repo: https://github.com/pycqa/isort
rev: 5.8.0
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black", "--filter-files"]
- id: isort
name: isort (cython)
types: [cython]
5 changes: 0 additions & 5 deletions .stickler.yml

This file was deleted.

53 changes: 0 additions & 53 deletions .travis.yml

This file was deleted.

Loading