Skip to content

new feature: Migrate Python package management from maturin to PDM #5371

@Zheaoli

Description

@Zheaoli

Feature Description

For now, we use maturin as our package management and build tools for our Python bindings.

I propose use PDM instead of maturin.

Problem and Solution

For now, PDM has already support maturin as build backend

[build-system]
requires = ["maturin>=1.4,<2.0"]
build-backend = "maturin"

And we can add extra configuration for Python our python binding like

[tool.pdm.scripts]
test = "pytest"
lint = "pre-commit run --all-files"


[tool.pytest.ini_options]
filterwarnings = [
  "ignore::DeprecationWarning"
]
markers = [
    "network: Tests that require network",
    "integration: Run with all Python versions",
    "path: Tests that compare with the system paths",
    "deprecated: Tests about deprecated features",
]
addopts = "-vvv -r aR"
testpaths = [
    "tests/",
]
pythonpath = [
    "src/",
]
[tool.ruff]
line-length = 120
exclude = ["tests/fixtures"]
target-version = "py38"
src = ["src"]

[tool.ruff.lint]
extend-select = [
  "I",    # isort
  "B",    # flake8-bugbear
  "C4",   # flake8-comprehensions
  "FA",   # flake8-future-annotations
  "PGH",  # pygrep-hooks
  "RUF",  # ruff
  "W",    # pycodestyle
  "UP",   # pyupgrade
  "YTT",  # flake8-2020
]
extend-ignore = ["B018", "B019", "RUF018"]
[tool.ruff.lint.mccabe]
max-complexity = 10

[tool.ruff.lint.isort]
known-first-party = ["pdm"]

So the developer can run test and lint code more friendly by using command PDM built in like pdm test, pdm lint

Additional Context

No response

Are you willing to contribute to the development of this feature?

  • Yes, I am willing to contribute to the development of this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions