Skip to content

Commit 3a3b5f9

Browse files
committed
add uv as python package management
1 parent d9ecd7f commit 3a3b5f9

File tree

2 files changed

+155
-180
lines changed

2 files changed

+155
-180
lines changed

pyproject.toml

+73-55
Original file line numberDiff line numberDiff line change
@@ -30,81 +30,99 @@ readme = "README.md"
3030
requires-python = ">=3.9"
3131
dependencies = []
3232

33-
[tool.pdm.scripts]
34-
# ss-python-cli = "ss_python.cli:app"
35-
lint = "ruff ."
36-
fmt = "ruff format . --check"
37-
test = "pytest "
38-
docs = "mkdocs serve"
39-
docs-deploy = "mkdocs gh-deploy --force"
40-
cleanup = "sh scripts/cleanup.sh"
33+
[project.scripts]
34+
qpyapp = "qpyapp:main"
35+
cleanup = "qpyci.commands:clean"
36+
cov = "ci:coverage"
37+
badge = "qpyci.commands:generate_badge"
38+
check_format = "ci:check_format"
39+
ci = "ci:ci"
4140

4241
[project.urls]
4342
issue = "https://github.com/fluent-qa/fluentqa-pytpl/issues"
4443
repository = "https://github.com/fluent-qa/fluentqa-pytpl"
4544

46-
[tool.pdm]
47-
distribution = true
4845

49-
[tool.pdm.dev-dependencies]
50-
docs = ["mkdocs-material>=9.5.27", "mkdocs>=1.6.0"]
51-
lint = ["ruff>=0.4.9"]
52-
test = ["pytest-cov>=5.0.0"]
46+
[tool.hatch.build.targets.wheel.force-include]
47+
"ci.py" = "ci.py"
5348

49+
[tool.uv]
50+
default-groups = ["dev"]
5451

55-
[tool.pytest.ini_options]
56-
addopts = "-l -s --durations=0"
57-
log_cli = true
58-
log_cli_level = "info"
59-
log_date_format = "%Y-%m-%d %H:%M:%S"
60-
log_format = "%(asctime)s %(levelname)s %(message)s"
61-
minversion = "6.0"
62-
cov = "qpytpl"
63-
cov-report = "html"
52+
[tool.uv.sources]
53+
qpyci = { git = "https://github.com/fluent-qa/qpyci.git", rev = "main" }
54+
55+
[tool.hatch.build.targets.wheel]
56+
packages = ["src/qpyapp"]
6457

65-
[tool.coverage]
58+
[tool.pyright]
59+
typeCheckingMode = "strict"
60+
reportUnnecessaryTypeIgnoreComment = true
61+
reportMissingTypeStubs = false
62+
include = ["src", "tests"]
63+
venvPath = ".venv"
64+
# see https://github.com/microsoft/pyright/issues/7771 - we don't want to error on decorated functions in tests
65+
# which are not otherwise used
66+
executionEnvironments = [{ root = "tests", reportUnusedFunction = false }]
6667

67-
[tool.coverage.report]
68-
fail_under = 100
6968

70-
[tool.coverage.run]
71-
source = ["src/qpytpl"]
69+
[dependency-groups]
70+
lint = ["ruff>=0.8.3"]
71+
dev = [
72+
"allure-pytest>=2.13.5",
73+
"pytest-cov>=6.0.0",
74+
"pytest>=8.3.4",
75+
"coverage-badge>=1.1.2",
76+
]
7277

7378
[tool.ruff]
74-
extend-exclude = ["template"]
75-
fix = true
76-
src = ["src"]
79+
line-length = 120
80+
target-version = "py39"
81+
include = ["qpyapp/**/*.py", "tests/**/*.py", "docs/**/*.py"]
7782

7883
[tool.ruff.lint]
79-
select = [
80-
"B", # flake8-bugbear
81-
"D", # pydocstyle
82-
"E", # pycodestyle error
83-
"F", # Pyflakes
84-
"I", # isort
85-
"RUF100", # Unused noqa directive
86-
"S", # flake8-bandit
87-
"SIM", # flake8-simplify
88-
"UP", # pyupgrade
89-
"W", # pycodestyle warning
84+
extend-select = ["Q", "RUF100", "C90", "UP", "I", "D"]
85+
flake8-quotes = { inline-quotes = "single", multiline-quotes = "double" }
86+
isort = { combine-as-imports = true, known-first-party = ["qpyconf"] }
87+
mccabe = { max-complexity = 15 }
88+
ignore = [
89+
"D100", # ignore missing docstring in module
90+
"D102", # ignore missing docstring in public method
91+
"D104", # ignore missing docstring in public package
92+
"D105", # ignore missing docstring in magic methods
93+
"D107", # ignore missing docstring in __init__ methods
9094
]
9195

92-
[tool.ruff.lint.per-file-ignores]
93-
"tests/*" = ["S101"]
94-
9596
[tool.ruff.lint.pydocstyle]
9697
convention = "google"
9798

99+
[tool.ruff.format]
100+
# don't format python in docstrings, pytest-examples takes care of it
101+
docstring-code-format = false
102+
quote-style = "single"
98103

99-
[tool.tomlsort]
100-
all = true
101-
in_place = true
102-
trailing_comma_inline_array = true
104+
[tool.ruff.lint.per-file-ignores]
105+
"tests/**/*.py" = ["D"]
106+
"docs/**/*.py" = ["D"]
107+
"src/qpyconf/**/*.py" = ["D101", "D103"]
103108

104-
[[tool.pdm.source]]
105-
name = "mirrors"
106-
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
107109

108-
[[tool.pdm.source]]
109-
name = "douban"
110-
url = "https://pypi.doubanio.com/simple/"
110+
[tool.pytest.ini_options]
111+
testpaths = ["tests"]
112+
pythonpath = ["src"]
113+
addopts = [
114+
"--alluredir",
115+
"allure-results",
116+
"--clean-alluredir",
117+
"-l",
118+
"-s",
119+
"--durations",
120+
"0",
121+
"--cov",
122+
"qpyconf",
123+
]
124+
log_cli = true
125+
log_cli_level = "info"
126+
log_date_format = "%Y-%m-%d %H:%M:%S"
127+
log_format = "%(asctime)s %(levelname)s %(message)s"
128+
minversion = "6.0"

template/pyproject.toml.jinja

+82-125
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,106 @@
1-
[build-system]
2-
requires = ["mina-build>=0.2.5"]
3-
build-backend = "pdm.backend"
4-
5-
#[build-system]
6-
#requires = ["pdm-backend", "pdm-polylith-workspace"]
7-
#build-backend = "pdm.backend"
8-
91
[project]
10-
authors = [
11-
{ name = "{{author_name}}", email = "{{author_email}}" },
12-
]
13-
classifiers = [
14-
"Development Status :: 3 - Alpha",
15-
"License :: OSI Approved :: MIT License",
16-
"Operating System :: OS Independent",
17-
"Programming Language :: Python :: 3.10",
18-
"Programming Language :: Python :: 3.11",
19-
"Programming Language :: Python :: 3.12",
20-
"Programming Language :: Python :: 3.8",
21-
"Programming Language :: Python :: 3.9",
22-
]
23-
description = "{{project_description}}"
24-
dynamic = [
25-
"version",
26-
]
27-
keywords = [
28-
"copier-template",
29-
"full-development-lifecycle",
30-
"project-template",
31-
"scaffold",
32-
]
33-
license = {text = "UNDEFINED"}
342
name = "{{project_name}}"
3+
version = "0.1.0"
4+
description = "{{project_description}}"
355
readme = "README.md"
36-
requires-python = ">=3.9"
37-
dependencies = [
38-
# "pydantic-settings",
39-
# "typer[all]",
40-
"dynaconf>=3.2.5",
41-
"pydantic>=2.7.4",
42-
]
436

44-
[tool.pdm.scripts]
45-
lint = "ruff ."
46-
fmt = "ruff format . --check"
47-
test = "pytest "
48-
docs = "mkdocs serve"
49-
docs-deploy ="mkdocs gh-deploy --force"
50-
cleanup = "sh scripts/cleanup.sh"
51-
52-
[project.urls]
53-
issue = "https://github.com/{{organization_name}}/{{project_name}}/issues"
54-
repository = "https://github.com/{{organization_name}}/{{project_name}}"
55-
56-
[tool.pdm]
57-
distribution = true
58-
59-
[tool.pdm.dev-dependencies]
60-
docs = [
61-
"mkdocs-material>=9.5.27",
62-
"mkdocs>=1.6.0",
63-
]
7+
requires-python = ">=3.10"
8+
dependencies = []
649

65-
lint = [
66-
"ruff>=0.4.9"
67-
]
68-
test = [
69-
"pytest-cov>=5.0.0",
70-
]
10+
[project.scripts]
11+
{{project_name}} = "{{project_name}}:main"
12+
cleanup = "qpyci.commands:clean"
13+
cov = "ci:coverage"
14+
badge = "qpyci.commands:generate_badge"
15+
check_format = "ci:check_format"
16+
ci = "ci:ci"
7117

18+
[build-system]
19+
requires = ["hatchling"]
20+
build-backend = "hatchling.build"
7221

73-
[tool.pytest.ini_options]
74-
addopts = "-l -s --durations=0"
75-
log_cli = true
76-
log_cli_level = "info"
77-
log_date_format = "%Y-%m-%d %H:%M:%S"
78-
log_format = "%(asctime)s %(levelname)s %(message)s"
79-
minversion = "6.0"
80-
cov="qpytpl"
81-
cov-report="html"
8222

83-
[tool.coverage]
8423

85-
[tool.coverage.report]
86-
fail_under = 100
24+
[tool.hatch.build.targets.wheel.force-include]
25+
"ci.py" = "ci.py"
8726

88-
[tool.coverage.run]
89-
source = [
90-
"src/qpytpl",
91-
]
27+
[tool.uv]
28+
default-groups = ["dev"]
9229

93-
[tool.mypy]
94-
check_untyped_defs = true
95-
disallow_any_unimported = true
96-
disallow_untyped_defs = true
97-
enable_error_code = [
98-
"ignore-without-code",
99-
]
100-
exclude = [
101-
"build",
102-
"template",
103-
]
104-
no_implicit_optional = true
105-
show_error_codes = true
106-
warn_return_any = true
107-
warn_unused_ignores = true
30+
[tool.uv.sources]
31+
qpyci = { git = "https://github.com/fluent-qa/qpyci.git", rev = "main" }
10832

33+
[tool.hatch.build.targets.wheel]
34+
packages = ["src/qpyapp"]
10935

110-
[tool.ruff]
111-
extend-exclude = [
112-
"template",
36+
[tool.pyright]
37+
typeCheckingMode = "strict"
38+
reportUnnecessaryTypeIgnoreComment = true
39+
reportMissingTypeStubs = false
40+
include = ["src", "tests"]
41+
venvPath = ".venv"
42+
# see https://github.com/microsoft/pyright/issues/7771 - we don't want to error on decorated functions in tests
43+
# which are not otherwise used
44+
executionEnvironments = [{ root = "tests", reportUnusedFunction = false }]
45+
46+
47+
[dependency-groups]
48+
lint = ["ruff>=0.8.3"]
49+
dev = [
50+
"allure-pytest>=2.13.5",
51+
"pytest-cov>=6.0.0",
52+
"pytest>=8.3.4",
53+
"coverage-badge>=1.1.2",
11354
]
114-
fix = true
115-
src = ["src"]
55+
56+
[tool.ruff]
57+
line-length = 120
58+
target-version = "py39"
59+
include = ["qpyapp/**/*.py", "tests/**/*.py", "docs/**/*.py"]
11660

11761
[tool.ruff.lint]
118-
select = [
119-
"B", # flake8-bugbear
120-
"D", # pydocstyle
121-
"E", # pycodestyle error
122-
"F", # Pyflakes
123-
"I", # isort
124-
"RUF100", # Unused noqa directive
125-
"S", # flake8-bandit
126-
"SIM", # flake8-simplify
127-
"UP", # pyupgrade
128-
"W", # pycodestyle warning
62+
extend-select = ["Q", "RUF100", "C90", "UP", "I", "D"]
63+
flake8-quotes = { inline-quotes = "single", multiline-quotes = "double" }
64+
isort = { combine-as-imports = true, known-first-party = ["qpyconf"] }
65+
mccabe = { max-complexity = 15 }
66+
ignore = [
67+
"D100", # ignore missing docstring in module
68+
"D102", # ignore missing docstring in public method
69+
"D104", # ignore missing docstring in public package
70+
"D105", # ignore missing docstring in magic methods
71+
"D107", # ignore missing docstring in __init__ methods
12972
]
13073

131-
[tool.ruff.lint.per-file-ignores]
132-
"tests/*" = ["S101"]
133-
13474
[tool.ruff.lint.pydocstyle]
13575
convention = "google"
13676

77+
[tool.ruff.format]
78+
# don't format python in docstrings, pytest-examples takes care of it
79+
docstring-code-format = false
80+
quote-style = "single"
13781

138-
[tool.tomlsort]
139-
all = true
140-
in_place = true
141-
trailing_comma_inline_array = true
82+
[tool.ruff.lint.per-file-ignores]
83+
"tests/**/*.py" = ["D"]
84+
"docs/**/*.py" = ["D"]
85+
"src/qpyconf/**/*.py" = ["D101", "D103"]
14286

143-
[[tool.pdm.source]]
144-
name = "mirrors"
145-
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
14687

147-
[[tool.pdm.source]]
148-
name = "douban"
149-
url = "https://pypi.doubanio.com/simple/"
88+
[tool.pytest.ini_options]
89+
testpaths = ["tests"]
90+
pythonpath = ["src"]
91+
addopts = [
92+
"--alluredir",
93+
"allure-results",
94+
"--clean-alluredir",
95+
"-l",
96+
"-s",
97+
"--durations",
98+
"0",
99+
"--cov",
100+
"qpyconf",
101+
]
102+
log_cli = true
103+
log_cli_level = "info"
104+
log_date_format = "%Y-%m-%d %H:%M:%S"
105+
log_format = "%(asctime)s %(levelname)s %(message)s"
106+
minversion = "6.0"

0 commit comments

Comments
 (0)