Skip to content

Fix package name normalization for package pypi json view#717

Merged
gerrod3 merged 1 commit into
pulp:mainfrom
gerrod3:normalize-name-pypi
Aug 13, 2024
Merged

Fix package name normalization for package pypi json view#717
gerrod3 merged 1 commit into
pulp:mainfrom
gerrod3:normalize-name-pypi

Conversation

@gerrod3

@gerrod3 gerrod3 commented Aug 8, 2024

Copy link
Copy Markdown
Contributor

fixes: #716

@quba42

quba42 commented Aug 8, 2024

Copy link
Copy Markdown

I will try to test this patch today.

remote = python_remote_factory(includes=["oslo.utils"], url="https://pypi.org")
repo = python_repo_with_sync(remote)
distro = python_distribution_factory(repository=repo)
# Test pulp 2 pulp full sync w/ live pypi apis

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I read pulp2. 🤦

Comment on lines +110 to +114
pub = python_publication_factory(repository=repo)
distro2 = python_distribution_factory(publication=pub)
remote3 = python_remote_factory(includes=[], url=distro2.base_url)
repo3 = python_repo_with_sync(remote3)
summary2 = python_content_summary(repository_version=repo3.latest_version_href)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pulp_python can distribute with and without publications?
What is the difference? Can we deprecate and remove publications?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, ever since I added the live api to support twine uploads publications were no longer necessary. Publications are still around to remain backwards compatible. The main difference is that publications are slightly more performant since we don't have to dynamically generate the simple files during pip installs. During pulp2pulp syncs it really is no different then the live api.

We probably could deprecate them, I would want to ask the community first if they would be okay with this. (Probably would also want to do some testing to see how much of a performance hit it would be).

remote2 = python_remote_factory(includes=[], url=distro.base_url)
repo2 = python_repo_with_sync(remote2)
summary = python_content_summary(repository_version=repo2.latest_version_href)
assert summary.present["python.python"]["count"] > 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd love to see a bit more explanation here, why this assertion actually tells me that everything is ok. Maybe we need a short explanation of the bug that was fixed to describe that accurately.
Should we not also see the exact same number of content as in the repo here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right we should see the same amount, forgot to add the check.

@quba42

quba42 commented Aug 8, 2024

Copy link
Copy Markdown

I can confirm this code change fixes the issue in our Katello setup. I added the fix to both the Katello server and the proxy server for the Pulp to Pulp sync (not certain if it was needed on both ends), and now python packages with dot in the name also appear in the Pulp distribution on the proxy.

@quba42

quba42 commented Aug 8, 2024

Copy link
Copy Markdown

@gerrod3 Any chance you can back-port this fix as far back as 3.11 or even 3.10 once it is reviewed and merged?

@mdellweg

mdellweg commented Aug 8, 2024

Copy link
Copy Markdown
Member

I see only 3.11 in the supported branches. Do we need to adjust that?

@quba42

quba42 commented Aug 8, 2024

Copy link
Copy Markdown

I see only 3.11 in the supported branches. Do we need to adjust that?

I am going to say "no".

If it would have been trivial to backport to 3.10 I would have asked for it, but we mainly need 3.11 (used by Katello >= 4.13 with pulpcore 3.49). => I am happy with a back-port down to 3.11!

@gerrod3 gerrod3 force-pushed the normalize-name-pypi branch from 8a670b8 to 4880949 Compare August 8, 2024 16:54
python_distribution_factory,
python_content_summary,
):
"""Test that Pulp can handle syncing packages with wierd names."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
"""Test that Pulp can handle syncing packages with wierd names."""
"""Test that Pulp can handle syncing packages with weird names."""

Or even more percise: "handle packages that contain dots"

@patchback

patchback Bot commented Aug 13, 2024

Copy link
Copy Markdown

Backport to 3.11: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply fc43b4b on top of patchback/backports/3.11/fc43b4b253dbec5931d6a230296942e4ba52ec3e/pr-717

Backporting merged PR #717 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/pulp/pulp_python.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.11/fc43b4b253dbec5931d6a230296942e4ba52ec3e/pr-717 upstream/3.11
  4. Now, cherry-pick PR Fix package name normalization for package pypi json view #717 contents into that branch:
    $ git cherry-pick -x fc43b4b253dbec5931d6a230296942e4ba52ec3e
    If it'll yell at you with something like fatal: Commit fc43b4b253dbec5931d6a230296942e4ba52ec3e is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x fc43b4b253dbec5931d6a230296942e4ba52ec3e
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Fix package name normalization for package pypi json view #717 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.11/fc43b4b253dbec5931d6a230296942e4ba52ec3e/pr-717
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Aug 13, 2024

Copy link
Copy Markdown

Backport to 3.12: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.12/fc43b4b253dbec5931d6a230296942e4ba52ec3e/pr-717

Backported as #725

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback Bot pushed a commit that referenced this pull request Aug 13, 2024
Fix package name normalization for package pypi json view

(cherry picked from commit fc43b4b)
mdellweg added a commit that referenced this pull request Aug 13, 2024
…dbec5931d6a230296942e4ba52ec3e/pr-717

[PR #717/fc43b4b2 backport][3.12] Fix package name normalization for package pypi json view
@gerrod3 gerrod3 deleted the normalize-name-pypi branch August 19, 2024 13:22
gerrod3 added a commit to gerrod3/pulp_python that referenced this pull request Aug 19, 2024
Fix package name normalization for package pypi json view

(cherry picked from commit fc43b4b)
gerrod3 added a commit to gerrod3/pulp_python that referenced this pull request Aug 19, 2024
Merge pull request pulp#717 from gerrod3/normalize-name-pypi
(cherry picked from commit fc43b4b)
gerrod3 added a commit that referenced this pull request Aug 21, 2024
…253dbec5931d6a230296942e4ba52ec3e/pr-717

Backport #717 to 3.11
@patchback

patchback Bot commented Jul 14, 2025

Copy link
Copy Markdown

Backport to 3.10: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply fc43b4b on top of patchback/backports/3.10/fc43b4b253dbec5931d6a230296942e4ba52ec3e/pr-717

Backporting merged PR #717 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/pulp/pulp_python.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.10/fc43b4b253dbec5931d6a230296942e4ba52ec3e/pr-717 upstream/3.10
  4. Now, cherry-pick PR Fix package name normalization for package pypi json view #717 contents into that branch:
    $ git cherry-pick -x fc43b4b253dbec5931d6a230296942e4ba52ec3e
    If it'll yell at you with something like fatal: Commit fc43b4b253dbec5931d6a230296942e4ba52ec3e is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x fc43b4b253dbec5931d6a230296942e4ba52ec3e
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Fix package name normalization for package pypi json view #717 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.10/fc43b4b253dbec5931d6a230296942e4ba52ec3e/pr-717
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

jobselko pushed a commit to jobselko/pulp_python that referenced this pull request Jul 14, 2025
Fix package name normalization for package pypi json view

(cherry picked from commit fc43b4b)
jobselko pushed a commit to jobselko/pulp_python that referenced this pull request Jul 14, 2025
Fix package name normalization for package pypi json view

(cherry picked from commit fc43b4b)
jobselko pushed a commit to jobselko/pulp_python that referenced this pull request Jul 15, 2025
Fix package name normalization for package pypi json view

(cherry picked from commit fc43b4b)
jobselko added a commit that referenced this pull request Jul 18, 2025
…b253dbec5931d6a230296942e4ba52ec3e/pr-717

[PR #717/fc43b4b2 backport][3.10] Fix package name normalization for package pypi json view
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.

Packages containing a dot in the name are lost during Pulp to Pulp syncs

5 participants