Skip to content

Commit

Permalink
Merge branch 'feature/update'
Browse files Browse the repository at this point in the history
  • Loading branch information
miccoli committed Aug 26, 2024
2 parents 48015ac + af45d8c commit 876ec8b
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 96 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ env.BUILD_PYTHON_VERSION }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.BUILD_PYTHON_VERSION }}
- name: Install build dependencies
Expand All @@ -25,7 +25,7 @@ jobs:
python -m build
shasum dist/*
- name: Upload dist
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
Expand All @@ -40,14 +40,14 @@ jobs:
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Download dist
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install pytest dependencies
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
id-token: write
steps:
- name: Download dist
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: dist
path: dist
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: trailing-whitespace
Expand All @@ -9,7 +9,7 @@ repos:
- id: check-yaml
- id: check-toml
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.1.7'
rev: 'v0.6.2'
hooks:
- id: ruff
args: [ --fix ]
Expand Down
102 changes: 15 additions & 87 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,101 +32,26 @@ Documentation = "https://github.com/miccoli/trick17#readme"
Issues = "https://github.com/miccoli/trick17/issues"
Source = "https://github.com/miccoli/trick17"

#
# hatch
#
[tool.hatch.version]
path = "src/trick17/__about__.py"

[tool.hatch.envs.default]
dependencies = [
"coverage[toml]>=6.5",
installer = "uv"

[tool.hatch.envs.types]
extra-dependencies = [
"mypy>=1.0.0",
"pytest",
]
[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
test-cov = "coverage run -m pytest {args:tests}"
cov-report = [
"- coverage combine",
"coverage report",
]
cov = [
"test-cov",
"cov-report",
]
typing = "mypy --install-types --non-interactive {args:src/trick17 tests}"

[[tool.hatch.envs.all.matrix]]
python = ["3.10", "3.11", "3.12"]

[tool.hatch.envs.lint]
detached = true
dependencies = [
"ruff>=0.1.7",
]
[tool.hatch.envs.lint.scripts]
style = [
"ruff {args:.}",
]
fmt = [
"ruff format {args:.}",
"ruff --fix {args:.}",
"style",
]

[tool.ruff]
target-version = "py310"
line-length = 84
select = [
"A",
"ARG",
"B",
"C",
"DTZ",
"E",
"EM",
"F",
"FBT",
"I",
"ICN",
"ISC",
"N",
"PLC",
"PLE",
"PLR",
"PLW",
"Q",
"RUF",
"S",
"T",
"TID",
"UP",
"W",
"YTT",
]
ignore = [
# Hey, I KNOW how asserts should be used!
"S101", "B011",
# Ignore checks for possible passwords
"S105", "S106", "S107",
# Ignore complexity
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
# Avoid conflicts with ruff formatter
"ISC001",
]
unfixable = [
# Don't touch unused imports
"F401",
]

[tool.ruff.isort]
known-first-party = ["trick17"]

[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.ruff.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = ["PLR2004", "S101", "TID252"]
[tool.hatch.envs.types.scripts]
check = "mypy --install-types --non-interactive {args:src/trick17 tests}"

#
# coverage
#
[tool.coverage.run]
source_pkgs = ["trick17", "tests"]
branch = true
Expand All @@ -146,6 +71,9 @@ exclude_lines = [
"if TYPE_CHECKING:",
]

#
# pytest
#
[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
Expand Down
55 changes: 55 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
target-version = "py310"
line-length = 84

[lint]
select = [
"A",
"ARG",
"B",
"C",
"DTZ",
"E",
"EM",
"F",
"FBT",
"I",
"ICN",
"ISC",
"N",
"PLC",
"PLE",
"PLR",
"PLW",
"Q",
"RUF",
"S",
"T",
"TID",
"UP",
"W",
"YTT",
]
ignore = [
# Hey, I KNOW how asserts should be used!
"S101", "B011",
# Ignore checks for possible passwords
"S105", "S106", "S107",
# Ignore complexity
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
# Avoid conflicts with ruff formatter
"ISC001",
]
unfixable = [
# Don't touch unused imports
"F401",
]

[lint.isort]
known-first-party = ["trick17"]

[lint.flake8-tidy-imports]
ban-relative-imports = "all"

[lint.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = ["PLR2004", "S101", "TID252"]
4 changes: 4 additions & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

from trick17 import util

pytestmark = pytest.mark.skipif(
sys.platform != "linux", reason="tests for linux only"
)


def test_make_socket():
with util.make_socket() as sock:
Expand Down

0 comments on commit 876ec8b

Please sign in to comment.