Skip to content

Commit e29b636

Browse files
committed
Updates to use pyproject.toml, fixing up actions, etc
1 parent 874188b commit e29b636

16 files changed

+264
-236
lines changed

.github/dependabot.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#package-ecosystem
2+
3+
version: 2
4+
updates:
5+
6+
# Enable updates for Github Actions
7+
- package-ecosystem: "github-actions"
8+
target-branch: "develop"
9+
directory: "/"
10+
schedule:
11+
# Check for updates to GitHub Actions every month
12+
interval: "monthly"
13+
labels:
14+
- "dependencies"

.github/workflows/clh_tests.yaml

+54-34
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,69 @@ on:
99
- master # or the name of your primary branch
1010

1111
jobs:
12-
build:
12+
lint:
13+
name: Lint
1314
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set up Python 3.10
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.10"
21+
cache: "pip"
22+
- name: Install Hatch
23+
run: |
24+
pip3 install --upgrade hatch
25+
- name: Run linting
26+
run: |
27+
hatch run lint:style
28+
29+
test:
30+
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
31+
needs:
32+
- lint
33+
runs-on: ${{ matrix.os }}
1434
strategy:
1535
matrix:
16-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
17-
18-
36+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
37+
os: [ubuntu-latest]
38+
include:
39+
- python-version: "3.11"
40+
os: windows-latest
1941
steps:
20-
- uses: actions/checkout@v3
42+
- uses: actions/checkout@v4
2143
- name: Set up Python ${{ matrix.python-version }}
2244
uses: actions/setup-python@v4
2345
with:
2446
python-version: ${{ matrix.python-version }}
25-
# - name: Install dependencies
26-
# run: |
27-
# python -m pip install --upgrade pip
28-
# pip install ruff pytest
29-
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30-
# - name: Lint with ruff
31-
# run: |
32-
# # stop the build if there are Python syntax errors or undefined names
33-
# ruff --format=github --select=E9,F63,F7,F82 --target-version=py37 .
34-
# # default set of ruff rules with GitHub Annotations
35-
# ruff --format=github --target-version=py37 .
36-
# - name: Test with pytest
37-
# run: |
38-
# pytest
39-
40-
- name: Install dependencies
47+
cache: pip
48+
- name: Install Hatch
4149
run: |
42-
python -m pip install --upgrade pip
43-
pip install -e .[dev] ruff
44-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
45-
- name: Lint with ruff
50+
pip3 install --upgrade hatch
51+
- name: Run tests
4652
run: |
47-
# stop the build if there are Python syntax errors or undefined names
48-
ruff --format=github --select=E9,F63,F7,F82 --target-version=py37 .
49-
# default set of ruff rules with GitHub Annotations
50-
ruff --format=github --config ruff.toml --target-version=py37 .
51-
- name: Test with pytest
53+
hatch run test.py${{ matrix.python-version }}:cov
54+
build:
55+
runs-on: ubuntu-latest
56+
needs:
57+
- lint
58+
steps:
59+
- uses: actions/checkout@v4
60+
- name: Set up Python 3.10
61+
uses: actions/setup-python@v4
62+
with:
63+
python-version: "3.10"
64+
cache: pip
65+
- name: Install Hatch
5266
run: |
53-
pytest
54-
# - name: Test with tox
55-
# run: |
56-
# tox
67+
pip3 install --upgrade hatch
68+
- name: Build
69+
run: |
70+
hatch build --clean
71+
- uses: actions/upload-artifact@v3
72+
with:
73+
name: artifacts
74+
path: dist/*
75+
if-no-files-found: error
76+
retention-days: 7
5777

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ env37
1616
.__*.lock
1717
stress_test.log*
1818
.eggs
19+
.coverage
20+
coverage.json

pyproject.toml

+188
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "concurrent-log-handler"
7+
dynamic = ["version"]
8+
description = "RotatingFileHandler replacement with concurrency, gzip and Windows support"
9+
readme = "README.md"
10+
license = "Apache-2.0"
11+
requires-python = ">=3.6"
12+
authors = [
13+
{ name = "Preston Landers", email = "[email protected]" },
14+
]
15+
keywords = [
16+
"QueueHandler",
17+
"QueueListener",
18+
"linux",
19+
"logging",
20+
"portalocker",
21+
"rotate",
22+
"unix",
23+
"windows",
24+
]
25+
classifiers = [
26+
"Development Status :: 4 - Beta",
27+
"License :: OSI Approved :: Apache Software License",
28+
"Operating System :: Microsoft :: Windows",
29+
"Operating System :: POSIX",
30+
"Programming Language :: Python",
31+
"Programming Language :: Python :: 3",
32+
"Programming Language :: Python :: 3.6",
33+
"Programming Language :: Python :: 3.7",
34+
"Programming Language :: Python :: 3.8",
35+
"Programming Language :: Python :: 3.9",
36+
"Programming Language :: Python :: 3.10",
37+
"Programming Language :: Python :: 3.11",
38+
"Programming Language :: Python :: 3.12",
39+
"Topic :: Software Development :: Libraries :: Python Modules",
40+
"Topic :: System :: Logging",
41+
]
42+
dependencies = [
43+
"portalocker>=1.6.0",
44+
]
45+
46+
[project.urls]
47+
Homepage = "https://github.com/Preston-Landers/concurrent-log-handler"
48+
49+
[tool.hatch.version]
50+
path = "src/concurrent_log_handler/__version__.py"
51+
52+
[tool.hatch.build.targets.sdist]
53+
include = [
54+
"/src",
55+
]
56+
57+
[tool.hatch.envs.test]
58+
dependencies = [
59+
"coverage[toml] >= 7.2",
60+
"pytest >= 7.4",
61+
"pytest-sugar",
62+
]
63+
64+
[tool.hatch.envs.test.scripts]
65+
version = "python3 --version"
66+
pip-list = "pip list"
67+
test = "pytest {args:tests}"
68+
test-cov = "coverage run -m pytest {args:tests}"
69+
cov-clear = "coverage erase"
70+
cov-report = [
71+
"- coverage combine",
72+
"coverage report",
73+
]
74+
cov-html = "coverage html"
75+
cov-json = "coverage json"
76+
cov = [
77+
"version",
78+
"pip-list",
79+
"cov-clear",
80+
"test-cov",
81+
"cov-report",
82+
"cov-json",
83+
"cov-html"
84+
]
85+
86+
[[tool.hatch.envs.test.matrix]]
87+
python = ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
88+
89+
[tool.hatch.envs.lint]
90+
detached = true
91+
dependencies = [
92+
"black>=23.9.1",
93+
"mypy>=1.6.0",
94+
"ruff>=0.1.0",
95+
]
96+
97+
[tool.hatch.envs.lint.scripts]
98+
style = [
99+
"ruff {args:.}",
100+
"black --check --diff {args:.}",
101+
]
102+
fmt = [
103+
"black {args:.}",
104+
"ruff {args:.}",
105+
"style",
106+
]
107+
108+
[tool.ruff]
109+
output-format = "grouped"
110+
target-version = "py37"
111+
fix = true
112+
ignore = [
113+
# Never enforce `E501` (line length violations).
114+
"E501",
115+
"D415", # First line of docstring should end with a period
116+
"COM812", # missing trailing comma in Python 3.5+
117+
"UP008", # use of super(class, self) - probably can re-apply this at some point
118+
"SIM115", # Use context handler for open()
119+
"PLR1711", # useless return stmt
120+
"EM101", # use of string literal in exception
121+
"EM102", # using f-string in exception literal
122+
"T201", # use of print
123+
"SLF001", # access to _ private members
124+
"EXE001", # executable bit set (might want to revisit the ignore)
125+
]
126+
127+
select = [
128+
"E", # pycodestyle Errors - https://docs.astral.sh/ruff/rules/#error-e
129+
"W", # pycodestyle Warnings - https://docs.astral.sh/ruff/rules/#warning-w
130+
"F", # Pyflakes - https://docs.astral.sh/ruff/rules/#pyflakes-f
131+
"C90", # McCabe complexity - https://docs.astral.sh/ruff/rules/#mccabe-c90
132+
"I", # import sorting - https://docs.astral.sh/ruff/rules/#isort-i
133+
# "D", # pydoc style - https://docs.astral.sh/ruff/rules/#pydocstyle-d
134+
# "UP", # python upgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up
135+
"YTT", # sys.version misused - https://docs.astral.sh/ruff/rules/#flake8-2020-ytt
136+
137+
# "ANN", # annotations - https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
138+
"S", # flake8 bandit - https://docs.astral.sh/ruff/rules/#flake8-bandit-s
139+
# "BLE", # blind exceptions - https://docs.astral.sh/ruff/rules/#flake8-blind-except-ble
140+
141+
# "FBT", # boolean trap - https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt
142+
"B", # bugbear - https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
143+
"A", # flake8 builtins - https://docs.astral.sh/ruff/rules/#flake8-builtins-a
144+
"COM", # flake8 commas - https://docs.astral.sh/ruff/rules/#flake8-commas-com
145+
"C4", # flake8 comprehensions - https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
146+
"DTZ", # flake8 datetime - https://docs.astral.sh/ruff/rules/#flake8-datetime-dtz
147+
"EM", # flake8 error messages - https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
148+
"EXE", # flake8 executables https://docs.astral.sh/ruff/rules/#flake8-executable-exe
149+
"ISC", # implicit string concat https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc
150+
"ICN", # import conventions - https://docs.astral.sh/ruff/rules/#flake8-import-conventions-icn
151+
"G", # flake8 logging - https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
152+
"INP", # https://docs.astral.sh/ruff/rules/#flake8-no-pep420-inp
153+
"PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie
154+
"T20", # https://docs.astral.sh/ruff/rules/#flake8-print-t20
155+
"PYI", # https://docs.astral.sh/ruff/rules/#flake8-pyi-pyi
156+
"PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
157+
"Q", # https://docs.astral.sh/ruff/rules/#flake8-quotes-q
158+
"RSE", # https://docs.astral.sh/ruff/rules/#flake8-raise-rse
159+
"RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret
160+
"SLF", # https://docs.astral.sh/ruff/rules/#flake8-self-slf
161+
"SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
162+
"TID", # https://docs.astral.sh/ruff/rules/#flake8-tidy-imports-tid
163+
"TCH", # https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch
164+
"INT", # https://docs.astral.sh/ruff/rules/#flake8-gettext-int
165+
"ARG", # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg
166+
# "PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
167+
# "ERA", # https://docs.astral.sh/ruff/rules/#eradicate-era
168+
"PD", # https://docs.astral.sh/ruff/rules/#pandas-vet-pd
169+
"PGH", # https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
170+
171+
# Pylint
172+
"PLC", # https://docs.astral.sh/ruff/rules/#convention-plc
173+
"PLE", # https://docs.astral.sh/ruff/rules/#error-ple
174+
"PLR", # https://docs.astral.sh/ruff/rules/#refactor-plr
175+
"PLW", # https://docs.astral.sh/ruff/rules/#warning-plw
176+
177+
# "TRY", # https://docs.astral.sh/ruff/rules/#tryceratops-try
178+
"NPY", # https://docs.astral.sh/ruff/rules/#numpy-specific-rules-npy
179+
"RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
180+
]
181+
182+
[tool.pytest.ini_options]
183+
testpaths =["tests"]
184+
185+
[tool.coverage.run]
186+
omit = [
187+
"tests/stresstest.py"
188+
]

pytest.ini

-2
This file was deleted.

ruff.toml

-72
This file was deleted.

setup.cfg

-7
This file was deleted.

0 commit comments

Comments
 (0)