cnpryer/huak

Huak's PyProjectToml implementation

cnpryer opened this issue · 0 comments

Summary

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

Motivation

  • #628
  • Tough to do [tool.huak]
  • Managing pyproject.toml's should be easier (needed for many ops)

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

  • Simple API for read, write, etc.
  • Allow core pyproject.toml data and other tables (includes tool tables)
  • Make Git integration better with easier TOML ser.
  • Allow for workspace management

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/*"]