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

Restore PyPI landing page #4520

Merged
merged 4 commits into from
Sep 20, 2022
Merged

Restore PyPI landing page #4520

merged 4 commits into from
Sep 20, 2022

Conversation

ofek
Copy link
Contributor

@ofek ofek commented Sep 15, 2022

Addresses #4473 (comment) by using @hynek's plugin

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM. I saw this plugin the other day and was thinking of using it.

Thanks @ofek.

And thanks @hynek for the plugin!

pyproject.toml Outdated
]

[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '#(\d+)'
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to require a space before the issue ID here like we do on usernames, or we could use a negative lookbehind to omit cases with \w directly before #. This caught us recently and the second point on v1.10.2 is currently messed up.

Copy link
Contributor Author

@ofek ofek Sep 15, 2022

Choose a reason for hiding this comment

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

pyproject.toml Outdated
content-type = 'text/markdown'
fragments = [
{ path = 'README.md' },
{ path = 'HISTORY.md' },
Copy link
Member

Choose a reason for hiding this comment

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

does this insert the new lines required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup

@samuelcolvin
Copy link
Member

oh, sorry I just fixed pyproject.toml, I thought it wouldn't conflict, but it seems to. Are you okay to fix conflicts? 🙏

@hynek
Copy link

hynek commented Sep 15, 2022

Heh I live to serve. :) JFTR, your change log is getting a bit long, so if you need help to cut it to the latest release LMK.

@samuelcolvin
Copy link
Member

Ye, might be nice to include just releases after v1 or similar.

I think easiest solution would be to split HISTORY.md, an keep the older history just for https://pydantic-docs.helpmanual.io/changelog/.

Then we can add a link to the end of HISTORY.md along the lines of "For everything else, see here."

@hynek
Copy link

hynek commented Sep 15, 2022

Sure that works too, but it feels wrong to me to neuter the OG file. :) Check out how doc2dash does it – it's just a bunch of regexps:

@samuelcolvin
Copy link
Member

Makes sense. @ofek if you want to put a magic comment in HISTORY.md <!-- package_description_limit --> after V1, then ignore everything after that, that would be great.

@ofek
Copy link
Contributor Author

ofek commented Sep 15, 2022

Addressed!

pyproject.toml Show resolved Hide resolved
@samuelcolvin
Copy link
Member

Yes, but does this use the current actual license file, or a generic "MIT" label.

@ofek
Copy link
Contributor Author

ofek commented Sep 15, 2022

In wheel it's under pydantic-X.Y.Z.dist-info/licenses/

@ofek
Copy link
Contributor Author

ofek commented Sep 15, 2022

Capture

@hynek
Copy link

hynek commented Sep 16, 2022

FWIW these are separate problems:

A file called LICENSE (and some others which already led to Fedora packagers pester me about it) is always added courtesy of wheel: https://github.com/pypa/wheel/blob/5edc61d2c6535c380fa278bc83c578fbd5444167/src/wheel/bdist_wheel.py#L450

This is what's controlled by license-files = { paths = ['LICENSE'] } and dnserver wheel has the LICENSE file where it belongs:

Screenshot 2022-09-16 at 08 59 57@2x


The PyPI metadata is set using project.license and has only very recently been fixed by Hatchling (1.9 if I'm not mistaken).

You can see in https://pypi.org/project/doc2dash/ meta section that it shows correctly License: MIT License (MIT). I have also released a few packages with the full license in there.

The PEP-conformant way isn't license = "MIT" but license = { text = "MIT" }, otherwise e.g. VS Code will yell at you that license has to be a dict:

Screenshot 2022-09-16 at 08 58 11@2x

@samuelcolvin
Copy link
Member

Thanks so much for the thorough explanation @hynek.

@ofek, given all the subtleties here, let's go with the most vanilla and correct approach license = { text = "MIT" }.

@ofek
Copy link
Contributor Author

ofek commented Sep 16, 2022

That's not what's happening here actually.

  1. The only backend that uses https://github.com/pypa/wheel is setuptools. The code is here: https://github.com/pypa/hatch/blob/hatchling-v1.9.0/backend/src/hatchling/metadata/core.py#L614-L615
  2. That section on PyPI is not what one may think. It's "License: {license_classifier.split(' :: ')[-1]} ({license['text']})". Notice a Hatch project: https://pypi.org/project/platformdirs/2.5.2/
  3. Hatchling is the first to support PEP 639 (specifically the end result of that Discourse thread) which allows for a string and deprecates the table. There are no more blockers for approval other than time.

@hynek
Copy link

hynek commented Sep 16, 2022

  1. The only backend that uses https://github.com/pypa/wheel is setuptools. The code is here: https://github.com/pypa/hatch/blob/hatchling-v1.9.0/backend/src/hatchling/metadata/core.py#L614-L615

Ugh, back when I was on setuptools, they told me that they can't do anything because it's all in wheel. This will take a few years to untangle I guess… Anyhow, the effect stands since you're using the same patterns. :)

  1. Hatchling is the first to support PEP 639 (specifically the end result of that Discourse thread) which allows for a string and deprecates the table. There are no more blockers for approval other than time.

Cool! I'm not one to insist on packaging PEP peculiarities. I just noticed that my editor is yelling at me. :)


Anyhow, I don't mean to derail this any further.

@ofek
Copy link
Contributor Author

ofek commented Sep 18, 2022

Shall I go back to using the new way then?

@samuelcolvin
Copy link
Member

I think this is good, but I need to review one more time. Will do on Tuesday.

@samuelcolvin
Copy link
Member

Thanks so much for this @ofek.

I've tweaked the setup slightly to make it a little more concise and IMO more readable, hope that's okay with you.

@samuelcolvin samuelcolvin enabled auto-merge (squash) September 20, 2022 10:46
@samuelcolvin samuelcolvin merged commit 523c622 into pydantic:main Sep 20, 2022
@ofek ofek deleted the readme branch September 20, 2022 12:35
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

3 participants