pulp-python 3.36.0__py3-none-any.whl → 3.36.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pulp_python/app/__init__.py +1 -1
- pulp_python/app/pypi/feeds.py +6 -6
- pulp_python/app/pypi/views.py +11 -2
- pulp_python/tests/functional/api/test_pypi_feeds.py +33 -1
- pulp_python/tests/functional/api/test_pypi_simple_api.py +4 -2
- pulp_python/tests/functional/api/test_simple_cache.py +7 -8
- {pulp_python-3.36.0.dist-info → pulp_python-3.36.2.dist-info}/METADATA +1 -1
- {pulp_python-3.36.0.dist-info → pulp_python-3.36.2.dist-info}/RECORD +12 -12
- {pulp_python-3.36.0.dist-info → pulp_python-3.36.2.dist-info}/WHEEL +0 -0
- {pulp_python-3.36.0.dist-info → pulp_python-3.36.2.dist-info}/entry_points.txt +0 -0
- {pulp_python-3.36.0.dist-info → pulp_python-3.36.2.dist-info}/licenses/LICENSE +0 -0
- {pulp_python-3.36.0.dist-info → pulp_python-3.36.2.dist-info}/top_level.txt +0 -0
pulp_python/app/__init__.py
CHANGED
pulp_python/app/pypi/feeds.py
CHANGED
|
@@ -2,7 +2,7 @@ import re
|
|
|
2
2
|
from email.utils import getaddresses
|
|
3
3
|
from urllib.parse import urljoin
|
|
4
4
|
|
|
5
|
-
from django.db.models import F, FilteredRelation, Min, Q
|
|
5
|
+
from django.db.models import F, FilteredRelation, Max, Min, Q
|
|
6
6
|
from django.http.response import HttpResponse, HttpResponseNotFound
|
|
7
7
|
from django.utils.decorators import method_decorator
|
|
8
8
|
from django.utils.feedgenerator import Rss201rev2Feed
|
|
@@ -15,7 +15,7 @@ from rest_framework.viewsets import ViewSet
|
|
|
15
15
|
from pulp_python.app.cache import PythonApiCache, find_base_path_cached
|
|
16
16
|
from pulp_python.app.pypi.views import PyPIMixin, _etag_func
|
|
17
17
|
|
|
18
|
-
UPDATES_LIMIT =
|
|
18
|
+
UPDATES_LIMIT = 500
|
|
19
19
|
PACKAGES_LIMIT = 40
|
|
20
20
|
PROJECT_RELEASES_LIMIT = 40
|
|
21
21
|
RSS_CONTENT_TYPE = "application/rss+xml; charset=utf-8"
|
|
@@ -66,7 +66,7 @@ def iter_releases(content, repo_ver, name_normalized=None, limit=UPDATES_LIMIT):
|
|
|
66
66
|
qs.order_by()
|
|
67
67
|
.values("name_normalized", "version")
|
|
68
68
|
.annotate(
|
|
69
|
-
added_at=
|
|
69
|
+
added_at=Max("file_added_at"),
|
|
70
70
|
name=Min("name"),
|
|
71
71
|
summary=Min("summary"),
|
|
72
72
|
author_email=Min("author_email"),
|
|
@@ -82,7 +82,7 @@ def iter_projects(content, repo_ver, limit=PACKAGES_LIMIT):
|
|
|
82
82
|
qs.order_by()
|
|
83
83
|
.values("name_normalized")
|
|
84
84
|
.annotate(
|
|
85
|
-
added_at=
|
|
85
|
+
added_at=Max("file_added_at"),
|
|
86
86
|
name=Min("name"),
|
|
87
87
|
summary=Min("summary"),
|
|
88
88
|
author_email=Min("author_email"),
|
|
@@ -98,7 +98,7 @@ def _item_dict(title, link, description, author_email, pubdate):
|
|
|
98
98
|
"description": sanitize_xml_text(description),
|
|
99
99
|
"author_email": format_author(author_email),
|
|
100
100
|
"pubdate": pubdate,
|
|
101
|
-
"unique_id": link,
|
|
101
|
+
"unique_id": f"{link}#{pubdate.isoformat()}",
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
|
|
@@ -118,7 +118,7 @@ def render_rss(title, link, description, items):
|
|
|
118
118
|
author_email=item["author_email"],
|
|
119
119
|
pubdate=item["pubdate"],
|
|
120
120
|
unique_id=item["unique_id"],
|
|
121
|
-
unique_id_is_permalink=
|
|
121
|
+
unique_id_is_permalink=False,
|
|
122
122
|
)
|
|
123
123
|
return feed.writeString("utf-8")
|
|
124
124
|
|
pulp_python/app/pypi/views.py
CHANGED
|
@@ -318,8 +318,17 @@ class SimpleView(PackageUploadMixin, ViewSet):
|
|
|
318
318
|
Uses custom renderers for PyPI Simple API endpoints, defaulting to standard ones.
|
|
319
319
|
"""
|
|
320
320
|
if self.action in ["list", "retrieve"]:
|
|
321
|
-
#
|
|
322
|
-
|
|
321
|
+
# DRF resolves equally-specific media types in renderer order and does not
|
|
322
|
+
# account for q-values. Put the PyPI JSON renderer first when the client
|
|
323
|
+
# explicitly advertises it (as pip and uv do), otherwise retain HTML as the
|
|
324
|
+
# default for browser and legacy clients.
|
|
325
|
+
accept = self.request.META.get("HTTP_ACCEPT", "").lower()
|
|
326
|
+
renderers = [TemplateHTMLRenderer(), PyPISimpleHTMLRenderer()]
|
|
327
|
+
if PYPI_SIMPLE_V1_JSON in accept:
|
|
328
|
+
renderers.insert(0, PyPISimpleJSONRenderer())
|
|
329
|
+
else:
|
|
330
|
+
renderers.append(PyPISimpleJSONRenderer())
|
|
331
|
+
return renderers
|
|
323
332
|
else:
|
|
324
333
|
return [JSONRenderer(), BrowsableAPIRenderer()]
|
|
325
334
|
|
|
@@ -125,8 +125,40 @@ def test_pinned_version_feeds(
|
|
|
125
125
|
|
|
126
126
|
item = _parse_items(_get_feed(distro, "rss/updates.xml", bindings_cfg))[0]
|
|
127
127
|
assert item.findtext("link").endswith("pypi/shelf-reader/0.1/json")
|
|
128
|
-
assert
|
|
128
|
+
assert "pypi/shelf-reader/0.1/json#" in item.findtext("guid")
|
|
129
129
|
|
|
130
130
|
python_content_factory(TWINE_WHEEL_FILENAME, url=TWINE_WHEEL_URL, repository=repo)
|
|
131
131
|
update_titles = _titles(_parse_items(_get_feed(distro, "rss/updates.xml", bindings_cfg)))
|
|
132
132
|
assert update_titles == ["shelf-reader 0.1"]
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@pytest.mark.parallel
|
|
136
|
+
def test_new_file_for_existing_version_updates_guid(
|
|
137
|
+
bindings_cfg, python_content_factory, python_empty_repo_distro
|
|
138
|
+
):
|
|
139
|
+
"""Adding a new file for an existing (name, version) produces a new guid and updated date."""
|
|
140
|
+
repo, distro = python_empty_repo_distro()
|
|
141
|
+
|
|
142
|
+
python_content_factory(PYTHON_EGG_FILENAME, url=PYTHON_EGG_URL, repository=repo)
|
|
143
|
+
|
|
144
|
+
items = _parse_items(_get_feed(distro, "rss/updates.xml", bindings_cfg))
|
|
145
|
+
assert len(items) == 1
|
|
146
|
+
first_guid = items[0].findtext("guid")
|
|
147
|
+
first_date = items[0].findtext("pubDate")
|
|
148
|
+
assert "pypi/shelf-reader/0.1/json" in first_guid
|
|
149
|
+
|
|
150
|
+
python_content_factory(PYTHON_WHEEL_FILENAME, url=PYTHON_WHEEL_URL, repository=repo)
|
|
151
|
+
|
|
152
|
+
items = _parse_items(_get_feed(distro, "rss/updates.xml", bindings_cfg))
|
|
153
|
+
assert len(items) == 1
|
|
154
|
+
second_guid = items[0].findtext("guid")
|
|
155
|
+
second_date = items[0].findtext("pubDate")
|
|
156
|
+
|
|
157
|
+
assert second_guid != first_guid
|
|
158
|
+
assert second_date >= first_date
|
|
159
|
+
|
|
160
|
+
release_items = _parse_items(
|
|
161
|
+
_get_feed(distro, "rss/project/shelf-reader/releases.xml", bindings_cfg)
|
|
162
|
+
)
|
|
163
|
+
assert len(release_items) == 1
|
|
164
|
+
assert release_items[0].findtext("guid") == second_guid
|
|
@@ -169,8 +169,8 @@ def test_simple_json_detail_api(
|
|
|
169
169
|
(PYPI_TEXT_HTML, PYPI_TEXT_HTML),
|
|
170
170
|
(PYPI_SIMPLE_V1_HTML, PYPI_SIMPLE_V1_HTML),
|
|
171
171
|
(PYPI_SIMPLE_V1_JSON, PYPI_SIMPLE_V1_JSON),
|
|
172
|
-
#
|
|
173
|
-
(f"{PYPI_SIMPLE_V1_JSON}, {PYPI_SIMPLE_V1_HTML}",
|
|
172
|
+
# Clients such as pip and uv advertise JSON first, with HTML as a fallback.
|
|
173
|
+
(f"{PYPI_SIMPLE_V1_JSON}, {PYPI_SIMPLE_V1_HTML}", PYPI_SIMPLE_V1_JSON),
|
|
174
174
|
# Everything else should be html
|
|
175
175
|
("", PYPI_TEXT_HTML),
|
|
176
176
|
("application/json", PYPI_TEXT_HTML),
|
|
@@ -191,3 +191,5 @@ def test_simple_api_content_headers(
|
|
|
191
191
|
response = requests.get(url, headers={"Accept": header})
|
|
192
192
|
assert response.status_code == 200
|
|
193
193
|
assert result in response.headers["Content-Type"]
|
|
194
|
+
if url == detail_url and result == PYPI_SIMPLE_V1_JSON:
|
|
195
|
+
assert all(file["upload-time"] for file in response.json()["files"])
|
|
@@ -91,14 +91,13 @@ def test_simple_cache_separate_accept_headers(synced_distro):
|
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
@pytest.mark.parallel
|
|
94
|
-
def
|
|
94
|
+
def test_simple_cache_negotiated_media_types_are_separate(synced_distro):
|
|
95
95
|
"""
|
|
96
|
-
|
|
96
|
+
JSON and HTML responses must not poison each other in the cache.
|
|
97
97
|
|
|
98
|
-
Clients like uv/pip send an Accept that allows both JSON and HTML.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
the JSON entry is not served (and re-rendered) for the HTML request.
|
|
98
|
+
Clients like uv/pip send an Accept that allows both JSON and HTML. The
|
|
99
|
+
negotiated JSON response must be cached separately from an explicit HTML
|
|
100
|
+
response.
|
|
102
101
|
"""
|
|
103
102
|
url = f"{urljoin(synced_distro.base_url, 'simple/')}aiohttp"
|
|
104
103
|
# pip/uv-style Accept: JSON preferred, HTML still acceptable
|
|
@@ -112,13 +111,13 @@ def test_simple_cache_format_json_does_not_poison_html(synced_distro):
|
|
|
112
111
|
assert r_json.headers["X-PULP-CACHE"] == "MISS"
|
|
113
112
|
assert r_json.json()["name"] == "aiohttp"
|
|
114
113
|
|
|
115
|
-
r_html = requests.get(url, headers=
|
|
114
|
+
r_html = requests.get(url, headers={"Accept": PYPI_TEXT_HTML})
|
|
116
115
|
assert r_html.status_code == 200
|
|
117
116
|
assert PYPI_TEXT_HTML in r_html.headers["Content-Type"]
|
|
118
117
|
assert r_html.headers["X-PULP-CACHE"] == "MISS"
|
|
119
118
|
assert b"<a href=" in r_html.content
|
|
120
119
|
|
|
121
|
-
r_html_hit = requests.get(url, headers=
|
|
120
|
+
r_html_hit = requests.get(url, headers={"Accept": PYPI_TEXT_HTML})
|
|
122
121
|
assert r_html_hit.status_code == 200
|
|
123
122
|
assert r_html_hit.headers["X-PULP-CACHE"] == "HIT"
|
|
124
123
|
assert PYPI_TEXT_HTML in r_html_hit.headers["Content-Type"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
pulp_python/__init__.py,sha256=GIuTLoBTc-07dSLJUh8xrZPRz8x-jJ61pfR0J1IjnzI,65
|
|
2
2
|
pulp_python/pytest_plugin.py,sha256=8Ko-O87JGPC79h8-Ecw2gJLxa6q1Ng8wD6WxbinOnVs,8573
|
|
3
|
-
pulp_python/app/__init__.py,sha256=
|
|
3
|
+
pulp_python/app/__init__.py,sha256=e6i6xQCW99OL1SQrMxWjiBz06J30kQAhKKM5XQaBEhg,2552
|
|
4
4
|
pulp_python/app/cache.py,sha256=Zl2nb4uKyPYp5a3FBrdRZ_-cXfofNMQmIRaQ6dUZZ1g,1037
|
|
5
5
|
pulp_python/app/exceptions.py,sha256=mPNcWyuzF0XeOPybm-G6oDKtRqvfj4jyp41iaYqcqkA,1314
|
|
6
6
|
pulp_python/app/global_access_conditions.py,sha256=MZJtyoVsr-4hRaty6mKDqh3caOHd5UKJjEWLV2crOLs,1080
|
|
@@ -43,9 +43,9 @@ pulp_python/app/migrations/0023_packageyank.py,sha256=357fqSNK-D1OvI9RynnyMMrXJt
|
|
|
43
43
|
pulp_python/app/migrations/0024_pythonrepository_error_on_reject.py,sha256=p10wp0OEVA7m-ZpuzlqsJg9dEbf4cF6kow9AfK37JU8,348
|
|
44
44
|
pulp_python/app/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
45
|
pulp_python/app/pypi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
|
-
pulp_python/app/pypi/feeds.py,sha256=
|
|
46
|
+
pulp_python/app/pypi/feeds.py,sha256=G3o5ZOajLALxLIjbDCWmS5C0R5yg5peci0CbtNzEPY0,9018
|
|
47
47
|
pulp_python/app/pypi/serializers.py,sha256=VDV4REMltZr98bxulgOGoGLnBxUtDod0t1fg_lDFpcs,5601
|
|
48
|
-
pulp_python/app/pypi/views.py,sha256=
|
|
48
|
+
pulp_python/app/pypi/views.py,sha256=Po1OoWeZAnhm6JETirynQhm2T2Y0f_OilCQCG__KsnM,27423
|
|
49
49
|
pulp_python/app/tasks/__init__.py,sha256=JplOj2JtE_i4sQYqV7JnDY7zkraU_KlsCaNnYYaZ1x4,346
|
|
50
50
|
pulp_python/app/tasks/publish.py,sha256=bjsJzqJbLu7TF5rLb-UsZMmlNnc_LKw-sdHX9Gcatbw,4334
|
|
51
51
|
pulp_python/app/tasks/repair.py,sha256=suvpn7VLGx_B-mixjQWdiHPDy8FclLQ6IwjcL9PeIpU,12603
|
|
@@ -73,11 +73,11 @@ pulp_python/tests/functional/api/test_download_content.py,sha256=5IuaHXyLakPkjm5
|
|
|
73
73
|
pulp_python/tests/functional/api/test_export_import.py,sha256=rHns9wdaeP-vtfW_qoGHU9EVuJ4YuWE0-rjl_8otAgU,4530
|
|
74
74
|
pulp_python/tests/functional/api/test_full_mirror.py,sha256=v0nSlGKGSycFqZM4opCTHVtbmCfo_Y5y3k_6Rm7eBF8,12058
|
|
75
75
|
pulp_python/tests/functional/api/test_pypi_apis.py,sha256=iZnoSN2wCczXh14KJDH8pSDTygjs0kgZsYIcIYS5TP8,13647
|
|
76
|
-
pulp_python/tests/functional/api/test_pypi_feeds.py,sha256=
|
|
77
|
-
pulp_python/tests/functional/api/test_pypi_simple_api.py,sha256=
|
|
76
|
+
pulp_python/tests/functional/api/test_pypi_feeds.py,sha256=EuVcWxbYHFPgPZhobdxd89cf1nZUa4nzhNxM90DoLgI,6621
|
|
77
|
+
pulp_python/tests/functional/api/test_pypi_simple_api.py,sha256=N01RnpoLbPE1hr3blz60Tmn8gWvixzs9u1Hh3eGfeyg,7336
|
|
78
78
|
pulp_python/tests/functional/api/test_rbac.py,sha256=-xNWqvKKU-v1uC6tCRGBK0aWaff25K9C-AfzQkdHhhI,10513
|
|
79
79
|
pulp_python/tests/functional/api/test_repair.py,sha256=4FR7jx_LA2K-pnRJXKkhq-1uUoWXST1leZ9XdyhGM2U,12909
|
|
80
|
-
pulp_python/tests/functional/api/test_simple_cache.py,sha256=
|
|
80
|
+
pulp_python/tests/functional/api/test_simple_cache.py,sha256=tql5Isn-ijThFm8CNzcSPVUtOg9uRz_OIvWOjIynrAA,11029
|
|
81
81
|
pulp_python/tests/functional/api/test_sync.py,sha256=TTHR1CpZeRoD97RKxj2pZPsP0OS9ibYKGPOh1WfKISg,13801
|
|
82
82
|
pulp_python/tests/functional/api/test_upload.py,sha256=f21Li9agJ5fdBqErVg1j6v5FDVdazB5mNClmGOjLUq8,5981
|
|
83
83
|
pulp_python/tests/functional/api/test_version_specifier_filter.py,sha256=nmnBbhwxCEmcHOyFbS1uvemar67sONBGM9SsNn79LCc,1063
|
|
@@ -85,9 +85,9 @@ pulp_python/tests/functional/api/test_vulnerability_report.py,sha256=Rv492Wrvu1F
|
|
|
85
85
|
pulp_python/tests/functional/api/test_yank.py,sha256=qyZbAJ6bJO-4LPkVfVxKuWFjypJ8BmBrCnLo0luAhVk,11913
|
|
86
86
|
pulp_python/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
87
87
|
pulp_python/tests/unit/test_models.py,sha256=TBI0yKsrdbnJSPeBFfxSqhXK7zaNvR6qg5JehGH3Pds,229
|
|
88
|
-
pulp_python-3.36.
|
|
89
|
-
pulp_python-3.36.
|
|
90
|
-
pulp_python-3.36.
|
|
91
|
-
pulp_python-3.36.
|
|
92
|
-
pulp_python-3.36.
|
|
93
|
-
pulp_python-3.36.
|
|
88
|
+
pulp_python-3.36.2.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
|
|
89
|
+
pulp_python-3.36.2.dist-info/METADATA,sha256=WKxfQ8q3YiH8EM6ml3pRiHQbGTv8IwLXcSdbcc1llw0,1744
|
|
90
|
+
pulp_python-3.36.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
91
|
+
pulp_python-3.36.2.dist-info/entry_points.txt,sha256=HvqLEXjw_dS5jqAwnE5JiRZFE6f-y5SRtitKLPml2To,115
|
|
92
|
+
pulp_python-3.36.2.dist-info/top_level.txt,sha256=X0hXgXc_bpbiKqVrkt8jD5_QEiQviKbHDwveQcOcJjo,12
|
|
93
|
+
pulp_python-3.36.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|