-
-
Notifications
You must be signed in to change notification settings - Fork 470
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
Using pyproject-toml-rs #23
Comments
That library today does not do enough for what rye needs:
|
I'm happy to work on upstream changes as well.
I'm not sure if that's not something we couldn't upstream. I'd want this behavior as well from toml = { version = "0.7.3", features = ["preserve_order"] }
True and I'm curious if this is something that could be added upstream. If not this is how I implemented my core metadata struct use pyproject_toml::{BuildSystem, Project, PyProjectToml as ProjectToml};
// ...
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "kebab-case")]
/// The `Metadata` of a `Package`.
///
/// See https://peps.python.org/pep-0621/ for more about core metadata.
pub struct Metadata {
/// The build system used for the `Package`.
build_system: BuildSystem,
/// The `Project` table.
project: Project,
} And to just add it to the /// A pyproject.toml as specified in PEP 621 with tool table.
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "kebab-case")]
pub struct PyProjectToml {
#[serde(flatten)]
inner: ProjectToml,
tool: Option<Table>,
} Another thing I was personally going to think about was designing the metadata file management in a way similar to how cargo handles it (for Cargo.toml), but I'm not sure pyproject.toml data would play well with it, and I haven't thought enough about it to have any meaningful opinion. For example, I really like how cargo makes path-based modifications to the toml using their |
I've based my approach off of how |
FWIW I'm super happy to use pyproject-toml. Happy to accept move this over when it covers that the moment the changes land. Having a good pyproject-toml library in Rust would really benefitial for everyone. |
When you mention
Are you expecting to not make any formatting decisions on behalf of the user? For example, if I were to add enough dev dependencies, are you expecting the user to manage this [project]
name = "test-project"
version = "0.0.1"
description = "Add a short description here"
authors = [
{ name = "Chris Pryer", email = "[email protected]" }
]
dependencies = ["xlcsv~=0.3.0", "packaging~=23.1", "pydantic~=2.0a3"]
readme = "README.md"
requires-python = ">= 3.8"
license = { text = "MIT" }
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.rye]
managed = true
dev-dependencies = ["pytest~=7.3.1", "black~=23.3.0", "ruff~=0.0.263", "mypy~=1.2.0", "polars~=0.17.9", "pandas~=2.0.1", "click~=8.1.3"] What are your opinions on wrapping after a certain amount of elements in lists? dev-dependencies = [
"pytest~=7.3.1",
"black~=23.3.0",
"ruff~=0.0.263",
"mypy~=1.2.0",
"polars~=0.17.9",
"pandas~=2.0.1",
"click~=8.1.3"
] |
I haven't thought too much about it yet. In some ways the issue here is that this is a list to begin with rather than a table. This means that it's quite likely that poking around in that table is going to encourage reformatting that is bad for diffing. I wonder it there are any recommendations today. Personally I would probably try to format into a list of one dep per line. |
I can keep an eye out for that as well, but, personally, whenever I'm looking for ecosystem-aligning direction I like to defer to |
I'm closing this as it's unlikely that I will be working on this ticket. |
Would you be open to using
pyproject-toml
?The text was updated successfully, but these errors were encountered: