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
Use the pyproject-toml crate #3813
Conversation
Current dependencies on/for this PR: This comment was auto-generated by Graphite. |
crates/ruff/Cargo.toml
Outdated
@@ -65,6 +65,9 @@ thiserror = { version = "1.0.38" } | |||
toml = { workspace = true } | |||
typed-arena = { version = "2.0.2" } | |||
unicode-width = { version = "0.1.10" } | |||
# pyproject-toml = "0.5.0" | |||
# TODO: Should get merged before we merge this PR. otherwise use a git tag and remove this message | |||
pyproject-toml = { git = "https://github.com/PyO3/pyproject-toml-rs", branch = "derive_equal" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pulls in only two new crates, pep508_rs
and pyproject-toml
.
Does this mean that ruff now fails to run if a non-ruff related field is invalid? I assume we'll have to pay for deserializing all the fields that we don't use. Is this assumption correct? I'm not sure if this is overkill to replace the one struct in our code. |
yes, both are correct. A non-PEP 621 compliant pyproject.toml will fail. I would be surprised if the additional parsing time is noticeable ( |
PR Check ResultsEcosystemℹ️ ecosystem check detected changes. (+0, -0, 1 error(s)) scikit-build (error)
BenchmarkLinux
Windows
|
This pulls in the pep508_rs and the (previously used) pep440_rs crates. This also means that we now implicitly check for invalid pyproject.toml files.
1d4f5ce
to
e1dd16e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me. I'm a bit worried that the crate is on the heavy side for the functionality that we use today, and using an external crate may make it more difficult to add additional fields in the future. You've contributed to the crate and I trust your judgment.
Is the |
I ran a more extended ecosystem CI. It looks like 7/95 missed that that PEP 621 metadata for license is a table, not a string, and we're the first ones to check. I'll change the strategy to emit diagnostics instead. Finished 95 repositories typeguard (error)https://github.com/agronholm/typeguard ref None select ignore exclude
pro-orch (error)https://github.com/shanku007/pro-orch ref None select ignore exclude
crawlers (error)https://github.com/Academia-de-Dados/crawlers ref None select ignore exclude
authx (error)https://github.com/yezz123/authx ref None select ignore exclude
flippers (error)https://github.com/liamtoran/flippers ref None select ignore exclude
httpdate (error)https://github.com/jamielinux/httpdate ref None select ignore exclude
EPP_RFR (+1, -0)
+ Fixed 85 errors. kafka-http-monitor (error)https://github.com/jdahlin/kafka-http-monitor ref None select ignore exclude
griffe (error)https://github.com/mkdocstrings/griffe ref None select ignore exclude
clean_notebook (error)https://github.com/Hoxbro/clean_notebook ref None select ignore exclude
replication-child-benefit (+1, -0)
+ Fixed 5 errors. |
Checked some more projects: ℹ️ ecosystem check detected changes. (+0, -0, 67 error(s)) django-continuous-delivery (error)https://github.com/20tab/django-continuous-delivery ref main select ignore exclude
jupyter_server (error)https://github.com/jupyter-server/jupyter_server ref None select ignore exclude
my_language_modeling (error)https://github.com/Bing-su/my_language_modeling ref main select ignore exclude
python-start-project (error)https://github.com/EndlessTrax/python-start-project ref main select ignore exclude
ruff-vscode (error)https://github.com/yaegassy/ruff-vscode ref main select ignore exclude
Machine_Learning_Mask_Cassifier (error)https://github.com/GiuliaGualtieri/Machine_Learning_Mask_Cassifier ref main select ignore exclude
cookiecutter-poetry (error)https://github.com/fpgmaas/cookiecutter-poetry ref main select ignore exclude
matter-library-template (error)https://github.com/Matter-Tech/matter-library-template ref None select ignore exclude
astronomer-cosmos (error)https://github.com/astronomer/astronomer-cosmos ref None select ignore exclude
wetterdienst_update (error)https://github.com/MrMalte211/wetterdienst_update ref main select ignore exclude
Bear (error)https://github.com/godzail/Bear ref main select ignore exclude
python-whiteprint (error)https://github.com/RomainBrault/python-whiteprint ref main select ignore exclude
symmeplot (error)https://github.com/TJStienstra/symmeplot ref master select ignore exclude
py-listmonk (error)https://github.com/Tobi-De/py-listmonk ref None select ignore exclude
use-case-registry (error)https://github.com/Tomperez98/use-case-registry ref main select ignore exclude
whats-this-payload (error)https://github.com/Tomperez98/whats-this-payload ref main select ignore exclude
mvp-projects_easy-cloud-cli (error)https://github.com/actions-marketplace-validations/mvp-projects_easy-cloud-cli ref main select ignore exclude
samuelcolvin_list-python-dependencies (error)https://github.com/actions-marketplace-validations/samuelcolvin_list-python-dependencies ref main select ignore exclude
TinyNeuralNetwork (error)https://github.com/alibaba/TinyNeuralNetwork ref None select ignore exclude
concrete-numpy (error)https://github.com/zama-ai/concrete-numpy ref main select ignore exclude
safejax (error)https://github.com/alvarobartt/safejax ref main select ignore exclude
astro-providers-databricks (error)https://github.com/astronomer/astro-providers-databricks ref None select ignore exclude
hatch (error)https://github.com/pypa/hatch ref None select ignore exclude
schematalog (error)https://github.com/berislavlopac/schematalog ref None select ignore exclude
casbench (error)https://github.com/brocksam/casbench ref main select ignore exclude
experiment-template (error)DEBUG:__main__:Finished 1656 repositories https://github.com/climatepolicyradar/experiment-template ref main select ignore exclude
robotcode (error)https://github.com/d-biehl/robotcode ref None select ignore exclude
dagster (error)https://github.com/dagster-io/dagster ref None select ignore exclude
edgartools (error)https://github.com/dgunning/edgartools ref None select ignore exclude
explicitor (error)https://github.com/din14970/explicitor ref master select ignore exclude
icli-python (error)https://github.com/druagoon/icli-python ref master select ignore exclude
mlops-project-template (error)https://github.com/elacosse/mlops-project-template ref main select ignore exclude
poetry-project-template (error)https://github.com/elacosse/poetry-project-template ref main select ignore exclude
pydantic (error)https://github.com/theonlykingpin/pydantic ref master select ignore exclude
poetry-cookiecutter (error)https://github.com/jevandezande/poetry-cookiecutter ref master select ignore exclude
fulmo-cookiecutter-poetry (error)https://github.com/jexio/fulmo-cookiecutter-poetry ref main select ignore exclude
gitlint (error)https://github.com/jorisroovers/gitlint ref None select ignore exclude
imdm (error)https://github.com/josegcpa/imdm ref master select ignore exclude
sqlalchemy-file (error)https://github.com/jowilf/sqlalchemy-file ref main select ignore exclude
github-wikidata-bot (error)https://github.com/konstin/github-wikidata-bot ref main select ignore exclude
cookiecutter-backend-service-aws (error)https://github.com/mikelane/cookiecutter-backend-service-aws ref main select ignore exclude
cookiecutter-python-library (error)https://github.com/mikelane/cookiecutter-python-library ref main select ignore exclude
easy-cloud-cli (error)https://github.com/mvp-projects/easy-cloud-cli ref main select ignore exclude
easy-cloud-publish (error)https://github.com/mvp-projects/easy-cloud-publish ref main select ignore exclude
cookiecutter-fastapi-backend (error)https://github.com/nickatnight/cookiecutter-fastapi-backend ref master select ignore exclude
extensionlib (error)https://github.com/ofek/extensionlib ref None select ignore exclude
manga-dlp (error)https://github.com/olofvndrhr/manga-dlp ref master select ignore exclude
PyPulley (error)https://github.com/pmason314/PyPulley ref main select ignore exclude
matplotlib-scalebar (error)https://github.com/ppinard/matplotlib-scalebar ref None select ignore exclude
pydantic-extra-types (error)https://github.com/pydantic/pydantic-extra-types ref main select ignore exclude
pipx (error)https://github.com/pypa/pipx ref None select ignore exclude
genvi (error)https://github.com/ruksi/genvi ref main select ignore exclude
list-python-dependencies (error)https://github.com/samuelcolvin/list-python-dependencies ref main select ignore exclude
cookiecutter-python (error)https://github.com/sanders41/cookiecutter-python ref main select ignore exclude
sympy (error)https://github.com/sympy/sympy ref None select ignore exclude
jma-scraper (error)https://github.com/t-edzuka/jma-scraper ref main select ignore exclude
ondotori-client (error)https://github.com/t-edzuka/ondotori-client ref main select ignore exclude
ternaus-cleantext (error)https://github.com/ternaus/ternaus-cleantext ref main select ignore exclude
emoji-papertrail (error)https://github.com/thomasdesr/emoji-papertrail ref main select ignore exclude
fastapi (error)https://github.com/tiangolo/fastapi ref None select ignore exclude
proxiflow (error)https://github.com/tomesm/proxiflow ref main select ignore exclude
tools (error)https://github.com/uoft-networking/tools ref main select ignore exclude
cloudflare-stats (error)https://github.com/yaleman/cloudflare-stats ref main select ignore exclude
homepage (error)https://github.com/yaleman/homepage ref main select ignore exclude
td4-py (error)https://github.com/yashikota/td4-py ref master select ignore exclude
authx (error)https://github.com/yezz123/authx ref None select ignore exclude
fastapi-class (error)https://github.com/yezz123/fastapi-class ref None select ignore exclude
|
FYI, at least some build backends (flit-core) ignore the But what you are seeing is pre-acceptance support for PEP 639's license as a sting in build backends like setuptools and hatchling. FYI, I'd be careful about non-backends doing too much validation on pyproject.toml, especially if it's not opt-in by the package for that explicit reason. I'm working on several PEP's to improve pyproject.toml, and there's PEP 639, etc. - it's not set in stone, and non-backends validating it can cause issues making changes to the format. (One proposal I have would change |
Finally puts pep508_rs and pep440_rs to good use :D
This also means that we now implicitly check for invalid pyproject.toml files.