Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
Zheaoli opened this issue Nov 30, 2024 · 2 comments
Open
1 task done

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

Zheaoli opened this issue Nov 30, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Zheaoli
Copy link
Member

Zheaoli commented Nov 30, 2024

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.
@Zheaoli Zheaoli added the enhancement New feature or request label Nov 30, 2024
@Xuanwo
Copy link
Member

Xuanwo commented Nov 30, 2024

Would it be a good idea to use uv, which is written in Rust, instead? Currently, I feel that opendal python is not a complex python package, and fine-grained python package management may not be necessary. Ease of setup and quick usage would be more appreciated.

I don't know much about python package management, but:

image

@messense
Copy link
Member

messense commented Dec 1, 2024

A nice feature of uv is cache-keys, for example, with

[tool.uv]
cache-keys = [{file = "pyproject.toml"}, {file = "Cargo.toml"}, {file = "**/*.rs"}]

uv subcommands like uv run will trigger Python wheel rebuild when Rust code changes automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants