Skip to content

Commit 0e563e4

Browse files
committed
Modernize project setup:
* get rid of setup.cfgy, MANIFEST.in and moving to flit as build backend * switched tox to use uv under the hood * add uv lock * replace requirments/* with dependency groups * move all configuration to pyproject.toml * switched to ruff for formatting (no exceptions)
1 parent 080bfd1 commit 0e563e4

File tree

17 files changed

+2002
-231
lines changed

17 files changed

+2002
-231
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
Dockerfile
22
docker-compose*
33
.git
4+
/dist/
5+
6+
/.tox/
7+
8+
/.idea/
9+
10+
/.coverage

.github/workflows/cicd.yml

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ env:
1010
BUILDKIT_PROGRESS: "plain"
1111
RELEASABLE_REPOS: "^kiorky/"
1212
RELEASABLE_BRANCHES: "^(refs/heads/)?(master|main|new-packaging)$"
13+
FORCE_COLOR: "true"
1314
jobs:
1415
test-code-QA:
1516
runs-on: ubuntu-latest
@@ -23,14 +24,19 @@ jobs:
2324
uses: actions/cache@v4
2425
with:
2526
path: .tox
26-
key: ${{ runner.os }}-${{ matrix.python }}-toxQA
27-
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v5
29-
with: {python-version: "${{ matrix.python-version }}", cache: pip, cache-dependency-path: 'requirements/*.txt'}
30-
- name: install tests dependencies
31-
run: pip install -r requirements/test.txt -r requirements/lint.txt -r requirements/mypy.txt -r requirements/tox.txt -r requirements/format.txt
27+
key: test-code-QA-${{ runner.os }}-${{ matrix.python }}-toxQA-${{ hashFiles('**/pyproject.toml') }}
28+
- name: Cache uv
29+
uses: actions/cache@v4
30+
with:
31+
path: ~/.cache/uv
32+
key: test-code-QA-${{ runner.os }}-${{ matrix.python }}-uvQA-${{ hashFiles('**/pyproject.toml') }}
33+
- name: Install uv and tox
34+
shell: sh
35+
run: |
36+
curl -LsSf https://astral.sh/uv/install.sh | sh
37+
uv tool install tox
3238
- name: formatters check
33-
run: tox --current-env -e lint,mypy,fmt
39+
run: tox -e lint,mypy,fmt
3440

3541
test-py3:
3642
runs-on: ubuntu-latest
@@ -44,26 +50,26 @@ jobs:
4450
uses: actions/cache@v4
4551
with:
4652
path: .tox
47-
key: ${{ runner.os }}-${{ matrix.python }}-tox
48-
- name: Set up Python ${{ matrix.python-version }}
49-
uses: actions/setup-python@v5
50-
with: {python-version: "${{ matrix.python-version }}", cache: pip, cache-dependency-path: 'requirements/*.txt'}
51-
- name: install tests dependencies
52-
run: pip install -r requirements/test.txt -r requirements/tox.txt
53+
key: test-py3-${{ runner.os }}-${{ matrix.python }}-tox-${{ hashFiles('**/pyproject.toml') }}
54+
- name: Cache uv
55+
uses: actions/cache@v4
56+
with:
57+
path: ~/.cache/uv
58+
key: test-py3-${{ runner.os }}-${{ matrix.python }}-uvQA-${{ hashFiles('**/pyproject.toml') }}
59+
- name: Install uv and tox
60+
shell: sh
61+
run: |
62+
curl -LsSf https://astral.sh/uv/install.sh | sh
63+
uv tool install tox
5364
- name: run tests with coverage
54-
run: tox --current-env -e cov
65+
run: tox -e cov
5566

5667
test-32bits:
5768
runs-on: ubuntu-latest
5869
steps:
5970
- uses: actions/checkout@v3
60-
- name: Cache tox environments
61-
uses: actions/cache@v4
62-
with:
63-
path: .dockertox
64-
key: ${{ runner.os }}-${{ matrix.python }}-dockertox
6571
- name: Test with pytest
6672
run: |
67-
docker compose build --build-arg BASE=corpusops/croniter:32bits
68-
docker compose run --rm app tox --current-env -e test
73+
docker compose build --quiet --build-arg BASE=corpusops/croniter:32bits
74+
docker compose run --rm app --env FORCE_COLOR=true -t tox -e test
6975
env: {COMPOSE_FILE: "docker-compose.yml:docker-compose-32bits.yml"}

.github/workflows/dockerimages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env:
88
DOCKER_BUILDKIT: "1"
99
COMPOSE_DOCKER_CLI_BUILD: "1"
1010
BUILDKIT_PROGRESS: "plain"
11-
RELEASABLE_REPOS: "^kiorky/"
11+
RELEASABLE_REPOS: "^potiuk/"
1212
RELEASABLE_BRANCHES: "^(refs/heads/)?(master|main|new-packaging)$"
1313
jobs:
1414
docker-build:

MANIFEST.in

Lines changed: 0 additions & 7 deletions
This file was deleted.

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ services:
44
volumes:
55
- ./docker-entry.sh:/app/docker-entry.sh
66
- ./.dockertox:/app/.tox
7-
- ./setup.cfg:/app/setup.cfg
87
- ./pyproject.toml:/app/pyproject.toml
98
- ./src:/app/src
109
- ./tox.ini:/app/tox.ini

pyproject.toml

Lines changed: 88 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,111 @@
11
[build-system]
2-
build-backend = "setuptools.build_meta"
3-
requires = ["setuptools>=77.0"]
2+
requires = ["flit_core >=3.2,<4"]
3+
build-backend = "flit_core.buildapi"
44

55
[project]
66
name = "croniter"
7-
version = "6.0.1.dev0"
8-
license = "MIT"
7+
version = "6.0.1rc1"
98
description = "croniter provides iteration for datetime object with cron like format"
9+
readme = "README.rst"
10+
license = { file = "LICENSE" }
1011
authors = [
11-
{ name = "Matsumoto Taichi", email = "[email protected]" },
12-
{ name = "kiorky", email = "[email protected]" },
12+
{ name = "Matsumoto Taichi", email = "[email protected]" },
13+
{ name = "kiorky", email = "[email protected]" },
14+
{ name = "Ash Berlin-Taylor", email = "[email protected]" },
15+
{ name = "Jarek Potiuk", email = "[email protected]" },
1316
]
1417
requires-python = ">=3.9"
1518
keywords = [
16-
"datetime",
17-
"iterator",
18-
"cron",
19+
"datetime",
20+
"iterator",
21+
"cron"
1922
]
2023
classifiers = [
21-
"Development Status :: 4 - Beta",
22-
"Intended Audience :: Developers",
23-
"Operating System :: POSIX",
24-
"Programming Language :: Python",
25-
"Programming Language :: Python :: 3.9",
26-
"Programming Language :: Python :: 3.10",
27-
"Programming Language :: Python :: 3.11",
28-
"Programming Language :: Python :: 3.12",
29-
"Programming Language :: Python :: 3.13",
24+
"Development Status :: 4 - Beta",
25+
"Intended Audience :: Developers",
26+
"Operating System :: POSIX",
27+
"Programming Language :: Python",
28+
"Programming Language :: Python :: 3.9",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
32+
"Programming Language :: Python :: 3.13"
3033
]
3134
dependencies = [
32-
"python_dateutil",
35+
"python_dateutil"
3336
]
34-
dynamic = ["readme"]
3537

36-
[project.optional-dependencies]
37-
test = [
38-
"pytz>2021.1",
38+
[project.urls]
39+
Homepage = "https://github.com/pallets-eco/croniter"
40+
41+
[dependency-groups]
42+
dev = [
43+
"pytest>=8.3.3",
44+
"pytest-cov>=5.0.0",
45+
"coverage>=4.2",
46+
"setuptools",
47+
"pytz>2021.1"
48+
]
49+
lint = [
50+
"ruff"
51+
]
52+
mypy = [
53+
"mypy",
54+
"types-python-dateutil",
55+
"types-pytz"
56+
]
57+
format = [
58+
"ruff",
59+
]
60+
tox = [
61+
"tox>=4",
62+
"tox-current-env @ git+https://github.com/fedora-python/tox-current-env.git@0cf2785"
63+
]
64+
release = [
65+
"zest.releaser[recommended]>=6.7"
3966
]
4067

41-
[project.urls]
42-
"Homepage" = "https://github.com/pallets-eco/croniter"
68+
[tool.ruff]
69+
line-length = 99
4370

44-
[tool.setuptools.dynamic]
45-
readme = { file = ["README.rst", "CHANGELOG.rst"] }
71+
[tool.ruff.lint.per-file-ignores]
72+
"*" = ["C901"]
4673

47-
[tool.setuptools.packages.find]
48-
where = ["src"]
49-
exclude = ["croniter.tests*"]
74+
[tool.coverage.run]
75+
branch = true
76+
omit = [
77+
".tox/*",
78+
"src/croniter/tests*",
79+
"src/croniter/test_*.py"
80+
]
5081

51-
[tool.setuptools.exclude-package-data]
52-
croniter = ["tests*"]
82+
[tool.coverage.report]
83+
exclude_lines = [
84+
"pragma: no cover",
85+
"raise AssertionError",
86+
"raise NotImplementedError"
87+
]
5388

54-
[tool.black]
55-
line-length = 99
56-
target-version = [
57-
'py39',
58-
'py310',
59-
# Because we're using an old version of black to support older python, there
60-
# is no explicit python version target past 3.10
89+
[tool.isort]
90+
profile = "black"
91+
multi_line_output = 3
92+
include_trailing_comma = true
93+
skip = [
94+
".tox",
95+
".git"
6196
]
97+
force_grid_wrap = 0
98+
use_parentheses = true
99+
ensure_newline_before_comments = true
100+
line_length = 99
62101

63-
[tool.pylint.format]
64-
max-line-length = 99
102+
[tool.flit.module]
103+
directory = "src"
104+
name = "croniter"
105+
106+
[tool.mypy]
107+
exclude = [
108+
"dist/.*",
109+
# Exclude hidden files and directories
110+
".*/\\..*"
111+
]

requirements/format.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

requirements/lint.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/mypy.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

requirements/release.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)