Skip to content

Commit 3af0d28

Browse files
committed
V4.0.7
1 parent 811f412 commit 3af0d28

File tree

6 files changed

+160
-104
lines changed

6 files changed

+160
-104
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: ["3.10", "3.11", "3.12", "3.13"]
15+
python-version: ["3.12", "3.13"]
1616
steps:
1717
- uses: actions/checkout@v4
1818

.github/workflows/workflow.yml

Lines changed: 59 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ on:
77

88

99
jobs:
10-
release:
11-
name: Build and Release
10+
build:
11+
name: Build for Python ${{ matrix.python-version }}
1212
runs-on: ubuntu-latest
1313
if: startsWith(github.ref, 'refs/tags/v')
14-
permissions:
15-
contents: write
14+
strategy:
15+
matrix:
16+
python-version: ["3.12", "3.13"]
1617
steps:
1718
- uses: actions/checkout@v4
1819

19-
- name: Set up Python
20+
- name: Set up Python ${{ matrix.python-version }}
2021
uses: actions/setup-python@v5
2122
with:
22-
python-version: "3.13"
23+
python-version: ${{ matrix.python-version }}
2324

2425
- name: Install Poetry
2526
uses: snok/install-poetry@v1
@@ -30,25 +31,67 @@ jobs:
3031
- name: Install build dependencies only
3132
run: poetry install --only main --no-interaction --no-ansi
3233

33-
- name: Build package
34-
run: poetry build
34+
- name: Build package with custom build script
35+
run: |
36+
poetry run python build.py
37+
poetry build
38+
39+
- name: Rename artifacts with Python version
40+
run: |
41+
mkdir -p dist-py${{ matrix.python-version }}
42+
cp dist/*.whl dist-py${{ matrix.python-version }}/
43+
cp dist/*.tar.gz dist-py${{ matrix.python-version }}/
44+
# Rename wheel to include Python version
45+
cd dist-py${{ matrix.python-version }}
46+
for file in *.whl; do
47+
if [[ "$file" != *"py${{ matrix.python-version }}"* ]]; then
48+
mv "$file" "${file%.whl}-py${{ matrix.python-version }}.whl"
49+
fi
50+
done
51+
52+
- name: Upload Python ${{ matrix.python-version }} artifacts
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: python-packages-${{ matrix.python-version }}
56+
path: dist-py${{ matrix.python-version }}/
57+
retention-days: 7
58+
59+
release:
60+
name: Create Release
61+
runs-on: ubuntu-latest
62+
needs: build
63+
if: startsWith(github.ref, 'refs/tags/v')
64+
permissions:
65+
contents: write
66+
steps:
67+
- name: Download all artifacts
68+
uses: actions/download-artifact@v4
69+
with:
70+
path: artifacts/
71+
72+
- name: Prepare release assets
73+
run: |
74+
mkdir -p release-assets
75+
find artifacts/ -name "*.whl" -exec cp {} release-assets/ \;
76+
find artifacts/ -name "*.tar.gz" -exec cp {} release-assets/ \;
3577
3678
- name: Create Release
3779
uses: softprops/action-gh-release@v2
3880
with:
3981
name: Release ${{ github.ref_name }}
40-
body: Automated release for version ${{ github.ref_name }}
82+
body: |
83+
Automated release for version ${{ github.ref_name }}
84+
85+
This release includes builds for Python 3.10, 3.11, 3.12, and 3.13.
4186
draft: false
4287
prerelease: false
43-
files: |
44-
dist/*.whl
45-
dist/*.tar.gz
88+
files: release-assets/*
4689

47-
- name: Upload artifacts for PyPI
90+
- name: Upload combined artifacts for PyPI
4891
uses: actions/upload-artifact@v4
4992
with:
50-
name: python-packages
51-
path: dist/
93+
name: python-packages-combined
94+
path: release-assets/
5295
retention-days: 7
5396

5497
publish:
@@ -63,7 +106,7 @@ jobs:
63106
- name: Download package artifacts
64107
uses: actions/download-artifact@v4
65108
with:
66-
name: python-packages
109+
name: python-packages-combined
67110
path: dist
68111

69112
- name: Publish to TestPyPI

README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ High-performance Python logging library with file rotation and optimized caching
3030
- [Memory Management](#memory-management)
3131
- [Flexible Configuration Options](#flexible-configuration-options)
3232
- [Migration Guide](#migration-guide)
33-
- [Development](#source-code)
34-
- [Run Tests and Get Coverage Report using Poe](#run-tests-and-get-coverage-report-using-poe)
33+
- [Development](#development)
34+
- [Development](#development)
35+
- [Building from Source](#building-from-source)
36+
- [Running Tests](#running-tests)
3537
- [License](#license)
36-
- [Buy me a cup of coffee](#buy-me-a-cup-of-coffee)
38+
- [Support](#support)
3739

3840

3941

@@ -520,25 +522,27 @@ timed_logger = timed_rotating_logger(level=LogLevel.WARNING, name="app", directo
520522
- 📚 **Centralized configuration** through factory pattern
521523

522524

523-
# Source Code
524-
### Build
525+
# Development
526+
527+
### Building from Source
525528
```shell
526529
poetry build -f wheel
527530
```
528531

529-
530-
# Run Tests and Get Coverage Report using Poe
532+
### Running Tests
531533
```shell
532534
poetry update --with test
533-
poe test
535+
poe tests
534536
```
535537

536-
537538
# License
539+
538540
Released under the [MIT License](LICENSE)
539541

542+
# Support
543+
544+
If you find this project helpful, consider supporting development:
540545

541-
# Buy me a cup of coffee
542-
+ [GitHub Sponsor](https://github.com/sponsors/ddc)
543-
+ [ko-fi](https://ko-fi.com/ddcsta)
544-
+ [Paypal](https://www.paypal.com/ncp/payment/6G9Z78QHUD4RJ)
546+
- [GitHub Sponsor](https://github.com/sponsors/ddc)
547+
- [ko-fi](https://ko-fi.com/ddcsta)
548+
- [PayPal](https://www.paypal.com/ncp/payment/6G9Z78QHUD4RJ)

build.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/usr/bin/env python
2+
import sys
3+
import compileall
4+
import tomllib
5+
from pathlib import Path
6+
7+
8+
def parse_python_version_requirement():
9+
"""Parse Python version requirement from pyproject.toml"""
10+
pyproject_path = Path(__file__).parent / "pyproject.toml"
11+
12+
with open(pyproject_path, "rb") as f:
13+
data = tomllib.load(f)
14+
15+
python_req = data["tool"]["poetry"]["dependencies"]["python"]
16+
17+
# Parse version constraint like "^3.10"
18+
if python_req.startswith("^"):
19+
min_version = python_req[1:]
20+
major, minor = map(int, min_version.split("."))
21+
return major, minor
22+
elif python_req.startswith(">="):
23+
min_version = python_req[2:]
24+
major, minor = map(int, min_version.split("."))
25+
return major, minor
26+
else:
27+
# Default fallback
28+
return 3, 11
29+
30+
31+
def get_compatible_python_versions(min_major, min_minor):
32+
"""Generate list of compatible Python versions"""
33+
versions = []
34+
current_major, current_minor = sys.version_info[:2]
35+
36+
# Start from the minimum required version
37+
for major in range(min_major, min_major + 1): # Only Python 3.x for now
38+
start_minor = min_minor if major == min_major else 0
39+
# Go up to current Python version + 2 minor versions for future compatibility
40+
end_minor = max(current_minor + 2, 12) if major == current_major else 12
41+
42+
for minor in range(start_minor, end_minor + 1):
43+
if major == 3 and minor >= min_minor: # Only include 3.10+
44+
versions.append(f"{major}.{minor}")
45+
46+
return versions
47+
48+
49+
def build():
50+
"""Build bytecode for all compatible Python versions"""
51+
try:
52+
min_major, min_minor = parse_python_version_requirement()
53+
compatible_versions = get_compatible_python_versions(min_major, min_minor)
54+
55+
print(f"Building for Python versions: {', '.join(compatible_versions)}")
56+
57+
# Compile for current Python version
58+
print(f"Compiling for Python {sys.version_info.major}.{sys.version_info.minor}")
59+
compileall.compile_dir('pythonDatabases', force=True)
60+
61+
# Note: For actual cross-version bytecode, you'd need multiple Python interpreters
62+
# This compiles with current interpreter but documents compatibility
63+
print("Build completed successfully")
64+
65+
except Exception as e:
66+
print(f"Build failed: {e}")
67+
sys.exit(1)
68+
69+
70+
if __name__ == "__main__":
71+
build()

poetry.lock

Lines changed: 3 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)