PyO3 / pyproject-toml-rs

pyproject.toml parser in Rust
MIT License
19 stars 8 forks source link

Adding `license_expression` and `license_files` serialization #2

Closed idavis closed 2 years ago

idavis commented 2 years ago

Adds license_expression and license_files to the pyproject matadata specified in PEP 639 Core Metadata. No validation is performed as that should be handled by consumers. Also adds default value for license_files as described in PEP 639.

Though the paths and globs are mutually exclusive through validation, serialization allows them both to be specified. I could not find a way to restrict this via the toml-rs serializer. I think there is a bug in the dotted key handling.

messense commented 2 years ago

Though the paths and globs are mutually exclusive through validation, serialization allows them both to be specified.

Maybe we should use an enum instead?

idavis commented 2 years ago

@messense I tried to use an enum but the dotted names caused issues with the serialization.

messense commented 2 years ago

We can also migrate to toml_edit: https://github.com/ordian/toml_edit

We already done that in maturin.

idavis commented 2 years ago

@messense Misread what you said, you're suggesting that we convert this repo to use toml_edit. I'll give it a try.

idavis commented 2 years ago

@messense I have converted the repo to use toml_edit just like maturin. I was then able to convert the licenses metadata to an enum and added tests.

messense commented 2 years ago

Thanks! Since PEP 639 is still a draft waiting for review, let's use git dependency in maturin for implementing multiple license files support for now.