Skip to content
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

Closed
wants to merge 4 commits into from
Closed

Use the pyproject-toml crate #3813

wants to merge 4 commits into from

Conversation

konstin
Copy link
Member

@konstin konstin commented Mar 30, 2023

Finally puts pep508_rs and pep440_rs to good use :D

This also means that we now implicitly check for invalid pyproject.toml files.

@konstin
Copy link
Member Author

konstin commented Mar 30, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@@ -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" }
Copy link
Member Author

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.

@MichaReiser
Copy link
Member

MichaReiser commented Mar 30, 2023

This also means that we now implicitly check for invalid pyproject.toml files.

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.

Base automatically changed from 03-30-released_pep440_rs to main March 30, 2023 12:47
@konstin
Copy link
Member Author

konstin commented Mar 30, 2023

yes, both are correct. A non-PEP 621 compliant pyproject.toml will fail. I would be surprised if the additional parsing time is noticeable ([project] is small), there's some benchmark numbers in https://epage.github.io/blog/2023/01/toml-vs-toml-edit/. Another advantage is that we can in the future use more packaging metadata (e.g. direct dependencies for rule selection and entrypoints to verify them)

@github-actions
Copy link

github-actions bot commented Mar 30, 2023

PR Check Results

Ecosystem

ℹ️ ecosystem check detected changes. (+0, -0, 1 error(s))

scikit-build (error)

error: TOML parse error at line 9, column 11
  |
9 | license = "MIT"
  |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


Benchmark

Linux

group                                      main                                    pr
-----                                      ----                                    --
linter/all-rules/large/dataset.py          1.00     14.4±0.10ms     2.8 MB/sec     1.03     14.9±0.77ms     2.7 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.6±0.05ms     4.6 MB/sec     1.01      3.7±0.04ms     4.6 MB/sec
linter/all-rules/numpy/globals.py          1.00    470.4±1.48µs     6.3 MB/sec     1.00    468.3±0.84µs     6.3 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.1±0.06ms     4.2 MB/sec     1.02      6.2±0.05ms     4.1 MB/sec
linter/default-rules/large/dataset.py      1.03      7.5±0.27ms     5.4 MB/sec     1.00      7.3±0.04ms     5.6 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.15  1865.5±182.99µs     8.9 MB/sec    1.00   1627.0±4.85µs    10.2 MB/sec
linter/default-rules/numpy/globals.py      1.00    181.4±3.13µs    16.3 MB/sec     1.01    182.8±2.67µs    16.1 MB/sec
linter/default-rules/pydantic/types.py     1.09      3.7±0.31ms     7.0 MB/sec     1.00      3.3±0.01ms     7.6 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.00     11.8±0.13ms     3.5 MB/sec    1.00     11.8±0.11ms     3.5 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.1±0.06ms     5.3 MB/sec    1.00      3.1±0.04ms     5.4 MB/sec
linter/all-rules/numpy/globals.py          1.00    325.4±4.71µs     9.1 MB/sec    1.00    323.9±5.27µs     9.1 MB/sec
linter/all-rules/pydantic/types.py         1.00      5.1±0.13ms     5.0 MB/sec    1.00      5.1±0.10ms     5.0 MB/sec
linter/default-rules/large/dataset.py      1.00      6.0±0.08ms     6.7 MB/sec    1.01      6.1±0.08ms     6.6 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1321.3±27.90µs    12.6 MB/sec    1.02  1352.5±20.34µs    12.3 MB/sec
linter/default-rules/numpy/globals.py      1.00    136.4±3.12µs    21.6 MB/sec    1.02    138.6±2.67µs    21.3 MB/sec
linter/default-rules/pydantic/types.py     1.00      2.8±0.03ms     9.2 MB/sec    1.02      2.8±0.03ms     9.0 MB/sec

@konstin konstin changed the title Use the pyprojec-toml crate Use the pyproject-toml crate Mar 30, 2023
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.
Copy link
Member

@MichaReiser MichaReiser left a 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.

@charliermarsh
Copy link
Member

Is the scikit-build error valid?

@konstin
Copy link
Member Author

konstin commented Apr 3, 2023

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
ℹ️ ecosystem check detected changes. (+2, -0, 9 error(s))

typeguard (error)

https://github.com/agronholm/typeguard ref None select ignore exclude

error: TOML parse error at line 40, column 8
   |
40 | test = [
   |        ^^^^^^^^
Expected a valid marker name, found 'python_implementation'
mypy >= 0.991; python_implementation != "PyPy"
               ^^^^^^^^^^^^^^^^^^^^^


pro-orch (error)

https://github.com/shanku007/pro-orch ref None select ignore exclude

error: Required version `0.0.255` does not match the running version `0.0.260`

crawlers (error)

https://github.com/Academia-de-Dados/crawlers ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "GPL-3.0-only"
   |           ^^^^^^^^^^^^^^
invalid type: string "GPL-3.0-only", expected a table with 'file' or 'text' key


authx (error)

https://github.com/yezz123/authx ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


flippers (error)

https://github.com/liamtoran/flippers ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "Apache-2.0"
   |           ^^^^^^^^^^^^
invalid type: string "Apache-2.0", expected a table with 'file' or 'text' key


httpdate (error)

https://github.com/jamielinux/httpdate ref None select ignore exclude

error: TOML parse error at line 13, column 11
   |
13 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


EPP_RFR (+1, -0)

+ Fixed 85 errors.

kafka-http-monitor (error)

https://github.com/jdahlin/kafka-http-monitor ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


griffe (error)

https://github.com/mkdocstrings/griffe ref None select ignore exclude

error: TOML parse error at line 11, column 11
   |
11 | license = "ISC"
   |           ^^^^^
invalid type: string "ISC", expected a table with 'file' or 'text' key


clean_notebook (error)

https://github.com/Hoxbro/clean_notebook ref None select ignore exclude

error: TOML parse error at line 8, column 11
  |
8 | license = "MIT"
  |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


replication-child-benefit (+1, -0)

+ Fixed 5 errors.

@konstin
Copy link
Member Author

konstin commented Apr 3, 2023

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

error: error parsing glob '/tmp/tmpi5lnvxmb/{{cookiecutter.project_dirname}}/__pycache__': nested alternate groups are not allowed

jupyter_server (error) https://github.com/jupyter-server/jupyter_server ref None select ignore exclude

error: TOML parse error at line 9, column 11
  |
9 | license = ""
  |           ^^
invalid type: string "", expected a table with 'file' or 'text' key


my_language_modeling (error) https://github.com/Bing-su/my_language_modeling ref main select ignore exclude

error: TOML parse error at line 4, column 11
  |
4 | license = "MIT"
  |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


python-start-project (error) https://github.com/EndlessTrax/python-start-project ref main select ignore exclude

error: TOML parse error at line 14, column 16
   |
14 | dependencies = [
   |                ^^^^^^^^^^^^^^^
Expected package name starting with an alphanumeric character, found '#'
#TODO
^


ruff-vscode (error) https://github.com/yaegassy/ruff-vscode ref main select ignore exclude

error: TOML parse error at line 16, column 11
   |
16 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


Machine_Learning_Mask_Cassifier (error) https://github.com/GiuliaGualtieri/Machine_Learning_Mask_Cassifier ref main select ignore exclude

error: TOML parse error at line 52, column 3
   |
52 |   "threadpoolctl",
   |   ^
invalid array
expected `]`


cookiecutter-poetry (error) https://github.com/fpgmaas/cookiecutter-poetry ref main select ignore exclude

error: TOML parse error at line 18, column 1
   |
18 | {% if cookiecutter.codecov == 'y' -%}
   | ^
invalid key


matter-library-template (error) https://github.com/Matter-Tech/matter-library-template ref None select ignore exclude

error: TOML parse error at line 6, column 11
  |
6 | license = "MIT"
  |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


astronomer-cosmos (error) https://github.com/astronomer/astronomer-cosmos ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "Apache-2.0"
   |           ^^^^^^^^^^^^
invalid type: string "Apache-2.0", expected a table with 'file' or 'text' key


wetterdienst_update (error) https://github.com/MrMalte211/wetterdienst_update ref main select ignore exclude

error: TOML parse error at line 295, column 20
    |
295 | per-file-ignores = [
    |                    ^^^^^^^^^^^^^^^^^^^^
invalid type: sequence, expected a map


Bear (error) https://github.com/godzail/Bear ref main select ignore exclude

error: TOML parse error at line 258, column 1
    |
258 | [tool.ruff.per-file-ignores]
    | ^
invalid table header
duplicate key `per-file-ignores` in table `tool.ruff`


python-whiteprint (error) https://github.com/RomainBrault/python-whiteprint ref main select ignore exclude

error: TOML parse error at line 1, column 1
  |
1 | {% include "jinja_template/license_header.toml.j2" %}
  | ^
invalid key


symmeplot (error) https://github.com/TJStienstra/symmeplot ref master select ignore exclude

error: TOML parse error at line 1, column 1
  |
1 | [tool.poetry]
  | ^
missing field `name`


py-listmonk (error) https://github.com/Tobi-De/py-listmonk ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


use-case-registry (error) https://github.com/Tomperez98/use-case-registry ref main select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


whats-this-payload (error) https://github.com/Tomperez98/whats-this-payload ref main select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


mvp-projects_easy-cloud-cli (error) https://github.com/actions-marketplace-validations/mvp-projects_easy-cloud-cli ref main select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


samuelcolvin_list-python-dependencies (error) https://github.com/actions-marketplace-validations/samuelcolvin_list-python-dependencies ref main select ignore exclude

error: TOML parse error at line 14, column 11
   |
14 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


TinyNeuralNetwork (error) https://github.com/alibaba/TinyNeuralNetwork ref None select ignore exclude

error: TOML parse error at line 78, column 18
   |
78 | target-version = "py36"
   |                  ^^^^^^
unknown variant `py36`, expected one of `py37`, `py38`, `py39`, `py310`, `py311`


concrete-numpy (error) https://github.com/zama-ai/concrete-numpy ref main select ignore exclude

error: TOML parse error at line 118, column 15
    |
118 | "tests/**" = ["PLC2201"]
    |               ^^^^^^^^^
Unknown rule selector: `PLC2201`


safejax (error) https://github.com/alvarobartt/safejax ref main select ignore exclude

error: TOML parse error at line 32, column 11
   |
32 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


astro-providers-databricks (error) https://github.com/astronomer/astro-providers-databricks ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "Apache-2.0"
   |           ^^^^^^^^^^^^
invalid type: string "Apache-2.0", expected a table with 'file' or 'text' key


hatch (error) https://github.com/pypa/hatch ref None select ignore exclude

error: TOML parse error at line 9, column 11
  |
9 | license = "MIT"
  |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


schematalog (error) https://github.com/berislavlopac/schematalog ref None select ignore exclude

error: TOML parse error at line 5, column 11
  |
5 | license = "MIT"
  |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


casbench (error) https://github.com/brocksam/casbench ref main select ignore exclude

error: TOML parse error at line 1, column 1
  |
1 | [tool.poetry]
  | ^
missing field `name`


experiment-template (error) DEBUG:__main__:Finished 1656 repositories https://github.com/climatepolicyradar/experiment-template ref main select ignore exclude

error: error parsing glob '/tmp/tmphaydgkld/{{ cookiecutter.repo_name }}/__init__.py': nested alternate groups are not allowed

robotcode (error) https://github.com/d-biehl/robotcode ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "Apache-2.0"
   |           ^^^^^^^^^^^^
invalid type: string "Apache-2.0", expected a table with 'file' or 'text' key


dagster (error) https://github.com/dagster-io/dagster ref None select ignore exclude

error: Required version `0.0.255` does not match the running version `0.0.260`

edgartools (error) https://github.com/dgunning/edgartools ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


explicitor (error) https://github.com/din14970/explicitor ref master select ignore exclude

error: TOML parse error at line 32, column 1
   |
32 | max-line-length = 88
   | ^^^^^^^^^^^^^^^
unknown field `max-line-length`, expected one of `allowed-confusables`, `builtins`, `cache-dir`, `dummy-variable-rgx`, `exclude`, `extend`, `extend-exclude`, `extend-ignore`, `extend-select`, `external`, `fix`, `fix-only`, `fixable`, `format`, `force-exclude`, `ignore`, `ignore-init-module-imports`, `line-length`, `required-version`, `respect-gitignore`, `select`, `show-source`, `show-fixes`, `src`, `namespace-packages`, `target-version`, `task-tags`, `typing-modules`, `unfixable`, `update-check`, `flake8-annotations`, `flake8-bandit`, `flake8-bugbear`, `flake8-builtins`, `flake8-comprehensions`, `flake8-errmsg`, `flake8-quotes`, `flake8-self`, `flake8-tidy-imports`, `flake8-type-checking`, `flake8-gettext`, `flake8-implicit-str-concat`, `flake8-import-conventions`, `flake8-pytest-style`, `flake8-unused-arguments`, `isort`, `mccabe`, `pep8-naming`, `pycodestyle`, `pydocstyle`, `pylint`, `pyupgrade`, `per-file-ignores`


icli-python (error) https://github.com/druagoon/icli-python ref master select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


mlops-project-template (error) https://github.com/elacosse/mlops-project-template ref main select ignore exclude

error: TOML parse error at line 1, column 1
  |
1 | {%- set license_classifiers = {
  | ^
invalid key


poetry-project-template (error) https://github.com/elacosse/poetry-project-template ref main select ignore exclude

error: TOML parse error at line 1, column 1
  |
1 | {%- set license_classifiers = {
  | ^
invalid key


pydantic (error) https://github.com/theonlykingpin/pydantic ref master select ignore exclude

error: TOML parse error at line 28, column 11
   |
28 | license = 'MIT'
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


poetry-cookiecutter (error) https://github.com/jevandezande/poetry-cookiecutter ref master select ignore exclude

error: TOML parse error at line 13, column 1
   |
13 | {poetry_dependencies}
   | ^
invalid key


fulmo-cookiecutter-poetry (error) https://github.com/jexio/fulmo-cookiecutter-poetry ref main select ignore exclude

error: TOML parse error at line 1, column 1
  |
1 | {% set license_classifiers = {
  | ^
invalid key


gitlint (error) https://github.com/jorisroovers/gitlint ref None select ignore exclude

error: TOML parse error at line 11, column 11
   |
11 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


imdm (error) https://github.com/josegcpa/imdm ref master select ignore exclude

error: TOML parse error at line 1, column 1
  |
1 | [tool.poetry]
  | ^
missing field `name`


sqlalchemy-file (error) https://github.com/jowilf/sqlalchemy-file ref main select ignore exclude

error: TOML parse error at line 9, column 11
  |
9 | license = "MIT"
  |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


github-wikidata-bot (error) https://github.com/konstin/github-wikidata-bot ref main select ignore exclude

error: TOML parse error at line 1, column 1
  |
1 | [project]
  | ^^^^^^^^^
missing field `name`


cookiecutter-backend-service-aws (error) https://github.com/mikelane/cookiecutter-backend-service-aws ref main select ignore exclude

warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. Ignoring `one-blank-line-before-class`.
warning: `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible. Ignoring `multi-line-summary-second-line`.
error: error parsing glob '/tmp/tmpugkewe_b/{{ cookiecutter.__project_name }}/.bzr': nested alternate groups are not allowed

cookiecutter-python-library (error) https://github.com/mikelane/cookiecutter-python-library ref main select ignore exclude

warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. Ignoring `one-blank-line-before-class`.
warning: `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible. Ignoring `multi-line-summary-second-line`.
error: error parsing glob '/tmp/tmpb1zgf2hj/{{ cookiecutter.__project_name }}/.bzr': nested alternate groups are not allowed

easy-cloud-cli (error) https://github.com/mvp-projects/easy-cloud-cli ref main select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


easy-cloud-publish (error) https://github.com/mvp-projects/easy-cloud-publish ref main select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


cookiecutter-fastapi-backend (error) https://github.com/nickatnight/cookiecutter-fastapi-backend ref master select ignore exclude

error: error parsing glob '/tmp/tmpakk3da4z/{{ cookiecutter.project_slug }}/{{ cookiecutter.backend_container_name }}/.git': nested alternate groups are not allowed

extensionlib (error) https://github.com/ofek/extensionlib ref None select ignore exclude

error: TOML parse error at line 11, column 11
   |
11 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


manga-dlp (error) https://github.com/olofvndrhr/manga-dlp ref master select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


PyPulley (error) https://github.com/pmason314/PyPulley ref main select ignore exclude

error: TOML parse error at line 1, column 1
  |
1 | {%- set license_classifiers = {
  | ^
invalid key


matplotlib-scalebar (error) https://github.com/ppinard/matplotlib-scalebar ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "BSD-2-clause"
   |           ^^^^^^^^^^^^^^
invalid type: string "BSD-2-clause", expected a table with 'file' or 'text' key


pydantic-extra-types (error) https://github.com/pydantic/pydantic-extra-types ref main select ignore exclude

error: TOML parse error at line 15, column 11
   |
15 | license = 'MIT'
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


pipx (error) https://github.com/pypa/pipx ref None select ignore exclude

error: TOML parse error at line 9, column 11
  |
9 | license = "MIT"
  |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


genvi (error) https://github.com/ruksi/genvi ref main select ignore exclude

error: TOML parse error at line 5, column 11
  |
5 | license = "MIT"
  |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


list-python-dependencies (error) https://github.com/samuelcolvin/list-python-dependencies ref main select ignore exclude

error: TOML parse error at line 14, column 11
   |
14 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


cookiecutter-python (error) https://github.com/sanders41/cookiecutter-python ref main select ignore exclude

error: error parsing glob '/tmp/tmpf11g4mye/{{{{cookiecutter.project_slug}}}}': nested alternate groups are not allowed

sympy (error) https://github.com/sympy/sympy ref None select ignore exclude


thread '<unknown>' has overflowed its stack
fatal runtime error: stack overflow

jma-scraper (error) https://github.com/t-edzuka/jma-scraper ref main select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


ondotori-client (error) https://github.com/t-edzuka/ondotori-client ref main select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


ternaus-cleantext (error) https://github.com/ternaus/ternaus-cleantext ref main select ignore exclude

error: TOML parse error at line 34, column 1778
   |
34 | select = ['A', 'A0', 'A00', 'A001', 'A002', 'A003', 'ANN', 'ANN0', 'ANN00', 'ANN001', 'ANN002', 'ANN003', 'ANN1', 'ANN10', 'ANN101', 'ANN102', 'ANN2', 'ANN20', 'ANN201', 'ANN202', 'ANN204', 'ANN205', 'ANN206', 'ANN4', 'ANN40', 'ANN401', 'B', 'B0', 'B00', 'B002', 'B003', 'B004', 'B005', 'B006', 'B007', 'B008', 'B009', 'B01', 'B010', 'B011', 'B012', 'B013', 'B014', 'B015', 'B016', 'B017', 'B018', 'B019', 'B02', 'B020', 'B021', 'B022', 'B023', 'B024', 'B025', 'B026', 'B027', 'B9', 'B90', 'B904', 'BLE', 'BLE0', 'BLE00', 'BLE001', 'C', 'C4', 'C40', 'C400', 'C401', 'C402', 'C403', 'C404', 'C405', 'C406', 'C408', 'C409', 'C41', 'C410', 'C411', 'C413', 'C414', 'C415', 'C416', 'C417', 'C9', 'C90', 'C901', 'D', 'D1', 'D10', 'D100', 'D101', 'D102', 'D103', 'D104', 'D105', 'D106', 'D107', 'D2', 'D20', 'D200', 'D201', 'D202', 'D203', 'D204', 'D205', 'D206', 'D207', 'D208', 'D209', 'D21', 'D210', 'D211', 'D212', 'D213', 'D214', 'D215', 'D3', 'D30', 'D300', 'D4', 'D40', 'D400', 'D402', 'D403', 'D404', 'D405', 'D406', 'D407', 'D408', 'D409', 'D41', 'D410', 'D411', 'D412', 'D413', 'D414', 'D415', 'D416', 'D417', 'D418', 'D419', 'E', 'E4', 'E40', 'E402', 'E5', 'E50', 'E501', 'E7', 'E71', 'E711', 'E712', 'E713', 'E714', 'E72', 'E721', 'E722', 'E73', 'E731', 'E74', 'E741', 'E742', 'E743', 'E9', 'E90', 'E902', 'E99', 'E999', 'ERA', 'ERA0', 'ERA00', 'ERA001', 'F', 'F4', 'F40', 'F401', 'F402', 'F403', 'F404', 'F405', 'F406', 'F407', 'F5', 'F50', 'F501', 'F502', 'F503', 'F504', 'F505', 'F506', 'F507', 'F508', 'F509', 'F52', 'F521', 'F522', 'F523', 'F524', 'F525', 'F54', 'F541', 'F6', 'F60', 'F601', 'F602', 'F62', 'F621', 'F622', 'F63', 'F631', 'F632', 'F633', 'F634', 'F7', 'F70', 'F701', 'F702', 'F704', 'F706', 'F707', 'F72', 'F722', 'F8', 'F82', 'F821', 'F822', 'F823', 'F83', 'F831', 'F84', 'F841', 'F9', 'F90', 'F901', 'FBT', 'FBT0', 'FBT00', 'FBT001', 'FBT002', 'FBT003', 'I', 'I0', 'I00', 'I001', 'I2', 'I25', 'I252', 'N', 'N8', 'N80', 'N801', 'N802', 'N803', 'N804', 'N805', 'N806', 'N807', 'N81', 'N811', 'N812', 'N813', 'N814', 'N815', 'N816', 'N817', 'N818', 'PGH', 'PGH0', 'PGH00', 'PGH001', 'PLC', 'PLC0', 'PLC04', 'PLC041', 'PLC0414', 'PLC2', 'PLC22', 'PLC220', 'PLC2201', 'PLC3', 'PLC30', 'PLC300', 'PLC3002', 'PLE', 'PLE1', 'PLE11', 'PLE114', 'PLE1142', 'PLR', 'PLR0', 'PLR02', 'PLR020', 'PLR0206', 'PLR04', 'PLR040', 'PLR0402', 'PLR1', 'PLR17', 'PLR170', 'PLR1701', 'PLR172', 'PLR1722', 'PLW', 'PLW0', 'PLW01', 'PLW012', 'PLW0120', 'Q', 'Q0', 'Q00', 'Q000', 'Q001', 'Q002', 'Q003', 'RET', 'RET5', 'RET50', 'RET501', 'RET502', 'RET503', 'RET504', 'RET505', 'RET506', 'RET507', 'RET508', 'RUF', 'RUF0', 'RUF00', 'RUF001', 'RUF002', 'RUF003', 'RUF1', 'RUF10', 'RUF100', 'S', 'S1', 'S10', 'S101', 'S102', 'S104', 'S105', 'S106', 'S107', 'T', 'T1', 'T10', 'T100', 'T2', 'T20', 'T201', 'T203', 'U', 'U0', 'U00', 'U001', 'U003', 'U004', 'U005', 'U006', 'U007', 'U008', 'U009', 'U01', 'U010', 'U011', 'U012', 'U013', 'U014', 'U015', 'UP', 'UP0', 'UP00', 'UP001', 'UP003', 'UP004', 'UP005', 'UP006', 'UP007', 'UP008', 'UP009', 'UP01', 'UP010', 'UP011', 'UP012', 'UP013', 'UP014', 'UP015', 'W', 'W2', 'W29', 'W292', 'W6', 'W60', 'W605', 'YTT', 'YTT1', 'YTT10', 'YTT101', 'YTT102', 'YTT103', 'YTT2', 'YTT20', 'YTT201', 'YTT202', 'YTT203', 'YTT204', 'YTT3', 'YTT30', 'YTT301', 'YTT302', 'YTT303']
   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ^^^^^
Unknown rule selector: `F83`


emoji-papertrail (error) https://github.com/thomasdesr/emoji-papertrail ref main select ignore exclude

error: Required version `0.0.220` does not match the running version `0.0.260`

fastapi (error) https://github.com/tiangolo/fastapi ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


proxiflow (error) https://github.com/tomesm/proxiflow ref main select ignore exclude

error: TOML parse error at line 1, column 1
  |
1 | [build-system]
  | ^
missing field `name`


tools (error) https://github.com/uoft-networking/tools ref main select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


cloudflare-stats (error) https://github.com/yaleman/cloudflare-stats ref main select ignore exclude

error: TOML parse error at line 50, column 11
   |
50 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


homepage (error) https://github.com/yaleman/homepage ref main select ignore exclude

error: TOML parse error at line 55, column 11
   |
55 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


td4-py (error) https://github.com/yashikota/td4-py ref master select ignore exclude

error: TOML parse error at line 1, column 1
  |
1 | [tool.poetry]
  | ^
missing field `name`


authx (error) https://github.com/yezz123/authx ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


fastapi-class (error) https://github.com/yezz123/fastapi-class ref None select ignore exclude

error: TOML parse error at line 10, column 11
   |
10 | license = "MIT"
   |           ^^^^^
invalid type: string "MIT", expected a table with 'file' or 'text' key


@henryiii
Copy link
Contributor

henryiii commented Apr 4, 2023

FYI, at least some build backends (flit-core) ignore the license table because there's no clear mapping from that to the license metadata (though it does validate it, it just literally throws it away afterwords). The correct way to specify a license is via Trove Classifers unless you have a custom license (in which case, it's a bit fuzzy until something like PEP 639 goes in). That's actually historically the case too, ever since PEP 314 in 2003 made the License metadata field "Text indicating the license covering the package where the license is not a selection from the “License” Trove classifiers.".

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 project.dynamic into a table, where the keys are the old string values, for example.)

@konstin konstin closed this Apr 16, 2023
@konstin konstin deleted the 03-30-use_pyproject-toml branch June 12, 2023 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants