Skip to content

Commit

Permalink
馃敡 MAINTAIN: Improve repo configuration
Browse files Browse the repository at this point in the history
- Move config to `setup.cfg` and `pyproject.toml`
- Add `Manifest.in`, `tox.ini`
- Replace `requirements.txt`/`dev-requirements.txt with `requirements.lock`
- Move from yapf to black code formatting
- Add more pre-commit hooks
- Update pylint version and fix new failures
- Drop python 3.6
  • Loading branch information
chrisjsewell committed Aug 28, 2021
1 parent a2561a4 commit a92c695
Show file tree
Hide file tree
Showing 51 changed files with 3,222 additions and 2,433 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r dev-requirements.txt
pip install -r requirements.lock
- name: Run benchmarks
run: pytest --benchmark-only --benchmark-json output.json
- name: Store benchmark result
Expand Down
17 changes: 4 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies (including dev dependencies at frozen version)
run: |
python -m pip install --upgrade pip
pip install .
pip install -r dev-requirements.txt
pip freeze
- name: Lint with pylint and prospector
run: |
# stop the build if there are Python syntax errors or undefined names
pre-commit run --all-files
- uses: pre-commit/action@v2.0.0

tests:

Expand All @@ -36,7 +27,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand All @@ -50,7 +41,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r dev-requirements.txt
pip install -r requirements.lock
- name: Test with pytest
# No need to run the benchmarks, they will run in a different workflow
# Also, run in very verbose mode so if there is an error we get a complete diff
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/concurrency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r dev-requirements.txt
pip install -r requirements.lock
- name: Test with pytest
# Run only the concurrency tests, and repeating them 5 times to increase the chance that, if there is an issue
# only happening rarely, we notice it
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ disk_objectstore.egg-info

htmlcov
.coverage
.tox/
101 changes: 74 additions & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,74 @@
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: trailing-whitespace
- id: double-quote-string-fixer

- repo: local
hooks:
- id: yapf
name: yapf
entry: yapf
language: system
types: [python]
args: ["-i"]
exclude: &exclude_files >
(?x)^(
performance-benchmarks/.*/.*\.py
)$

# prospector: collection of linters
- id: prospector
language: system
types: [file, python]
name: prospector
description: "This hook runs Prospector: https://github.com/landscapeio/prospector"
entry: prospector
exclude: *exclude_files
ci:
autoupdate_schedule: monthly
autofix_prs: true

exclude: &exclude_files >
(?x)^(
performance-benchmarks/.*/.*\.py
)$

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.17.0
hooks:
- id: setup-cfg-fmt

- repo: https://github.com/mgedmin/check-manifest
rev: "0.46"
hooks:
- id: check-manifest
args: [--no-build-isolation]
additional_dependencies: [setuptools>=46.4.0]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.9
hooks:
- id: mdformat
additional_dependencies:
- linkify-it-py
- mdformat-gfm
- mdformat-black
files: (?x)^(README\.md|CHANGELOG\.md)$

- repo: https://github.com/pycqa/isort
rev: 5.9.3
hooks:
- id: isort

- repo: https://github.com/asottile/pyupgrade
rev: v2.25.0
hooks:
- id: pyupgrade
args: [--py37-plus]

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

- repo: https://github.com/PyCQA/pylint
rev: v2.10.2
hooks:
- id: pylint
additional_dependencies:
- sqlalchemy<1.4
- click==8.0.1
- memory-profiler==0.58.0
- profilehooks==1.12.0
- psutil==5.8.0
- pytest==6.2.4

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.910
# hooks:
# - id: mypy
# additional_dependencies: []

0 comments on commit a92c695

Please sign in to comment.