Skip to content

Commit cb96e1b

Browse files
Ravencentricdanhje
authored andcommitted
fix: use standards compliant pyproject
1 parent 8d6303a commit cb96e1b

File tree

8 files changed

+351
-497
lines changed

8 files changed

+351
-497
lines changed

.github/workflows/CI.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ jobs:
3232
- name: Install dependencies
3333
run: |
3434
python -m pip install --upgrade pip
35-
pip install --upgrade poetry
36-
poetry install
37-
poetry run maturin develop
35+
pip install --upgrade uv
36+
uv sync
37+
uv run maturin develop
3838
- name: Run tests
3939
run: |
40-
poetry run pytest
40+
uv run pytest
4141
4242
linux:
4343
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
- id: end-of-file-fixer
1515
- id: trailing-whitespace
1616
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.8.1
17+
rev: v0.9.1
1818
hooks:
1919
- id: ruff
2020
args: [--fix, --exit-non-zero-on-fix]

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,22 @@ PRs are very welcome! Please make sure to run the tests before submitting a PR.
5454

5555
## Development
5656

57-
This project uses [Poetry](https://python-poetry.org/) to manage the environment and Python dependencies,
57+
This project uses [uv](https://docs.astral.sh/uv/) to manage the environment and Python dependencies,
5858
so you'll need to have it installed in addition to Python and Rust.
5959

6060
To install the development environment and run the test suite:
6161
```bash
62-
poetry install
63-
poetry run maturin develop
64-
poetry run pytest
62+
uv sync
63+
uv run maturin develop
64+
uv run pytest
6565
```
6666

67-
Be sure to run `poetry run maturin develop` after making changes to the Rust code.
67+
Be sure to run `uv run maturin develop --uv` after making changes to the Rust code.
6868
Add the `-r` flag for a release build (for example, if you want to run benchmarks).
6969

7070
It's recommended to install the pre-commit hooks:
7171
```bash
72-
poetry run pre-commit install
72+
uv run pre-commit install
7373
```
7474

7575
This ensures that linting and formatting are run automatically on every commit.

benchmarking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Important! Remember to build the Rust extension with the -r flag to enable release mode.
44
Without this, the Rust extension will be compiled in debug mode, which is significantly slower.
55
6-
poetry run maturin develop -r
6+
uv run maturin develop -r
77
"""
88

99
import timeit
@@ -22,7 +22,7 @@
2222
}
2323

2424
results = {}
25-
for name, xml in DATA.items(): # noqa: B007, PERF102
25+
for name in DATA:
2626
print(f"Running benchmarks for {name}...")
2727
quick_time = timeit.timeit("quickparse(xml)", globals=globals(), number=3)
2828
py_time = timeit.timeit("pyparse(xml)", globals=globals(), number=3)

poetry.lock

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

profiling/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ cargo install flamegraph
2626

2727
And run with:
2828
```bash
29-
poetry run cargo flamegraph --bin main
29+
uv run cargo flamegraph --bin main
3030
```
3131

3232
This will generate a `flamegraph.svg` file, which can be opened in a browser to visualize the performance of the code.

pyproject.toml

Lines changed: 24 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,46 @@
1-
[tool.poetry]
2-
name = "quick-xmltodict"
3-
version = "0.1.2"
4-
description = "Efficient XML-to-dict conversion backed by Rust"
5-
authors = ["Daniel Hjertholm <[email protected]>"]
6-
package-mode = false
7-
81
[project]
92
name = "quick-xmltodict"
103
description = "Efficient XML-to-dict conversion backed by Rust"
114
version = "0.1.2"
12-
keywords = ["xmltodict", "xml-to-dict", "xml", "fast", "rust"]
135
authors = [{name = "Daniel Hjertholm", email = "[email protected]"}]
14-
license = {file = "LICENSE"}
6+
readme = "README.md"
7+
license = "MIT"
8+
keywords = ["xmltodict", "xml-to-dict", "xml", "fast", "rust"]
159
requires-python = ">=3.10"
1610
classifiers = [
17-
"Programming Language :: Rust",
11+
"Intended Audience :: Developers",
1812
"Programming Language :: Python :: Implementation :: CPython",
1913
"Programming Language :: Python :: Implementation :: PyPy",
20-
"Programming Language :: Python :: 3",
21-
"Intended Audience :: Developers",
14+
"Programming Language :: Python :: 3.10",
15+
"Programming Language :: Python :: 3.11",
16+
"Programming Language :: Python :: 3.12",
17+
"Programming Language :: Rust",
2218
"Topic :: Text Processing :: Markup :: XML",
23-
"License :: OSI Approved :: MIT License",
2419
]
25-
dynamic = ["version"]
26-
readme = "README.md"
20+
dependencies = []
2721

2822
[project.urls]
29-
Repository = "https://github.com/statnett/quick-xmltodict.git"
30-
31-
[tool.poetry.dependencies]
32-
python = "^3.10"
33-
34-
[tool.poetry.group.dev.dependencies]
35-
maturin = "*"
36-
pytest = "*"
37-
xmltodict = "*"
38-
pre-commit = "*"
39-
40-
[build-system]
41-
requires = ["maturin>=1.5,<2.0"]
42-
build-backend = "maturin"
23+
Repository = "https://github.com/statnett/quick-xmltodict"
24+
25+
[dependency-groups]
26+
dev = [
27+
"maturin>=1.8.1",
28+
"pre-commit>=4.0.1",
29+
"pytest>=8.3.4",
30+
"ruff>=0.9.1",
31+
"xmltodict>=0.14.2",
32+
]
4333

4434
[tool.maturin]
4535
features = ["pyo3/extension-module"]
4636

4737
[tool.ruff]
48-
target-version = "py310"
4938
line-length = 120
5039

5140
[tool.ruff.lint]
52-
select = [
53-
"A", # flake8-builtins
54-
"ANN", # flake8-annotations
55-
"ARG", # flake8-unused-arguments
56-
"B", # flake8-bugbear
57-
"C4", # flake8-comprehensions
58-
"C90", # mccabe
59-
"COM", # flake8-commas
60-
"D", # pydocstyle
61-
"DTZ", # flake8-datetimez
62-
"E", "W", # pycodestyle
63-
"F", # Pyflakes
64-
"FLY", # flynt
65-
"FURB", # refurb
66-
"G", # flake8-logging-format
67-
"I", # isort
68-
"LOG", # flake8-logging
69-
"N", # pep8-nameing
70-
"NPY", # numpy specific rules
71-
"PERF", # Perflint
72-
"PIE", # flake8-pie
73-
"RUF", # Ruff specific rules
74-
"S", # flake8-bandit
75-
"SIM", # flake8-simplify
76-
"T20", # flake8-print
77-
"TCH001", # flake8-type-checking
78-
"TRY", # tryceratops
79-
"UP", # pyupgrade
80-
"YTT", # flake8-2020
81-
]
82-
83-
ignore = ['S101', 'ANN101', 'ANN102', 'ANN401', 'TRY003', 'D100', 'D101', 'D102', 'D103', 'D104', 'D105', 'D107']
84-
85-
# Allow autofix for all enabled rules (when `--fix`) is provided.
86-
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
87-
unfixable = []
88-
89-
# Exclude a variety of commonly ignored directories.
90-
exclude = [
91-
".bzr",
92-
".direnv",
93-
".eggs",
94-
".git",
95-
".git-rewrite",
96-
".hg",
97-
".mypy_cache",
98-
".nox",
99-
".pants.d",
100-
".pytype",
101-
".ruff_cache",
102-
".src",
103-
".svn",
104-
".tox",
105-
".venv",
106-
"__pypackages__",
107-
"_build",
108-
"buck-out",
109-
"build",
110-
"dist",
111-
"node_modules",
112-
"target",
113-
"venv",
114-
]
115-
116-
# Allow unused variables when underscore-prefixed.
117-
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
118-
119-
[tool.ruff.lint.pydocstyle]
120-
convention = "google"
121-
122-
[tool.ruff.lint.per-file-ignores]
123-
"tests/test*.py" = ["ANN001", "ANN201"]
124-
"benchmarking.py" = ["T201"]
41+
extend-select = ["I", "RUF", "UP", "B", "PERF"]
42+
fixable = ["ALL"]
12543

126-
[tool.ruff.lint.flake8-import-conventions]
127-
[tool.ruff.lint.flake8-import-conventions.aliases]
128-
# Declare the default aliases.
129-
numpy = "np"
130-
pandas = "pd"
131-
scipy = "sp"
132-
133-
[tool.ruff.lint.isort]
134-
known-first-party = []
44+
[build-system]
45+
requires = ["maturin>=1.8,<2.0"]
46+
build-backend = "maturin"

0 commit comments

Comments
 (0)