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

Support X-PyPI-Is-Staged #17331

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a45892a
Fix cherry-pick
warsaw Sep 21, 2024
831095a
Add `published` to the `ReleaseFactory`
alanbato May 2, 2022
5846e30
Add migrations
DarkaMaul Dec 6, 2024
60f4a01
Add a default value for Release.published field.
DarkaMaul Dec 9, 2024
60de6e8
Change to a boolean field
DarkaMaul Dec 10, 2024
d2438e8
Merge branch 'main' into dm/published-date
DarkaMaul Dec 10, 2024
a792738
Filter out unpublished releases
DarkaMaul Dec 10, 2024
76fd2e4
Merge branch 'main' into dm/published-date
DarkaMaul Dec 11, 2024
018d047
Merge branch 'main' into dm/draft-header
DarkaMaul Dec 16, 2024
35395da
Merge branch 'main' into dm/published-date
woodruffw Dec 16, 2024
38221fb
Merge branch 'main' into dm/published-date
DarkaMaul Dec 18, 2024
0957242
Merge branch 'dm/published-date' into dm/draft-header
DarkaMaul Dec 18, 2024
4b8b395
Add `staged` releases publication
DarkaMaul Dec 20, 2024
1d81d5d
Remove empty upload.
DarkaMaul Dec 27, 2024
c781e5b
Add test with OIDC publishing
DarkaMaul Dec 27, 2024
e6efef9
Merge branch 'main' into dm/draft-header
DarkaMaul Dec 27, 2024
90bc0b3
Update translations
DarkaMaul Dec 27, 2024
943f630
Merge branch 'main' into dm/draft-header
DarkaMaul Dec 31, 2024
2b51092
Upgrade tests
DarkaMaul Dec 31, 2024
852db29
Merge remote-tracking branch 'origin/dm/draft-header' into dm/draft-h…
DarkaMaul Dec 31, 2024
840951d
Add `published` column
DarkaMaul Jan 22, 2025
deddcc1
Add `published` to the `ReleaseFactory`
alanbato May 2, 2022
c8affce
Add migrations
DarkaMaul Dec 6, 2024
f830b63
Add a default value for Release.published field.
DarkaMaul Dec 9, 2024
cdf1acb
Change to a boolean field
DarkaMaul Dec 10, 2024
d3f59b4
Filter out unpublished releases
DarkaMaul Dec 10, 2024
8fcb92e
Use a SQLAlchemy event
DarkaMaul Jan 3, 2025
cf2abc8
Remove field from PR
DarkaMaul Jan 22, 2025
eb025b6
Resolve merge conflict
DarkaMaul Jan 22, 2025
76d6615
Merge branch 'main' into dm/published-date
DarkaMaul Jan 28, 2025
dec6238
Revert un-needed changes
DarkaMaul Jan 28, 2025
56feeb0
Remove event handling
DarkaMaul Jan 28, 2025
6906096
Add more tests
DarkaMaul Jan 28, 2025
9397ef2
Rename from unpublished to staged
DarkaMaul Jan 28, 2025
32566d4
Merge branch 'main' into dm/published-date
woodruffw Jan 28, 2025
73363b1
Merge branch 'main' into dm/draft-header
DarkaMaul Jan 28, 2025
76ad6b7
Update PR
DarkaMaul Jan 28, 2025
b629c84
Merge branch 'dm/published-date' into dm/draft-header
DarkaMaul Jan 28, 2025
6d14433
Rebase PR on top of other changes
DarkaMaul Jan 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update PR
DarkaMaul committed Jan 28, 2025
commit 76ad6b7ce9bbeeeca082b7ecbcc198c83bf3c002
3 changes: 1 addition & 2 deletions tests/common/db/packaging.py
Original file line number Diff line number Diff line change
@@ -120,8 +120,7 @@ class Meta:
lambda o: hashlib.blake2b(o.filename.encode("utf8"), digest_size=32).hexdigest()
)
upload_time = factory.Faker(
"date_time_between_dates",
datetime_start=datetime.datetime(2008, 1, 1),
"date_time_between_dates", datetime_start=datetime.datetime(2008, 1, 1)
)
path = factory.LazyAttribute(
lambda o: "/".join(
1 change: 1 addition & 0 deletions tests/unit/forklift/test_legacy.py
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@
from warehouse.events.tags import EventTag
from warehouse.forklift import legacy, metadata
from warehouse.macaroons import IMacaroonService, caveats, security_policy
from warehouse.metrics import IMetricsService
from warehouse.oidc.interfaces import SignedClaims
from warehouse.oidc.utils import PublisherTokenContext
from warehouse.packaging.interfaces import IFileStorage, IProjectService
8 changes: 1 addition & 7 deletions tests/unit/legacy/api/test_json.py
Original file line number Diff line number Diff line change
@@ -118,13 +118,6 @@ def test_all_non_prereleases_yanked(self, monkeypatch, db_request):
db_request.matchdict = {"name": project.normalized_name}
assert json.latest_release_factory(db_request) == release

def test_with_unpublished(self, db_request):
project = ProjectFactory.create()
release = ReleaseFactory.create(project=project, version="1.0")
ReleaseFactory.create(project=project, version="2.0", published=False)
db_request.matchdict = {"name": project.normalized_name}
assert json.latest_release_factory(db_request) == release

def test_project_quarantined(self, monkeypatch, db_request):
project = ProjectFactory.create(
lifecycle_status=LifecycleStatus.QuarantineEnter
@@ -164,6 +157,7 @@ def test_normalizing_redirects(self, db_request):
def test_renders(self, pyramid_config, db_request, db_session):
project = ProjectFactory.create(has_docs=True)
description_content_type = "text/x-rst"
print("NOJ")
url = "/the/fake/url/"
project_urls = [
"url," + url,
13 changes: 0 additions & 13 deletions tests/unit/packaging/test_views.py
Original file line number Diff line number Diff line change
@@ -135,19 +135,6 @@ def test_only_yanked_release(self, monkeypatch, db_request):
assert resp is response
assert release_detail.calls == [pretend.call(release, db_request)]

def test_with_unpublished(self, monkeypatch, db_request):
project = ProjectFactory.create()
release = ReleaseFactory.create(project=project, version="1.0")
ReleaseFactory.create(project=project, version="1.1", published=False)

response = pretend.stub()
release_detail = pretend.call_recorder(lambda ctx, request: response)
monkeypatch.setattr(views, "release_detail", release_detail)

resp = views.project_detail(project, db_request)
assert resp is response
assert release_detail.calls == [pretend.call(release, db_request)]


class TestReleaseDetail:
def test_normalizing_name_redirects(self, db_request):
1 change: 1 addition & 0 deletions warehouse/forklift/legacy.py
Original file line number Diff line number Diff line change
@@ -659,6 +659,7 @@ def file_upload(request):
]
),
)

# Ensure that we have file data in the request.
if "content" not in request.POST:
request.metrics.increment("warehouse.upload.failed", tags=["reason:no-file"])
8 changes: 2 additions & 6 deletions warehouse/legacy/api/json.py
Original file line number Diff line number Diff line change
@@ -62,10 +62,7 @@ def _json_data(request, project, release, *, all_releases):
)
)
.outerjoin(File)
.filter(
Release.project == project,
Release.published.is_(True),
)
.filter(Release.project == project)
)

# If we're not looking for all_releases, then we'll filter this further
@@ -209,8 +206,7 @@ def latest_release_factory(request):
.filter(
Project.lifecycle_status.is_distinct_from(
LifecycleStatus.QuarantineEnter
),
Release.published.is_(True),
)
)
.order_by(
Release.yanked.asc(),
38 changes: 0 additions & 38 deletions warehouse/migrations/versions/bd2bf218e63f_add_published_field.py

This file was deleted.

4 changes: 1 addition & 3 deletions warehouse/packaging/utils.py
Original file line number Diff line number Diff line change
@@ -53,11 +53,9 @@ def _simple_detail(project, request):
.join(Release)
.filter(Release.project == project)
# Exclude projects that are in the `quarantine-enter` lifecycle status.
# And exclude un-published releases from the index
.join(Project)
.filter(
Project.lifecycle_status.is_distinct_from(LifecycleStatus.QuarantineEnter),
Release.published.is_(True),
Project.lifecycle_status.is_distinct_from(LifecycleStatus.QuarantineEnter)
)
.all(),
key=lambda f: (packaging_legacy.version.parse(f.release.version), f.filename),
5 changes: 1 addition & 4 deletions warehouse/packaging/views.py
Original file line number Diff line number Diff line change
@@ -179,10 +179,7 @@ def project_detail(project, request):
try:
release = (
request.db.query(Release)
.filter(
Release.project == project,
Release.published.is_(True),
)
.filter(Release.project == project)
.order_by(
Release.yanked,
Release.is_prerelease.nullslast(),