cnpryer / huak

My experimental Python package manager.
https://cnpryer.github.io/huak/
MIT License
616 stars 34 forks source link

Huak's PyProjectToml implementation #852

Closed cnpryer closed 11 months ago

cnpryer commented 11 months ago

Summary

Improve pyproject.toml management and robustness by implementing Huak's pyproject.toml library.

Motivation

The pyproject.toml is like the Cargo.toml of Rust. You're supposed to use Cargo to manage the manifest file (Cargo.toml). The goal would be to treat the pyproject.toml similarly with Huak.

Requirements

Details

Projects have manifest files named pyproject.toml (as specified in PEP 517). The data can consist of project metadata as well as tooling configuration. Here's Huak's pyproject.toml

[project]
name = "huak"
version = "0.0.20a1"
description = "A Python package manager written in Rust and inspired by Cargo."
authors = [
    {email = "cnpryer@gmail.com"},
    {name = "Chris Pryer"}
]
readme = "README.md"
license = {text = "MIT"}
requires-python = ">=3.7"
classifiers = [
    "Programming Language :: Rust",
]

[project.urls]
issues = "https://github.com/cnpryer/huak/issues"
documentation = "https://github.com/cnpryer/huak"
homepage = "https://github.com/cnpryer/huak"
repository = "https://github.com/cnpryer/huak"

[tool.maturin]
bindings = "bin"
manifest-path = "crates/huak-cli/Cargo.toml"
module-name = "huak"
python-source = "python"
strip = true

[build-system]
requires = ["maturin>=0.14,<0.15"]
build-backend = "maturin"

[tool.huak]
toolchain = "default"

This manifest identifies the workspace for the Huak project. It contains metadata about the project, it's authors, build configuration, and config for other tools like maturin. At the bottom is the [tool.huak] table (see PEP 518).

[tool.huak]

Huak's pyproject.toml implementation needs to expect a tool table, especially Huak's tool table. See:

Example:

[tool.huak]
toolchain = "3.11.6"
repositories = { package = "url to repo" }  # TODO

[tool.huak.run]  # TODO: Compare with new project.run table.
hello-world = "python -c 'print('hello, world.')'"

[tool.huak.workspace]
members = ["projects/*"]