Skip to content

Commit

Permalink
[PATCH] Ruff and Tox rule updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Diapolo10 committed Oct 28, 2023
1 parent 5f5227d commit d94d773
Show file tree
Hide file tree
Showing 20 changed files with 400 additions and 398 deletions.
46 changes: 17 additions & 29 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,29 @@

name: Unit tests

on:
push:
branches:
- main
pull_request:
workflow_dispatch:
on: [ push, pull_request ]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
tox-env: [
py39,
py310,
py311,
pypy3
python-version: [
'3.9',
'3.10',
'3.11',
# 'pypy-3.10'
]
include:
- tox-env: py39
python-version: '3.9'
- tox-env: py310
python-version: '3.10'
- tox-env: py311
python-version: '3.11'
- tox-env: pypy3
python-version: pypy-3.9

exclude:
- os: windows-latest
tox-env: pypy3
- os: macos-latest
tox-env: pypy3

# exclude:
# - os: windows-latest
# python-version: 'pypy-3.10'
# - os: macos-latest
# python-version: 'pypy-3.10'

env:
TOXENV: ${{ matrix.tox-env }}
PYTHON_VERSION: ${{ matrix.python-version }}

steps:

Expand All @@ -67,16 +54,17 @@ jobs:
poetry run tox
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.os }}

- name: Upload Results to CodeCov
if: success()
uses: codecov/codecov-action@v3
with:
env_vars: TOXENV
env_vars: PYTHON_VERSION
fail_ci_if_error: false
files: ./tests/reports/coverage-html/index.html,./tests/reports/coverage.xml
flags: unittests
name: ${{ matrix.os }}-${{ matrix.tox-env }}
name: "${{ matrix.os }} - Python ${{ matrix.python-version }}"
token: ${{ secrets.CODECOV_TOKEN }}


Expand Down
142 changes: 71 additions & 71 deletions poetry.lock

Large diffs are not rendered by default.

228 changes: 125 additions & 103 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,99 +1,103 @@
[build-system]
requires = ['poetry-core>=1.2.0', 'wheel',]
build-backend = 'poetry.core.masonry.api'
requires = ["poetry-core>=1.2.0", "wheel",]
build-backend = "poetry.core.masonry.api"


[tool.coverage.run]
branch = true
relative_files = true
omit = [
'.tox/*',
'tests/*',
".tox/*",
"tests/*",
]


[tool.coverage.report]
exclude_lines = [
'pragma: not covered',
'@overload',
'if TYPE_CHECKING:',
"pragma: not covered",
"@overload",
"if TYPE_CHECKING:",
]


[tool.poetry]
name = 'iplib3'
version = '0.2.4'
name = "iplib3"
version = "0.2.4"
description = "A modern, object-oriented approach to IP addresses."

packages = [
{ include = "iplib3", from = "src" },
]

authors = ["Lari Liuhamo <lari.liuhamo+pypi@gmail.com>",]
maintainers = ["Lari Liuhamo <lari.liuhamo+pypi@gmail.com>",]

include = ['CHANGELOG.md', 'LICENSE', 'py.typed',]
license = 'MIT'
readme = 'README.md'
include = ["CHANGELOG.md", "LICENSE", "py.typed",]
license = "MIT"
readme = "README.md"

homepage = 'https://pypi.org/project/iplib3/'
repository = 'https://github.com/Diapolo10/iplib3'
documentation = 'https://github.com/Diapolo10/iplib3/tree/main/docs'
homepage = "https://pypi.org/project/iplib3/"
repository = "https://github.com/Diapolo10/iplib3"
documentation = "https://github.com/Diapolo10/iplib3/tree/main/docs"

keywords = [
'network',
'networking',
'ip',
'ipaddress',
'address',
'python3',
'pathlib',
"network",
"networking",
"ip",
"ipaddress",
"address",
"python3",
"pathlib",
]
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Internet',
'Topic :: Software Development :: Libraries',
'Typing :: Typed',
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet",
"Topic :: Software Development :: Libraries",
"Typing :: Typed",
]


[tool.poetry.dependencies]
python = '^3.9.0'
python = "^3.9.0"


[tool.poetry.group.dev.dependencies]
mypy = '^1.5.1'
mypy = "^1.6.1"


[tool.poetry.group.linters]
optional = true


[tool.poetry.group.linters.dependencies]
ruff = '>=0.0.290,<0.1.3'
ruff = "^0.1.3"


[tool.poetry.group.tests]
optional = true


[tool.poetry.group.tests.dependencies]
pytest = '^7.4.2'
pytest-cov = '^4.1.0'
tox = '^4.11.3'
tox-gh-actions = '^3.1.3'
pytest = "^7.4.3"
pytest-cov = "^4.1.0"
tox = "^4.11.3"
tox-gh-actions = "^3.1.3"


[tool.poetry.urls]
"Source code" = 'https://github.com/Diapolo10/iplib3'
"Tracker" = 'https://github.com/Diapolo10/iplib3/issues'
"Changelog" = 'https://github.com/Diapolo10/iplib3/blob/main/CHANGELOG.md'
"Source code" = "https://github.com/Diapolo10/iplib3"
"Tracker" = "https://github.com/Diapolo10/iplib3/issues"
"Changelog" = "https://github.com/Diapolo10/iplib3/blob/main/CHANGELOG.md"


[tool.pytest.ini_options]
Expand All @@ -107,66 +111,92 @@ addopts = """
--ignore=docs/
"""
testpaths = [
'tests',
"tests",
]


[tool.ruff]
select = [
'A', # Builtins
'ANN', # Annotations
'ARG', # Unused arguments
'B', # Bugbear
'BLE', # Blind except
'C4', # Comprehensions
'C90', # mccabe
'COM', # Commas
'DTZ', # Datetimes
'ERA', # Commented-out code
'EXE', # Executable
'G', # Logging format
'I', # Isort
'ICN', # Import conventions
'INP', # Disallow PEP-420 (Implicit namespace packages)
'INT', # gettext
'ISC', # Implicit str concat
'N', # PEP-8 Naming
'NPY', # Numpy
'PGH', # Pygrep hooks
'PIE', # Unnecessary code
'PL', # Pylint
'PT', # Pytest
'PTH', # Use Pathlib
'PYI', # Stub files
'RET', # Return
'RUF', # Ruff
'RSE', # Raise
'S', # Bandit
'SIM', # Code simplification
'SLF', # Private member access
'T20', # Print
'TCH', # Type checking
'TID', # Tidy imports
'UP', # Pyupgrade
'W', # Warnings
'YTT', # sys.version
"A", # Builtins
"ANN", # Annotations
"ARG", # Unused arguments
"B", # Bugbear
"BLE", # Blind except
"C4", # Comprehensions
"C90", # mccabe
"COM", # Commas
"D1", # Undocumented public elements
"D2", # Docstring conventions
"D3", # Triple double quotes
"D4", # Docstring text format
"DTZ", # Datetimes
"EM", # Error messages
"ERA", # Commented-out code
"EXE", # Executable
"F", # Pyflakes
"FA", # __future__ annotations
"FLY", # F-strings
# "FURB", # Refurb
"G", # Logging format
"I", # Isort
"ICN", # Import conventions
"INP", # Disallow PEP-420 (Implicit namespace packages)
"INT", # gettext
"ISC", # Implicit str concat
# "LOG", # Logging
"N", # PEP-8 Naming
"NPY", # Numpy
"PERF", # Unnecessary performance costs
"PGH", # Pygrep hooks
"PIE", # Unnecessary code
"PL", # Pylint
"PT", # Pytest
"PTH", # Use Pathlib
"PYI", # Stub files
"Q", # Quotes
"RET", # Return
"RUF", # Ruff
"RSE", # Raise
"S", # Bandit
"SIM", # Code simplification
"SLF", # Private member access
"SLOT", # __slots__
"T10", # Debugger
"T20", # Print
"TCH", # Type checking
"TID", # Tidy imports
"TRY", # Exception handling
"UP", # Pyupgrade
"W", # Warnings
"YTT", # sys.version
]
ignore = [
'PLR0913', # Too many arguments
"D203", # One blank line before class docstring
"D212", # Multi-line summary first line
"PLR0913", # Too many arguments
"Q000", # Single quotes found but double quotes preferred
]
ignore-init-module-imports = true
line-length = 120
# preview = true
show-fixes = true
src = ["src",]
target-version = "py39"


[tool.ruff.flake8-quotes]
docstring-quotes = "double"
multiline-quotes = "double"


[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10


[tool.ruff.per-file-ignores]
# https://beta.ruff.rs/docs/rules/
'__init__.py' = ['F401','F403','F405',]
'tests/*' = ['ANN', 'ARG', 'INP001', 'S101',]
"__init__.py" = ["F401", "F403", "F405",]
"tests/*" = ["ANN", "ARG", "INP001", "S101",]


[tool.ruff.pylint]
Expand All @@ -183,30 +213,22 @@ ban-relative-imports = "all"
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py39, py310, py311, pypy3
envlist = py39, py310, py311, py312, pypy3
isolated_build = True
[gh-actions]
python =
3.9: py39
3.10: py310
3.11: py311
pypy-3.9: pypy3
[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
macos-latest: macos
windows-latest: windows
3.12: py312
pypy-3.10: pypy3
[testenv]
passenv = GITHUB_*
deps =
coverage
coveralls[toml]
pytest
pytest-cov
wheel
allowlist_externals = poetry
commands =
coverage run -m pytest
poetry run pytest
poetry run coverage report
"""
Loading

0 comments on commit d94d773

Please sign in to comment.