Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp and simplify code, tests, build; add CI/CD #27

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Check https://editorconfig.org for more information
# These are derived from https://ukupat.github.io/tabs-or-spaces/
# The most majority indentation style was selected for each language
root = true

# 2-space
[*]
end_of_line = lf
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

# 4-space
[*.py]
indent_size = 4

# CSV-like; no newlines or trimming whitespace
[*.{tsv,tab,csv}]
indent_style = tab
trim_trailing_whitespace = false
insert_final_newline = false
52 changes: 52 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Build, test, and publish to releases, packages, PyPi, etc.
# Runs when creating a GitHub release
name: publish
on:
release:
types: [published]
branches: [main, master, "release/**", "releases/**"]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
name: "test on ${{ matrix.os }}/py${{ matrix.python-version }}"
runs-on: "${{ matrix.os }}"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"
- name: Install Tox
run: pip install tox>=4,<5"
- name: Test with tox
run: |
tox -v
deploy:
runs-on: ubuntu-latest
needs: ["test"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: $MAX_PYTHON_VR
- name: Install build meta-dependencies
run: pip install $META_DEPS
- name: Build sdists and wheels with Poetry
run: |
poetry build
poetry install
- name: Attach artifacts to the GitHub release
uses: skx/github-action-publish-binaries@master
with:
args: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to PyPi
run: |
poetry publish -vv --username __token__ --password ${{ secrets.PYPI_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/pull-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Runs tests via tox
# Runs on pull requests to main
name: pulltest
on:
pull_request:
types: [ready_for_review, opened, reopened]
branches: [main, master, stable, "release/**", "releases/**"]
paths-ignore: ["**/*.md", "**/*.rst"]
jobs:
test:
name: "Test ${{ github.ref_type }}:${{ github.ref_name }} on ${{ matrix.os }}/py${{ matrix.python-version }}"
strategy:
max-parallel: 1
matrix:
os: [ubuntu-latest, windows-latest", macos-latest]
python-version: ["3.11"]
runs-on: "${{ matrix.os }}"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"
- name: Install Tox
run: pip install tox>=4,<5"
- name: Test with tox
run: |
tox -v
29 changes: 29 additions & 0 deletions .github/workflows/push-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Build, test, and run static analyses, and send reports to external services
# Runs only on pushing to main
name: maintest
on:
push:
branches: [main, master]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
name: "test on ${{ matrix.os }}/py${{ matrix.python-version }}"
runs-on: "${{ matrix.os }}"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"
- name: Install Tox
run: pip install "tox>=4,<5"
- name: Test with tox
run: |
tox -v
#- name: Submit to codecov
# if: runner.os == 'Linux' && $USE_CODECOV
# run: pip install "codecov>=$CODECOV_VR" && codecov
80 changes: 80 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Also see https://github.com/github/gitignore/blob/master/Python.gitignore
# This is simpler and easier to understand
# We'll ignore all .* files and then re-add some

# General hidden or unwanted
.*
~*
*~
*#
Thumbs.db
*.bak
*.swp
tmp/
null

# Log files and binary files
*.log
*.zip
*.tar.gz
*.tgz
*.gz
*.tar
*.z7
*.exe
*.msi
*.pkg
*.dll
*.so

# Python temp and build files
docs/html/
__pycache__/
__pypackages__/
*.py[cod]
*$py.class
*.egg-info
pip-wheel-metadata
share/python-wheels/
build/
dist/
eggs/
sdist/
docs/_build
cython_debug/
docs/autoapi

# Hidden files that are definitely unwanted (redundant)
.tox/
.pytest_cache
.ipynb_checkpoints

# Files from other languages
*.o
hs_err_pid*
*.class
*.jl.cov
*.jl.*.cov
*.jl.mem
deps/deps.jl

# Keep these config files
!/.gitignore
!/.prettierignore
!/.travis.yml
!/.travis.yaml
!/.circleci/config.yml
!/.circleci/config.yaml
!/.github
!/.appveyor.yml
!/.appveyor.yaml
!/.flake8
!/.readthedocs.yml
!/.readthedocs.yaml
!/.dockerignore
!/.editorconfig
!/.pre-commit-config.yml
!/.pre-commit-config.yaml
!.npmignore
!/.scrutinizer.yml
!/.scrutinizer.yaml
59 changes: 59 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Check out https://pre-commit.com/ for documentation
# :Tyranno: minimum_pre_commit_version: ${.test-deps.pre-commit}
minimum_pre_commit_version: 3.3.3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: check-json
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-yaml
- id: end-of-file-fixer
- id: fix-byte-order-marker
exclude: "^tests/(?:resources|data)/"
- id: fix-encoding-pragma
args: [--remove]
- id: trailing-whitespace

# --- Commit msg checks ---
- hooks:
- id: commitizen
stages: ["commit-msg"]
repo: https://github.com/commitizen-tools/commitizen
rev: v3.5.2

# --- Linters ---

- repo: https://github.com/asottile/pyupgrade
rev: v3.7.0
hooks:
- id: pyupgrade
args: [--py310-plus]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--profile, black]

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black

- repo: https://github.com/asottile/blacken-docs
rev: 1.14.0
hooks:
- id: blacken-docs

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
stages: [commit]
args: [--print-width, "100"]
exclude: ^recipes/.*
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog for rd_filters

Refer to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) for formatting information.

## 0.2.0 - unreleased

### Changed

- Redesigned CLI

### Dropped

- Past-EOL Python version support

### Fixed

- Build infrastructure and CI/CD
- Removed pandas dependency
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

Loading