Skip to content

Commit 54ca7af

Browse files
committed
V6.0.2
1 parent 685035e commit 54ca7af

20 files changed

Lines changed: 355 additions & 221 deletions

.github/PULL_REQUEST_TEMPLATE

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<!-- What is this pull request for? Does it fix any issues? -->
44

55
## Checklist
6-
- [ ] If code changes were made, then they have been tested.
7-
- [ ] I have updated the documentation to reflect the changes.
8-
- [ ] I have thought about how this code may affect other services.
9-
- [ ] This PR fixes an issue.
10-
- [ ] This PR add/remove/change unit tests.
11-
- [ ] This PR adds something new (e.g. new method or parameters).
12-
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
13-
- [ ] This PR is **not** a code change (e.g. documentation, README, ...)
6+
- [ ] If code changes were made, then they have been tested
7+
- [ ] I have updated the documentation to reflect any changes made
8+
- [ ] I have thought about how this code may affect other services
9+
- [ ] This PR fixes an issue
10+
- [ ] This PR is a breaking change (e.g. method, parameters, env variables)
11+
- [ ] This PR adds something new (e.g. method, parameters, env variables)
12+
- [ ] This PR change unit and integration tests
13+
- [ ] This PR is **NOT** a code change (e.g. documentation, packages)
1414

1515
## Reviewer
16-
- [ ] I understand that approving this code, I am also responsible for it going into the codebase.
16+
- [ ] I understand that approving this code, I am also responsible for it going into the codebase

.github/workflows/workflow.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,30 @@ name: CI/CD Pipeline
55
branches: ['**']
66
tags: ['v*']
77

8+
env:
9+
LATEST_PYTHON_VERSION: '3.14'
810

911
jobs:
12+
lint:
13+
name: Lint (ruff)
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v6
17+
- uses: astral-sh/ruff-action@v3
18+
with:
19+
args: "check"
20+
- uses: astral-sh/ruff-action@v3
21+
with:
22+
args: "format --check"
23+
1024
test:
1125
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
1226
runs-on: ${{ matrix.os }}
1327
strategy:
1428
fail-fast: false
1529
matrix:
1630
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
17-
python-version: ['3.12', '3.13', '3.14']
31+
python-version: ['3.11', '3.14']
1832
defaults:
1933
run:
2034
working-directory: ${{ github.workspace }}
@@ -28,7 +42,7 @@ jobs:
2842
run: uv python install ${{ matrix.python-version }}
2943

3044
- name: Install dependencies
31-
run: uv sync --group test
45+
run: uv sync --group dev
3246
shell: bash
3347

3448
- name: Run tests with coverage
@@ -40,29 +54,28 @@ jobs:
4054
shell: bash
4155

4256
- name: Upload coverage to Codecov
43-
if: matrix.python-version == '3.14' && matrix.os == 'ubuntu-latest'
57+
if: matrix.python-version == env.LATEST_PYTHON_VERSION && matrix.os == 'ubuntu-latest'
4458
uses: codecov/codecov-action@v5
4559

4660
- name: Upload test results to Codecov
47-
if: matrix.python-version == '3.14' && matrix.os == 'ubuntu-latest'
61+
if: matrix.python-version == env.LATEST_PYTHON_VERSION && matrix.os == 'ubuntu-latest'
4862
uses: codecov/codecov-action@v5
4963
with:
5064
report_type: test_results
5165

52-
5366
build:
54-
name: Build package
67+
name: Build Package
5568
runs-on: ubuntu-latest
56-
needs: [test]
69+
needs: [lint, test]
5770
if: startsWith(github.ref, 'refs/tags/v')
5871
steps:
5972
- uses: actions/checkout@v6
6073

6174
- name: Install uv
6275
uses: astral-sh/setup-uv@v7
6376

64-
- name: Set up Python 3.14
65-
run: uv python install 3.14
77+
- name: Set up Python ${{ env.LATEST_PYTHON_VERSION }}
78+
run: uv python install ${{ env.LATEST_PYTHON_VERSION }}
6679

6780
- name: Build package
6881
run: uv build
@@ -74,11 +87,10 @@ jobs:
7487
path: dist/
7588
retention-days: 7
7689

77-
7890
release:
7991
name: Create Release
8092
runs-on: ubuntu-latest
81-
needs: [build]
93+
needs: build
8294
if: startsWith(github.ref, 'refs/tags/v')
8395
permissions:
8496
contents: write

pyproject.toml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,31 @@
22
requires = ["hatchling"]
33
build-backend = "hatchling.build"
44

5+
[tool.hatch.metadata]
6+
allow-direct-references = true
7+
8+
[tool.hatch.build]
9+
include = ["pythonLogs/**/*"]
10+
11+
[tool.hatch.build.targets.wheel]
12+
packages = ["pythonLogs"]
13+
514
[project]
615
name = "pythonLogs"
716
version = "6.0.2"
817
description = "High-performance Python logging library with file rotation and optimized caching for better performance"
9-
license = {text = "MIT"}
10-
readme = "README.md"
11-
authors = [{name = "Daniel Costa", email = "danieldcsta@gmail.com"}]
12-
maintainers = [{name = "Daniel Costa"}]
1318
urls.Repository = "https://github.com/ddc/pythonLogs"
1419
urls.Homepage = "https://pypi.org/project/pythonLogs"
20+
license = {text = "MIT"}
21+
readme = "README.md"
22+
authors = [
23+
{name = "Daniel Costa", email = "danieldcsta@gmail.com"},
24+
]
25+
maintainers = [
26+
{name = "Daniel Costa"},
27+
]
1528
keywords = [
16-
"python3", "python-3", "python",
29+
"python", "python3", "python-3",
1730
"log", "logging", "logger",
1831
"logutils", "log-utils", "pythonLogs"
1932
]
@@ -22,6 +35,7 @@ classifiers = [
2235
"Development Status :: 5 - Production/Stable",
2336
"License :: OSI Approved :: MIT License",
2437
"Programming Language :: Python :: 3",
38+
"Programming Language :: Python :: 3.11",
2539
"Programming Language :: Python :: 3.12",
2640
"Programming Language :: Python :: 3.13",
2741
"Programming Language :: Python :: 3.14",
@@ -30,54 +44,46 @@ classifiers = [
3044
"Intended Audience :: Developers",
3145
"Natural Language :: English",
3246
]
33-
requires-python = ">=3.12"
47+
requires-python = ">=3.11"
3448
dependencies = [
3549
"pydantic-settings>=2.11.0",
3650
]
3751

3852
[dependency-groups]
39-
test = [
53+
dev = [
4054
"psutil>=7.2.2",
4155
"pytest>=9.0.2",
42-
"coverage>=7.13.3",
4356
"pytest-cov>=7.0.0",
44-
]
45-
dev = [
46-
{include-group = "test"},
57+
"coverage>=7.13.3",
4758
"black>=26.1.0",
4859
"poethepoet>=0.40.0",
4960
"ruff>=0.15.0",
5061
]
5162

52-
[tool.hatch.build]
53-
include = ["pythonLogs/**/*"]
54-
55-
[tool.hatch.build.targets.wheel]
56-
packages = ["pythonLogs"]
57-
5863
[tool.poe.tasks]
59-
build = "uv build --wheel"
60-
updatedev.shell = "uv lock && uv sync --no-install-project --all-groups"
6164
linter.shell = "uv run ruff check --fix . && uv run black ."
62-
profile = "uv run python -m cProfile -o cprofile.prof -m pytest"
65+
profile = "uv run python -m cProfile -o cprofile_unit.prof -m pytest --no-cov"
6366
test = "uv run pytest"
67+
updatedev.sequence = ["linter", {shell = "uv lock && uv sync --all-extras --group dev"}]
68+
build.sequence = ["updatedev", {shell = "uv build --wheel"}]
6469

6570
[tool.pytest.ini_options]
6671
addopts = "-v --cov --cov-report=term --cov-report=xml --junitxml=junit.xml"
6772
junit_family = "legacy"
6873
testpaths = ["tests"]
6974
markers = [
70-
"slow: marks tests as slow (deselect with '-m \"not slow\"')"
75+
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
7176
]
7277

7378
[tool.coverage.run]
7479
omit = [
7580
"tests/*",
7681
"*/__init__.py",
77-
"*/_version.py",
7882
]
7983

8084
[tool.coverage.report]
85+
show_missing = true
86+
skip_covered = false
8187
exclude_lines = [
8288
"pragma: no cover",
8389
"def __repr__",
@@ -90,31 +96,25 @@ exclude_lines = [
9096
"class .*\\bProtocol\\):",
9197
"@(abc\\.)?abstractmethod",
9298
]
93-
show_missing = true
94-
skip_covered = false
9599

96100
[tool.black]
97101
line-length = 120
98102
skip-string-normalization = true
99103

100104
[tool.ruff]
101105
line-length = 120
106+
target-version = "py311"
102107

103108
[tool.ruff.lint]
104-
# I - Import sorting and organization
105-
# F401 - Detect and remove unused imports
106-
select = ["I", "F401"]
109+
select = ["E", "W", "F", "I", "B", "C4", "UP"]
110+
ignore = ["E501", "E402", "UP046", "UP047"]
111+
112+
[tool.ruff.lint.per-file-ignores]
113+
"__init__.py" = ["F401"]
114+
"tests/**/*.py" = ["S101", "S105", "S106", "S311", "SLF001", "F841"]
107115

108116
[tool.ruff.lint.isort]
109117
known-first-party = ["pythonLogs"]
110118
force-sort-within-sections = false
111119
from-first = false
112120
no-sections = true
113-
114-
[tool.ruff.lint.per-file-ignores]
115-
# S101 Use of `assert` detected
116-
# S105 Possible hardcoded password assigned to variable
117-
# S106 Possible hardcoded password assigned to argument
118-
# S311 Standard pseudo-random generators are not suitable for cryptographic purposes
119-
# SLF001 Private member accessed
120-
"tests/**/*.py" = ["S101", "S105", "S106", "S311", "SLF001"]

pythonLogs/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ LOG_STREAM_HANDLER=True
1515
LOG_SHOW_LOCATION=False
1616
# Memory Management Settings
1717
LOG_MAX_LOGGERS=50
18+
LOG_MAX_FORMATTERS=50
1819
LOG_LOGGER_TTL_SECONDS=1800
1920

2021
# SizeRotatingLog Settings (only needed when using SizeRotatingLog)

pythonLogs/core/constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from enum import Enum
2+
from enum import StrEnum
33

44
# File and Directory Constants
55
MB_TO_BYTES = 1024 * 1024
@@ -17,7 +17,7 @@
1717
DEFAULT_TIMEZONE = "UTC"
1818

1919

20-
class LogLevel(str, Enum):
20+
class LogLevel(StrEnum):
2121
"""Log levels"""
2222

2323
CRITICAL = "CRITICAL"
@@ -29,7 +29,7 @@ class LogLevel(str, Enum):
2929
DEBUG = "DEBUG"
3030

3131

32-
class RotateWhen(str, Enum):
32+
class RotateWhen(StrEnum):
3333
"""Rotation timing options for TimedRotatingLog"""
3434

3535
MIDNIGHT = "midnight"

0 commit comments

Comments
 (0)