-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from eriknw/pyproject_toml
Modernize to use pyproject.toml and pre-commit
- Loading branch information
Showing
18 changed files
with
416 additions
and
2,597 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[flake8] | ||
max-line-length = 100 | ||
inline-quotes = " | ||
exclude = | ||
build/ | ||
extend-ignore = | ||
E203, | ||
SIM105, | ||
SIM401, | ||
# E203 whitespace before ':' (to be compatible with black) | ||
per-file-ignores = | ||
__init__.py:F401 | ||
innerscope/tests/test_repr.py:E501,F821,F841 | ||
innerscope/tests/*.py:C408,C416,T201,E702,E703,F821,F841,W606 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Rely on pre-commit.ci | ||
name: Lint via pre-commit | ||
|
||
on: | ||
workflow_dispatch: | ||
# pull_request: | ||
# push: | ||
# branches-ignore: | ||
# - main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
pre-commit: | ||
name: pre-commit-hooks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- uses: pre-commit/action@v3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# https://pre-commit.com/ | ||
# | ||
# Before first use: `pre-commit install` | ||
# To run: `pre-commit run --all-files` | ||
# To update: `pre-commit autoupdate` | ||
# - &flake8_dependencies below needs updated manually | ||
# | ||
# Be careful about linting that rewrites code syntax we want to test. | ||
ci: | ||
# See: https://pre-commit.ci/#configuration | ||
autofix_prs: false | ||
autoupdate_schedule: quarterly | ||
skip: [no-commit-to-branch] | ||
fail_fast: true | ||
default_language_version: | ||
python: python3 | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-merge-conflict | ||
# - id: check-symlinks | ||
- id: check-ast | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
exclude_types: [svg] | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
- id: name-tests-test | ||
args: ["--pytest-test-first"] | ||
- repo: https://github.com/abravalheri/validate-pyproject | ||
rev: v0.13 | ||
hooks: | ||
- id: validate-pyproject | ||
name: Validate pyproject.toml | ||
# I don't yet trust ruff to do what autoflake does | ||
- repo: https://github.com/PyCQA/autoflake | ||
rev: v2.1.1 | ||
hooks: | ||
- id: autoflake | ||
args: [--in-place] | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.6.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py38-plus] | ||
- repo: https://github.com/psf/black | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
# - id: black-jupyter | ||
# - repo: https://github.com/charliermarsh/ruff-pre-commit | ||
# rev: v0.0.272 | ||
# hooks: | ||
# - id: ruff | ||
# args: [--fix-only, --show-fixes] | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 6.0.0 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: &flake8_dependencies | ||
# These versions need updated manually | ||
- flake8==6.0.0 | ||
- flake8-comprehensions==3.12.0 | ||
- flake8-bugbear==23.6.5 | ||
- flake8-simplify==0.20.0 | ||
- repo: https://github.com/asottile/yesqa | ||
rev: v1.5.0 | ||
hooks: | ||
- id: yesqa | ||
additional_dependencies: *flake8_dependencies | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.2.4 | ||
hooks: | ||
- id: codespell | ||
types_or: [python, rst, markdown] | ||
additional_dependencies: [tomli] | ||
files: ^(innerscope|docs)/ | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.0.272 | ||
hooks: | ||
- id: ruff | ||
# `pyroma` may help keep our package standards up to date if best practices change. | ||
# This is probably a "low value" check though and safe to remove if we want faster pre-commit. | ||
- repo: https://github.com/regebro/pyroma | ||
rev: "4.2" | ||
hooks: | ||
- id: pyroma | ||
args: [-n, "10", .] | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: no-commit-to-branch # no commit directly to main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
recursive-include innerscope *.py | ||
include setup.py | ||
include conftest.py | ||
include README.md | ||
include LICENSE | ||
include MANIFEST.in | ||
include versioneer.py | ||
include innerscope/_version.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
from ._version import get_versions | ||
from .core import bindwith, call, callwith, scoped_function # noqa | ||
import importlib.metadata | ||
|
||
__version__ = get_versions()["version"] | ||
del get_versions | ||
from .core import bindwith, call, callwith, scoped_function | ||
|
||
try: | ||
__version__ = importlib.metadata.version("innerscope") | ||
except Exception as exc: # pragma: no cover (safety) | ||
raise AttributeError( | ||
"`innerscope.__version__` not available. This may mean " | ||
"innerscope was incorrectly installed or not installed at all. " | ||
"For local development, you may want to do an editable install via " | ||
"`python -m pip install -e path/to/innerscope`" | ||
) from exc | ||
del importlib |
Oops, something went wrong.