Skip to content

add floss.fund manifest provenance #18494

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

Merged
merged 3 commits into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions tests/functional/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
import webtest


def test_funding_manifest_urls(app_config):
testapp = webtest.TestApp(app_config.make_wsgi_app())
resp = testapp.get("/.well-known/funding-manifest-urls")
assert resp.status_code == HTTPStatus.OK
assert resp.content_type == "text/plain"
assert resp.body.decode(resp.charset) == "https://www.python.org/funding.json"


@pytest.mark.parametrize(
("domain", "indexable"), [("pypi.org", True), ("test.pypi.org", False)]
)
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def add_redirect_rule(*args, **kwargs):
pretend.call("locale", "/locale/", domain=warehouse),
pretend.call("favicon.ico", "/favicon.ico", domain=warehouse),
pretend.call("robots.txt", "/robots.txt", domain=warehouse),
pretend.call(
"funding-manifest-urls",
"/.well-known/funding-manifest-urls",
domain=warehouse,
),
pretend.call("opensearch.xml", "/opensearch.xml", domain=warehouse),
pretend.call("index.sitemap.xml", "/sitemap.xml", domain=warehouse),
pretend.call("bucket.sitemap.xml", "/{bucket}.sitemap.xml", domain=warehouse),
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
forbidden_api,
forbidden_include,
force_status,
funding_manifest_urls,
health,
httpexception_view,
index,
Expand Down Expand Up @@ -378,6 +379,13 @@ def test_robotstxt(pyramid_request):
assert pyramid_request.response.content_type == "text/plain"


def test_funding_manifest_urls(pyramid_request):
response = funding_manifest_urls(pyramid_request)
assert response.text == "https://www.python.org/funding.json"
assert response.content_type == "text/plain"
assert response.charset == "utf-8"


def test_opensearchxml(pyramid_request):
assert opensearchxml(pyramid_request) == {}
assert pyramid_request.response.content_type == "text/xml"
Expand Down
2 changes: 1 addition & 1 deletion warehouse/locale/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ msgid ""
" action."
msgstr ""

#: warehouse/views.py:322
#: warehouse/views.py:341
msgid "Locale updated"
msgstr ""

Expand Down
3 changes: 3 additions & 0 deletions warehouse/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def includeme(config):
config.add_route("locale", "/locale/", domain=warehouse)
config.add_route("favicon.ico", "/favicon.ico", domain=warehouse)
config.add_route("robots.txt", "/robots.txt", domain=warehouse)
config.add_route(
"funding-manifest-urls", "/.well-known/funding-manifest-urls", domain=warehouse
)
config.add_route("opensearch.xml", "/opensearch.xml", domain=warehouse)
config.add_route("index.sitemap.xml", "/sitemap.xml", domain=warehouse)
config.add_route("bucket.sitemap.xml", "/{bucket}.sitemap.xml", domain=warehouse)
Expand Down
21 changes: 20 additions & 1 deletion warehouse/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from pyramid.i18n import make_localizer
from pyramid.interfaces import ITranslationDirectories
from pyramid.renderers import render_to_response
from pyramid.response import FileResponse
from pyramid.response import FileResponse, Response
from pyramid.view import (
exception_view_config,
forbidden_view_config,
Expand Down Expand Up @@ -241,6 +241,25 @@ def robotstxt(request):
return {}


@view_config(
route_name="funding-manifest-urls",
decorator=[
cache_control(1 * 24 * 60 * 60), # 1 day
origin_cache(
1 * 24 * 60 * 60, # 1 day
stale_while_revalidate=6 * 60 * 60, # 6 hours
stale_if_error=1 * 24 * 60 * 60, # 1 day
),
],
)
def funding_manifest_urls(request):
return Response(
"https://www.python.org/funding.json",
content_type="text/plain",
charset="utf-8",
)


@view_config(
route_name="opensearch.xml",
renderer="warehouse:templates/opensearch.xml",
Expand Down
Loading