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

[pyproject.toml: part 2] Add vendored deps (tomli and validate-pyproject) #3066

Merged
merged 9 commits into from
Mar 18, 2022

Conversation

abravalheri
Copy link
Contributor

@abravalheri abravalheri commented Feb 1, 2022

This is part of #2970, split into several stacked PRs as requested in #2970 (review)
Follows #3065

Some extra dependencies can be used to support pyproject.toml configuration. This PR just adds them as vendored packages.

Summary of changes

  • Add tomli as vendorised dependency - 3cc64ee
  • Add validate-pyproject as a vendored dependency - d826bd2

Pull Request Checklist

setuptools/_vendor/tomli/__init__.py Outdated Show resolved Hide resolved
setuptools/_vendor/tomli/_parser.py Outdated Show resolved Hide resolved
setuptools/_vendor/tomli/_re.py Outdated Show resolved Hide resolved
setuptools/_vendor/vendored.txt Outdated Show resolved Hide resolved
Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't review the contents of the vendored code or the auto-generated notices, but overall this looks good to me.

@blink1073
Copy link
Contributor

For context, I maintain jupyter-packaging (an extension and custom build backend for setuptools) and am looking forward to using this feature there.

@abravalheri
Copy link
Contributor Author

Every help is appreciated! Thanks a lot @blink1073

@abravalheri abravalheri marked this pull request as ready for review February 3, 2022 10:22
@abravalheri abravalheri force-pushed the separte-setup-cfg-config branch from 8172065 to a7f89a8 Compare February 7, 2022 23:36
@blink1073
Copy link
Contributor

The relative import changes look good to me

@abravalheri
Copy link
Contributor Author

abravalheri commented Feb 7, 2022

Thank you @blink1073. I decided to rewrite the imports as you suggested, since after a second read of setuptools.extern I was no longer sure about how it would work...

Thank you very much for the review!

@hukkin
Copy link

hukkin commented Feb 8, 2022

Just an FYI: some changes were made to Tomli specifically with vendoring in mind (for flit_core), If you vendor master branch you shouldn't need to apply any of the recent changes (i.e. the def rewrite_tomli function). I can also make an early release if it helps you :)

@abravalheri
Copy link
Contributor Author

Thanks @hukkin that would help a lot!

I have seen these the changes, but since they were not released I decided implemented this logic to be consistent with the same logic setuptools uses when vendoring other packages 😅.

@hukkin
Copy link

hukkin commented Feb 8, 2022

tomli==2.0.1 is now on PyPI!

@abravalheri
Copy link
Contributor Author

Thank you very much @hukkin!
I have updated the vendored dependency and removed the customisation.

tools/vendored.py Outdated Show resolved Hide resolved
tools/vendored.py Outdated Show resolved Hide resolved
tools/vendored.py Outdated Show resolved Hide resolved
@abravalheri
Copy link
Contributor Author

Thank you very much for the review and comments @webknjaz. I spend a long time today implementing the suggested changes, but now that I tried to push I cannot see any of them in the diff 😭. Probably there it was a problems with some rebase conflicts (I was trying to rebase all the branches to make sure all the changes don't cause errors for the following PRs).

I will have to revisit again the review later 😢

@abravalheri
Copy link
Contributor Author

Review addressed and suggestions adopted! Thank you @webknjaz

@abravalheri abravalheri force-pushed the separte-setup-cfg-config branch from 6a43bd7 to 0d8820d Compare February 11, 2022 18:52
@abravalheri abravalheri changed the title [pyproject.toml: part 3] Add vendored deps (tomli and validate-pyproject) [pyproject.toml: part 2] Add vendored deps (tomli and validate-pyproject) Feb 11, 2022
@abravalheri abravalheri force-pushed the separte-setup-cfg-config branch from 9ed7109 to 5cf0cdc Compare February 18, 2022 22:38
@abravalheri abravalheri force-pushed the separte-setup-cfg-config branch from 5cf0cdc to c35a43d Compare February 19, 2022 19:26
abravalheri added a commit to abravalheri/setuptools that referenced this pull request Feb 19, 2022
Extra dependencies can be used to support project metadata in
`pyproject.toml`.
abravalheri added a commit to abravalheri/setuptools that referenced this pull request Feb 20, 2022
Extra dependencies can be used to support project metadata in
`pyproject.toml`.
abravalheri added a commit that referenced this pull request Feb 20, 2022
Extra dependencies can be used to support project metadata in
`pyproject.toml`.
abravalheri and others added 8 commits March 5, 2022 09:58
This eventually will allow reading project metadata directly from
`pyproject.toml`
In order to minimise dependencies, `validate-pyproject` has the ability
to "dump" only the code necessary to run the validations to a given
directory. This special strategy is used instead of the default
`pip install -t`.

The idea of using JSONSchema for validation was suggested in #2671,
and the rationale for that approach is further discussed in
https://github.com/abravalheri/validate-pyproject/blob/main/docs/faq.rst

Using a library such as `validate-pyproject` has the advantage of
incentive sing reuse and collaboration with other projects.

Currently `validate-pyproject` ships a JSONSchema for the proposed
use of `pyproject.toml` as means of configuration for setuptools.
In the future, if there is interest, setuptools could also ship its own
schema and just use the shared infrastructure of `validate-pyproject`
(by advertising the schemas via entry-points).
Enforcing local imports is no longer needed.
@abravalheri abravalheri force-pushed the separte-setup-cfg-config branch from c35a43d to e5d2bc8 Compare March 5, 2022 10:26
Base automatically changed from separte-setup-cfg-config to support-pyproject-aggregate March 18, 2022 10:07
@abravalheri abravalheri merged commit 088d467 into support-pyproject-aggregate Mar 18, 2022
@abravalheri abravalheri deleted the add-vendored-deps branch March 18, 2022 10:08
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.

4 participants