Skip to content

Conversation

@jobselko
Copy link
Contributor

@jobselko jobselko commented Sep 4, 2025

closes #625

@jobselko jobselko self-assigned this Sep 4, 2025
@github-actions github-actions bot added no-changelog multi-commit Add to bypass single commit lint check no-issue labels Sep 4, 2025
@jobselko jobselko force-pushed the close_625 branch 2 times, most recently from 16f7486 to 03e61c7 Compare September 8, 2025 21:52
@github-actions github-actions bot removed the multi-commit Add to bypass single commit lint check label Sep 8, 2025
@jobselko jobselko force-pushed the close_625 branch 2 times, most recently from c7e19ec to 6647217 Compare September 8, 2025 22:06
Copy link
Contributor

@gerrod3 gerrod3 left a comment

Choose a reason for hiding this comment

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

This PR looks like it is coming along well.

@jobselko jobselko force-pushed the close_625 branch 4 times, most recently from 5f68a09 to 5ad38d9 Compare September 23, 2025 23:20
Copy link
Contributor

@gerrod3 gerrod3 left a comment

Choose a reason for hiding this comment

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

Couple changes left.

packagetype = models.TextField(choices=PACKAGE_TYPES)
python_version = models.TextField()
sha256 = models.CharField(db_index=True, max_length=64)
sha256_metadata = models.CharField(max_length=64)
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be nullable since we will only get values for wheels and only if we download the artifact and extract the wheel. On-demand syncs won't be able to get this value since it's not in the PYPI JSON api (but maybe we can try the packages simple JSON api, probably in another PR).

Copy link
Contributor

Choose a reason for hiding this comment

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

Should there be a management command capable of downloading the packages and updating the values from the packages?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe, we have a repair command and endpoint that could do this.

Comment on lines +461 to +465
# todo (from new PEPs):
# size (v1.1, PEP 700)
# upload-time (v1.1, PEP 700)
# core-metadata (PEP 7.14)
# provenance (v1.3, PEP 740)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's leave these for future PRs

Copy link
Contributor

@dralley dralley Oct 29, 2025

Choose a reason for hiding this comment

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

do you want the comments wholly removed? I can create new issues for them if they don't already exist

Copy link
Contributor

Choose a reason for hiding this comment

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

Keep the comments, lets file new issues for them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Want links to the new issues in the comments themselves?

Copy link
Contributor

Choose a reason for hiding this comment

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

No it's fine as long as the issue states the PEP.

"""TODO This serial constant is temporary until Python repositories implements serials"""
PYPI_SERIAL_CONSTANT = 1000000000

PYPI_API_VERSION = "1.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be named SIMPLE_API_VERSION? Also the meta tag in the simple_index_template should be updated to the tag they expect <meta name="pypi:repository-version" content="{SIMPLE_API_VERSION}">

Copy link
Contributor

Choose a reason for hiding this comment

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

It could go either way, I hate the name "simple api" in general, especially now that it refers to completely and utterly different APIs... On the other hand "PyPI api" is maybe too specific?

I lean towards PYPI_API but it's marginal.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the rename is better since this constant is for the simple api, both the html and json versions: https://packaging.python.org/en/latest/specifications/simple-repository-api/ and it falls under the /simple/ urls.

There is a separate PyPI json api (that we use for syncing) that is "unique" to PyPI (https://docs.pypi.org/api/json/) and falls under the /pypi/ urls, which we also implement so we can perform Pulp-to-Pulp syncing.

If you don't like SIMPLE_API you can also name it INDEX_API since that is also what it is called.

{% for name, path, sha256 in project_packages %}
<a href="{{ path }}#sha256={{ sha256 }}" rel="internal">{{ name }}</a><br/>
{% for pkg in project_packages %}
<a href="{{ pkg.url }}#sha256={{ pkg.sha256 }}" rel="internal">{{ pkg.filename }}</a><br/>
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think of adding some of the link attributes like `data-yanked``? https://packaging.python.org/en/latest/specifications/simple-repository-api/#project-detail

Copy link
Contributor

Choose a reason for hiding this comment

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

We could also do this in a future PR and add a todo item here.

Copy link
Contributor

@dralley dralley Oct 29, 2025

Choose a reason for hiding this comment

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

I'll look into how much work this will require, probably to be done in a separate PR, but I can file an issue for it separately

metadata_relative_path = f"{project_dir}index.html"

with open(metadata_relative_path, "w") as simple_metadata:
# todo?
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's leave this for the future. We might not implement the feature for publications if we are planning to remove them for Pulp 4.

Copy link
Contributor

@dralley dralley Oct 29, 2025

Choose a reason for hiding this comment

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

What actually is the TODO item here? Produce JSON for the publications yeah? In any case I agree so long as the current recommended workflow doesn't involve publications. If it does then that would be a little awkward

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes that is the todo, currently our docs doesn't mention that you don't need publications (https://pulpproject.org/pulp_python/docs/user/guides/publish/) or that new features are not implemented for publications.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well in that case we should probably file an issue to fix that documentation -- would you say that the publication workflow is actually deprecated already?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, it's not deprecated in the sense that we will still fix issues with it, but we will point users to use the new preferred method if they want all the latest features.

"filename": release_package.filename,
"url": d_url,
"sha256": release_package.digests.get("sha256", ""),
# todo: more fields?
Copy link
Contributor

Choose a reason for hiding this comment

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

I think pypi-simple can extract all the fields so I would say yes, let's add them. We will also need to update pull_through_package_simple to take in the media type to see if we should respond with html or json.

Copy link
Contributor

Choose a reason for hiding this comment

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

ack

Comment on lines +212 to +215
# todo: how to get these / should they be here?
# data["yanked"] = False
# data["yanked_reason"] = ""
# data["sha256_metadata"] = ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# todo: how to get these / should they be here?
# data["yanked"] = False
# data["yanked_reason"] = ""
# data["sha256_metadata"] = ""

Handling them in parse_project_metadata should be fine.

"platform": content.platform or "",
"requires_dist": json_to_dict(content.requires_dist) or None,
"classifiers": json_to_dict(content.classifiers) or None,
# todo yanked
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we have the field we can give the value now.

if package["yanked"] and package["yanked_reason"]
else package["yanked"]
),
# gpg-sig (not in warehouse)
Copy link
Contributor

Choose a reason for hiding this comment

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

@gerrod3 Do you know why this is on the list? GPG signature support was removed from warehouse, of course other indexes could support it, but is there a good reason to do that? PEP 740 seems to be a replacement?

Copy link
Contributor

Choose a reason for hiding this comment

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

If you support it then you can put it in the response, but yeah we don't since warehouse doesn't so lets remove the comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PULP-713] Add support for new JSON simple index

3 participants