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

Update project setup #7

Merged
merged 2 commits into from
May 13, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ jobs:
max-parallel: 4
matrix:
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand Down
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.ruff]
target-version = "py38"
line-length = 120

[tool.ruff.lint]
select = ["E", "W", "F", "C", "I", "D", "S", "UP", "B", "ISC", "G", "RSE"]
ignore = ["D105", "D106", "D107", "UP032"]

[tool.ruff.lint.per-file-ignores]
"tests.py" = ["D1", "S101", "S105", "S106", "S107", "B015", "B018"]

[tool.ruff.lint.isort]
combine-as-imports = true

[tool.ruff.lint.mccabe]
max-complexity = 10

[tool.ruff.lint.pycodestyle]
max-doc-length = 120

[tool.ruff.lint.pydocstyle]
convention = "google"
23 changes: 4 additions & 19 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ classifiers =
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Topic :: Software Development
Topic :: Software Development :: Debuggers
Topic :: Software Development :: Testing

[options]
py_modules =
tox_ipdb
python_requires = ~=3.7
python_requires = ~=3.8
install_requires =
tox>=3.0

Expand All @@ -36,25 +37,14 @@ tox =

[options.extras_require]
quality =
bandit
doc8
flake8
isort
mypy
pydocstyle
ruff

[doc8]
max-line-length = 120
allow-long-titles = true

[flake8]
max-line-length = 120
max-complexity = 10

[isort]
line_length = 120
combine_as_imports = true

[mypy]
ignore_missing_imports = true
disallow_untyped_defs = true
Expand All @@ -66,8 +56,3 @@ warn_unused_ignores = false

[mypy-tests]
disallow_untyped_defs = false

[pydocstyle]
convention = google
add_ignore = D105,D106,D107
add_select = D204,D400,D401
2 changes: 1 addition & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_other_env(self):
class ToxAddEnvConfigTest(TestCase):
def _test(self, env_name: str, initial_deps: str, result: List[str]) -> None:
root = Path(__file__).parent
source = IniSource(Path('/tmp/does/not/exist'), '') # nosec
source = IniSource(Path('/tmp/does/not/exist'), '') # noqa: S108
parsed = Parsed(override=(), root_dir=root, work_dir=root)
state = State(Options(parsed, None, source, sentinel.cmd_handlers, sentinel.tox_handler), [])

Expand Down
25 changes: 12 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
[tox]
isolated_build = true
minversion = 4.4.0
envlist =
clear-coverage
quality
py37-tox{3,414,4}
py38-tox{3,414,4}
py39-tox{3,414,4}
py310-tox{3,414,4}
py311-tox{3,414,4}
py312-tox{3,414,4}
compute-coverage
skip_missing_interpreters = true

[testenv]
depends = clear-coverage
setenv =
py37,py38,py39,py310: PYTHONWARNINGS = {env:PYTHONWARNINGS:all}
py38,py39,py310,py311,py312: PYTHONWARNINGS = {env:PYTHONWARNINGS:all}
deps =
coverage
tox3: tox == 3.*
tox414: tox == 4.*,<4.15
tox4: tox == 4.*
skip_install =
coverage: true
commands =
coverage run --parallel-mode --include=tox_ipdb.py,tests.py --branch -m unittest {posargs:discover}
constrain_package_deps = true
use_frozen_constraints = true

[testenv:clear-coverage]
depends =
# Use single virtualenv for both coverage envs.
envdir = {toxworkdir}/coverage
commands =
coverage erase

[testenv:compute-coverage]
depends =
py37-tox{3,414,4}
py38-tox{3,414,4}
py39-tox{3,414,4}
py310-tox{3,414,4}
# Use single virtualenv for both coverage envs.
envdir = {toxworkdir}/coverage
py311-tox{3,414,4}
py312-tox{3,414,4}
parallel_show_output = true
commands =
coverage combine
Expand All @@ -49,9 +51,6 @@ extras =
# Do not fail on first error, but run all the checks
ignore_errors = true
commands =
isort --check-only --diff tox_ipdb.py tests.py
flake8 --format=pylint --show-source tox_ipdb.py tests.py
bandit --recursive tox_ipdb.py tests.py
pydocstyle tox_ipdb.py
mypy --show-error-codes tox_ipdb.py tests.py
ruff check tox_ipdb.py tests.py
mypy tox_ipdb.py tests.py
doc8 CHANGELOG.rst README.rst
5 changes: 2 additions & 3 deletions tox_ipdb.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""Tox plugin which installs ipdb in tox environments."""
import logging
from distutils.version import LooseVersion

import tox

__version__ = '0.3'
_LOGGER = logging.getLogger(__name__)


if LooseVersion(tox.__version__) < LooseVersion('4.0.0'):
if tox.__version__ < '4':
# TOX 3
from tox import hookimpl # type: ignore[attr-defined]
from tox.action import Action
Expand Down Expand Up @@ -60,7 +59,7 @@ def tox_add_env_config(env_conf: EnvConfigSet, state: State) -> None:

override = Override('{}.deps={}'.format(env_conf.name, '\n'.join(new_deps)))
# API changed in tox 4.15.0
if LooseVersion(tox.__version__) < LooseVersion('4.15.0'):
if tox.__version__ < '4.15':
env_conf.loaders[0].overrides[override.key] = override # type: ignore[assignment]
else:
env_conf.loaders[0].overrides.setdefault(override.key, []).append(override)
Expand Down
Loading