diff --git a/tests/unit/cli/test_projects.py b/tests/unit/cli/test_projects.py deleted file mode 100644 index 6cf97f9ce6c0..000000000000 --- a/tests/unit/cli/test_projects.py +++ /dev/null @@ -1,33 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pretend - -from warehouse.cli import projects -from warehouse.packaging.tasks import send_pep_715_notices - - -def test_notify_pep_715(cli): - request = pretend.stub() - task = pretend.stub( - get_request=pretend.call_recorder(lambda: request), - run=pretend.call_recorder(lambda r: None), - ) - config = pretend.stub(task=pretend.call_recorder(lambda f: task)) - - cli.invoke(projects.notify_pep_715, obj=config) - assert config.task.calls == [ - pretend.call(send_pep_715_notices), - pretend.call(send_pep_715_notices), - ] - assert task.get_request.calls == [pretend.call()] - assert task.run.calls == [pretend.call(request)] diff --git a/tests/unit/email/test_init.py b/tests/unit/email/test_init.py index 1d44581ab030..d03c98326455 100644 --- a/tests/unit/email/test_init.py +++ b/tests/unit/email/test_init.py @@ -5825,92 +5825,3 @@ def test_trusted_publisher_emails( }, ) ] - - -class TestPEP715Emails: - @pytest.mark.parametrize( - "fn, template_name", - [ - (email.send_egg_uploads_deprecated_email, "egg-uploads-deprecated"), - ( - email.send_egg_uploads_deprecated_initial_email, - "egg-uploads-deprecated-initial-notice", - ), - ], - ) - def test_pep_715_emails( - self, pyramid_request, pyramid_config, monkeypatch, fn, template_name - ): - stub_user = pretend.stub( - id="id", - username="username", - name="", - email="email@example.com", - primary_email=pretend.stub(email="email@example.com", verified=True), - ) - subject_renderer = pyramid_config.testing_add_renderer( - f"email/{ template_name }/subject.txt" - ) - subject_renderer.string_response = "Email Subject" - body_renderer = pyramid_config.testing_add_renderer( - f"email/{ template_name }/body.txt" - ) - body_renderer.string_response = "Email Body" - html_renderer = pyramid_config.testing_add_renderer( - f"email/{ template_name }/body.html" - ) - html_renderer.string_response = "Email HTML Body" - - send_email = pretend.stub( - delay=pretend.call_recorder(lambda *args, **kwargs: None) - ) - pyramid_request.task = pretend.call_recorder(lambda *args, **kwargs: send_email) - monkeypatch.setattr(email, "send_email", send_email) - - pyramid_request.db = pretend.stub( - query=lambda a: pretend.stub( - filter=lambda *a: pretend.stub( - one=lambda: pretend.stub(user_id=stub_user.id) - ) - ), - ) - pyramid_request.user = stub_user - pyramid_request.registry.settings = {"mail.sender": "noreply@example.com"} - - project_name = "test_project" - result = fn( - pyramid_request, - stub_user, - project_name=project_name, - ) - - assert result == { - "project_name": project_name, - } - subject_renderer.assert_() - body_renderer.assert_(project_name=project_name) - html_renderer.assert_(project_name=project_name) - assert pyramid_request.task.calls == [pretend.call(send_email)] - assert send_email.delay.calls == [ - pretend.call( - f"{stub_user.username} <{stub_user.email}>", - { - "subject": "Email Subject", - "body_text": "Email Body", - "body_html": ( - "\n\n" - "

Email HTML Body

\n\n" - ), - }, - { - "tag": "account:email:sent", - "user_id": stub_user.id, - "additional": { - "from_": "noreply@example.com", - "to": stub_user.email, - "subject": "Email Subject", - "redact_ip": False, - }, - }, - ) - ] diff --git a/tests/unit/forklift/test_legacy.py b/tests/unit/forklift/test_legacy.py index ef155dbfc3f2..6d8bad32e822 100644 --- a/tests/unit/forklift/test_legacy.py +++ b/tests/unit/forklift/test_legacy.py @@ -31,14 +31,6 @@ from wtforms.form import Form from wtforms.validators import ValidationError -from tests.common.db.organizations import ( - OrganizationFactory, - OrganizationProjectFactory, - OrganizationRoleFactory, - TeamFactory, - TeamProjectRoleFactory, - TeamRoleFactory, -) from warehouse.admin.flags import AdminFlag, AdminFlagValue from warehouse.classifiers.models import Classifier from warehouse.errors import BasicAuthTwoFactorEnabled @@ -85,13 +77,6 @@ def _get_whl_testdata(name="fake_package", version="1.0"): return temp_f.getvalue() -def _get_egg_testdata(): - temp_f = io.BytesIO() - with zipfile.ZipFile(file=temp_f, mode="w") as zfp: - zfp.writestr("fake_package/PKG-INFO", "Fake metadata") - return temp_f.getvalue() - - def _storage_hash(data): return hashlib.blake2b(data, digest_size=256 // 8).hexdigest() @@ -107,12 +92,6 @@ def _storage_hash(data): _TAR_BZ2_PKG_STORAGE_HASH = _storage_hash(_TAR_BZ2_PKG_TESTDATA) -_EGG_PKG_TESTDATA = _get_egg_testdata() -_EGG_PKG_MD5 = hashlib.md5(_EGG_PKG_TESTDATA).hexdigest() -_EGG_PKG_SHA256 = hashlib.sha256(_EGG_PKG_TESTDATA).hexdigest() -_EGG_PKG_STORAGE_HASH = _storage_hash(_EGG_PKG_TESTDATA) - - class TestExcWithMessage: def test_exc_with_message(self): exc = legacy._exc_with_message(HTTPBadRequest, "My Test Message.") @@ -510,7 +489,6 @@ def test_defaults_to_true(self): ("filename", "filetype"), [ ("test.zip", "sdist"), - ("test.egg", "bdist_egg"), ("test.whl", "bdist_wheel"), ], ) @@ -610,23 +588,6 @@ def test_zipfile_exceeds_compression_threshold(self, tmpdir): assert not legacy._is_valid_dist_file(f, "") - def test_egg_no_pkg_info(self, tmpdir): - f = str(tmpdir.join("test.egg")) - - with zipfile.ZipFile(f, "w") as zfp: - zfp.writestr("something.txt", b"Just a placeholder file") - - assert not legacy._is_valid_dist_file(f, "bdist_egg") - - def test_egg_has_pkg_info(self, tmpdir): - f = str(tmpdir.join("test.egg")) - - with zipfile.ZipFile(f, "w") as zfp: - zfp.writestr("something.txt", b"Just a placeholder file") - zfp.writestr("PKG-INFO", b"this is the package info") - - assert legacy._is_valid_dist_file(f, "bdist_egg") - def test_wheel_no_wheel_file(self, tmpdir): f = str(tmpdir.join("test.whl")) @@ -1594,9 +1555,9 @@ def test_upload_fails_with_legacy_ext(self, pyramid_config, db_request): assert resp.status_code == 400 assert resp.status == ( - "400 Invalid file extension: Use .egg, .tar.gz, .whl or .zip " + "400 Invalid file extension: Use .tar.gz, .whl or .zip " "extension. See https://www.python.org/dev/peps/pep-0527 " - "for more information." + "and https://peps.python.org/pep-0715/ for more information" ) def test_upload_fails_for_second_sdist(self, pyramid_config, db_request): @@ -2314,15 +2275,12 @@ def test_upload_fails_with_diff_filename_same_blake2( # completely different ("nope-{version}.tar.gz", "something_else"), ("nope-{version}-py3-none-any.whl", "something_else"), - ("nope-{version}-py3-none-any.egg", "something_else"), # starts with same prefix ("nope-{version}.tar.gz", "no"), ("nope-{version}-py3-none-any.whl", "no"), - ("nope-{version}-py3-none-any.egg", "no"), # starts with same prefix with hyphen ("no-way-{version}.tar.gz", "no"), ("no_way-{version}-py3-none-any.whl", "no"), - ("no_way-{version}-py3-none-any.egg", "no"), # multiple delimiters ("foo__bar-{version}-py3-none-any.whl", "foo-.bar"), ], @@ -2407,9 +2365,9 @@ def test_upload_fails_with_invalid_extension(self, pyramid_config, db_request): assert resp.status_code == 400 assert resp.status == ( - "400 Invalid file extension: Use .egg, .tar.gz, .whl or .zip " + "400 Invalid file extension: Use .tar.gz, .whl or .zip " "extension. See https://www.python.org/dev/peps/pep-0527 " - "for more information." + "and https://peps.python.org/pep-0715/ for more information" ) @pytest.mark.parametrize("character", ["/", "\\"]) @@ -3921,111 +3879,6 @@ def test_fails_without_user(self, pyramid_config, pyramid_request): "See /the/help/url/ for more information." ) - def test_egg_upload_sends_pep_715_notice( - self, pyramid_config, db_request, metrics, monkeypatch - ): - user = UserFactory.create() - EmailFactory.create(user=user) - project = ProjectFactory.create() - RoleFactory.create(user=user, project=project) - - pyramid_config.testing_securitypolicy(identity=user) - db_request.user = user - db_request.user_agent = "warehouse-tests/6.6.6" - db_request.POST = MultiDict( - { - "metadata_version": "1.2", - "name": project.name, - "version": "1.0.0", - "summary": "This is my summary!", - "filetype": "bdist_egg", - "pyversion": "2.7", - "md5_digest": _EGG_PKG_MD5, - "content": pretend.stub( - filename="{}-{}.egg".format(project.name, "1.0.0"), - file=io.BytesIO(_EGG_PKG_TESTDATA), - type="application/zip", - ), - } - ) - - send_email = pretend.call_recorder(lambda *a, **kw: None) - monkeypatch.setattr(legacy, "send_egg_uploads_deprecated_email", send_email) - - storage_service = pretend.stub(store=lambda path, filepath, meta: None) - db_request.find_service = lambda svc, name=None, context=None: { - IFileStorage: storage_service, - IMetricsService: metrics, - }.get(svc) - - resp = legacy.file_upload(db_request) - - assert resp.status_code == 200 - assert send_email.calls == [ - pretend.call(db_request, user, project_name=project.name) - ] - - def test_egg_upload_sends_pep_715_notice_org_roles( - self, pyramid_config, db_request, metrics, monkeypatch - ): - user = UserFactory.create() - EmailFactory.create(user=user) - project = ProjectFactory.create() - RoleFactory.create(user=user, project=project) - - org = OrganizationFactory() - OrganizationProjectFactory(organization=org, project=project) - org_owner = UserFactory.create() - OrganizationRoleFactory.create(user=org_owner, organization=org) - - org_member = UserFactory.create() - OrganizationRoleFactory.create( - user=org_member, organization=org, role_name="Member" - ) - team = TeamFactory.create(organization=org) - TeamRoleFactory.create(team=team, user=org_member) - # Duplicate the role directly on the project to ensure only one email - RoleFactory.create(user=org_member, project=project, role_name="Maintainer") - TeamProjectRoleFactory.create(project=project, team=team) - - pyramid_config.testing_securitypolicy(identity=user) - db_request.user = user - db_request.user_agent = "warehouse-tests/6.6.6" - db_request.POST = MultiDict( - { - "metadata_version": "1.2", - "name": project.name, - "version": "1.0.0", - "summary": "This is my summary!", - "filetype": "bdist_egg", - "pyversion": "2.7", - "md5_digest": _EGG_PKG_MD5, - "content": pretend.stub( - filename="{}-{}.egg".format(project.name, "1.0.0"), - file=io.BytesIO(_EGG_PKG_TESTDATA), - type="application/zip", - ), - } - ) - - send_email = pretend.call_recorder(lambda *a, **kw: None) - monkeypatch.setattr(legacy, "send_egg_uploads_deprecated_email", send_email) - - storage_service = pretend.stub(store=lambda path, filepath, meta: None) - db_request.find_service = lambda svc, name=None, context=None: { - IFileStorage: storage_service, - IMetricsService: metrics, - }.get(svc) - - resp = legacy.file_upload(db_request) - - assert resp.status_code == 200 - assert set(send_email.calls) == { - pretend.call(db_request, user, project_name=project.name), - pretend.call(db_request, org_owner, project_name=project.name), - pretend.call(db_request, org_member, project_name=project.name), - } - def test_submit(pyramid_request): resp = legacy.submit(pyramid_request) diff --git a/tests/unit/packaging/test_tasks.py b/tests/unit/packaging/test_tasks.py index 1e21b8e8af26..1d3ba4dc2f0d 100644 --- a/tests/unit/packaging/test_tasks.py +++ b/tests/unit/packaging/test_tasks.py @@ -23,16 +23,7 @@ import warehouse.packaging.tasks -from tests.common.db.organizations import ( - OrganizationFactory, - OrganizationProjectFactory, - OrganizationRoleFactory, - TeamFactory, - TeamProjectRoleFactory, - TeamRoleFactory, -) from warehouse.accounts.models import WebAuthn -from warehouse.packaging import tasks from warehouse.packaging.models import Description from warehouse.packaging.tasks import ( check_file_cache_tasks_outstanding, @@ -973,103 +964,3 @@ def test_compute_2fa_metrics(db_request, monkeypatch): pretend.call("warehouse.2fa.total_users_with_webauthn_enabled", 1), pretend.call("warehouse.2fa.total_users_with_two_factor_enabled", 3), ] - - -def test_send_pep_715_notices(db_request, monkeypatch): - # No eggs, no emails. - no_egg_project = ProjectFactory() - no_egg_project_owner = UserFactory.create() - RoleFactory.create(user=no_egg_project_owner, project=no_egg_project) - no_egg_release = ReleaseFactory.create(project=no_egg_project) - FileFactory( - release=no_egg_release, packagetype="bdist_wheel", upload_time="2022-06-01" - ) - FileFactory( - release=no_egg_release, packagetype="bdist_wheel", upload_time="2023-06-01" - ) - - # Projects with eggs uploaded in 2023 get emails sent to their - # contributors and org contributors. - some_egg_project = ProjectFactory() - some_egg_project_owner = UserFactory.create() - RoleFactory.create(user=some_egg_project_owner, project=some_egg_project) - - some_egg_org = OrganizationFactory() - OrganizationProjectFactory(organization=some_egg_org, project=some_egg_project) - some_egg_org_owner = UserFactory.create() - OrganizationRoleFactory.create(user=some_egg_org_owner, organization=some_egg_org) - - some_egg_org_member = UserFactory.create() - OrganizationRoleFactory.create( - user=some_egg_org_member, organization=some_egg_org, role_name="Member" - ) - some_egg_team = TeamFactory.create(organization=some_egg_org) - TeamRoleFactory.create(team=some_egg_team, user=some_egg_org_member) - TeamProjectRoleFactory.create(project=some_egg_project, team=some_egg_team) - - some_egg_release = ReleaseFactory.create(project=some_egg_project) - FileFactory( - release=some_egg_release, packagetype="bdist_wheel", upload_time="2022-06-01" - ) - FileFactory( - release=some_egg_release, packagetype="bdist_egg", upload_time="2022-06-01" - ) - FileFactory( - release=some_egg_release, packagetype="bdist_wheel", upload_time="2023-06-01" - ) - FileFactory( - release=some_egg_release, packagetype="bdist_egg", upload_time="2023-06-01" - ) - - # Same as above, but without an organization in the mix. - another_egg_project = ProjectFactory() - another_egg_project_owner = UserFactory.create() - RoleFactory.create(user=another_egg_project_owner, project=another_egg_project) - another_egg_release = ReleaseFactory.create(project=another_egg_project) - FileFactory( - release=another_egg_release, packagetype="bdist_wheel", upload_time="2022-06-01" - ) - FileFactory( - release=another_egg_release, packagetype="bdist_egg", upload_time="2022-06-01" - ) - FileFactory( - release=another_egg_release, packagetype="bdist_wheel", upload_time="2023-06-01" - ) - FileFactory( - release=another_egg_release, packagetype="bdist_egg", upload_time="2023-06-01" - ) - - # Old eggs (pre-2023), no emails. - rotten_egg_project = ProjectFactory() - rotten_egg_project_user = UserFactory.create() - RoleFactory.create(user=rotten_egg_project_user, project=rotten_egg_project) - rotten_egg_release = ReleaseFactory.create(project=rotten_egg_project) - FileFactory( - release=rotten_egg_release, packagetype="bdist_egg", upload_time="2022-06-01" - ) - - send_egg_uploads_deprecated_initial_email = pretend.call_recorder( - lambda *a, **kw: None - ) - monkeypatch.setattr( - tasks, - "send_egg_uploads_deprecated_initial_email", - send_egg_uploads_deprecated_initial_email, - ) - - tasks.send_pep_715_notices(db_request) - - assert set(tasks.send_egg_uploads_deprecated_initial_email.calls) == { - pretend.call( - db_request, some_egg_project_owner, project_name=some_egg_project.name - ), - pretend.call( - db_request, some_egg_org_owner, project_name=some_egg_project.name - ), - pretend.call( - db_request, some_egg_org_member, project_name=some_egg_project.name - ), - pretend.call( - db_request, another_egg_project_owner, project_name=another_egg_project.name - ), - } diff --git a/warehouse/cli/projects.py b/warehouse/cli/projects.py index 18d776946eb9..78577dded0ef 100644 --- a/warehouse/cli/projects.py +++ b/warehouse/cli/projects.py @@ -10,10 +10,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import click from warehouse.cli import warehouse -from warehouse.packaging.tasks import send_pep_715_notices @warehouse.group() # pragma: no branch @@ -21,13 +19,3 @@ def projects(): """ Group for projects commands. """ - - -@projects.command() -@click.pass_obj -def notify_pep_715(config): - """ - Notifies projects that have uploaded eggs since Jan 1, 2023 of PEP 715 - """ - request = config.task(send_pep_715_notices).get_request() - config.task(send_pep_715_notices).run(request) diff --git a/warehouse/email/__init__.py b/warehouse/email/__init__.py index bb44ba4f4dfa..e9a70debe2ce 100644 --- a/warehouse/email/__init__.py +++ b/warehouse/email/__init__.py @@ -1022,20 +1022,6 @@ def send_pending_trusted_publisher_invalidated_email(request, user, project_name } -@_email("egg-uploads-deprecated") -def send_egg_uploads_deprecated_email(request, user, project_name): - return { - "project_name": project_name, - } - - -@_email("egg-uploads-deprecated-initial-notice") -def send_egg_uploads_deprecated_initial_email(request, user, project_name): - return { - "project_name": project_name, - } - - def includeme(config): email_sending_class = config.maybe_dotted(config.registry.settings["mail.backend"]) config.register_service_factory(email_sending_class.create_service, IEmailSender) diff --git a/warehouse/forklift/legacy.py b/warehouse/forklift/legacy.py index 15884e0b97be..ad59deb861d6 100644 --- a/warehouse/forklift/legacy.py +++ b/warehouse/forklift/legacy.py @@ -49,7 +49,6 @@ from warehouse.classifiers.models import Classifier from warehouse.email import ( send_basic_auth_with_two_factor_email, - send_egg_uploads_deprecated_email, send_gpg_signature_uploaded_email, ) from warehouse.errors import BasicAuthTwoFactorEnabled @@ -183,7 +182,7 @@ def _valid_platform_tag(platform_tag): _error_message_order = ["metadata_version", "name", "version"] -_dist_file_re = re.compile(r".+?\.(tar\.gz|zip|whl|egg)$", re.I) +_dist_file_re = re.compile(r".+?\.(tar\.gz|zip|whl)$", re.I) _legacy_specifier_re = re.compile(r"^(?P\S+)(?: \((?P\S+)\))?$") @@ -518,7 +517,7 @@ class MetadataForm(forms.Form): validators=[ wtforms.validators.InputRequired(), wtforms.validators.AnyOf( - ["bdist_egg", "bdist_wheel", "sdist"], message="Use a known file type." + ["bdist_wheel", "sdist"], message="Use a known file type." ), ] ) @@ -639,9 +638,9 @@ def _validate_filename(filename): if _dist_file_re.search(filename) is None: raise _exc_with_message( HTTPBadRequest, - "Invalid file extension: Use .egg, .tar.gz, .whl or .zip " + "Invalid file extension: Use .tar.gz, .whl or .zip " "extension. See https://www.python.org/dev/peps/pep-0527 " - "for more information.", + "and https://peps.python.org/pep-0715/ for more information", ) @@ -698,8 +697,8 @@ def _is_valid_dist_file(filename, filetype): return False except (tarfile.ReadError, EOFError): return False - elif filename.endswith(".zip") or filename.endswith(".egg"): - # Ensure that the .zip/.egg is a valid zip file, and that it has a + elif filename.endswith(".zip"): + # Ensure that the .zip is a valid zip file, and that it has a # PKG-INFO file. try: with zipfile.ZipFile(filename, "r") as zfp: @@ -1186,7 +1185,7 @@ def file_upload(request): # For wheels, the project name is normalized and won't contain hyphens, so # we can split on the first hyphen. filename.partition("-")[0] - if filename.endswith((".egg", ".whl")) + if filename.endswith(".whl") # For source releases, we know that the version should not contain any # hyphens, so we can split on the last hyphen to get the project name. else filename.rpartition("-")[0] @@ -1477,22 +1476,6 @@ def file_upload(request): request.db.flush() # flush db now so server default values are populated for celery - # Check that if it's a bdist_egg, notify regarding deprecation. - if filename.endswith(".egg"): - # send deprecation notice - contributors = project.users - if project.organization: - contributors += project.organization.owners - for teamrole in project.team_project_roles: - contributors += teamrole.team.members - - for contributor in sorted(set(contributors)): - send_egg_uploads_deprecated_email( - request, - contributor, - project_name=project.name, - ) - # Push updates to BigQuery dist_metadata = { "metadata_version": form["metadata_version"].data, diff --git a/warehouse/locale/messages.pot b/warehouse/locale/messages.pot index cc633cd78e39..1b3ed40e05fa 100644 --- a/warehouse/locale/messages.pot +++ b/warehouse/locale/messages.pot @@ -1759,8 +1759,6 @@ msgid "" msgstr "" #: warehouse/templates/email/basic-auth-with-2fa/body.html:17 -#: warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.html:17 -#: warehouse/templates/email/egg-uploads-deprecated/body.html:17 #: warehouse/templates/email/gpg-signature-uploaded/body.html:17 #: warehouse/templates/email/password-compromised-hibp/body.html:18 #: warehouse/templates/email/password-compromised/body.html:18 @@ -1785,8 +1783,6 @@ msgid "" msgstr "" #: warehouse/templates/email/basic-auth-with-2fa/body.html:25 -#: warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.html:25 -#: warehouse/templates/email/egg-uploads-deprecated/body.html:25 #: warehouse/templates/email/gpg-signature-uploaded/body.html:22 #: warehouse/templates/email/password-compromised-hibp/body.html:32 #: warehouse/templates/email/password-compromised/body.html:31 @@ -1827,48 +1823,6 @@ msgid "" "organization" msgstr "" -#: warehouse/templates/email/egg-uploads-deprecated/body.html:19 -#, python-format -msgid "" -"During a recent upload of %(project_name)s to %(site)s, we noticed you " -"uploaded an .egg/bdist_egg distribution file." -msgstr "" - -#: warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.html:22 -#: warehouse/templates/email/egg-uploads-deprecated/body.html:22 -#, python-format -msgid "" -"%(site)s is in the process of deprecating bdist_egg " -"distribution file uploads, and will not accept them beginning August 1, " -"2023." -msgstr "" - -#: warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.html:27 -#: warehouse/templates/email/egg-uploads-deprecated/body.html:27 -msgid "" -"Update your release tooling to cease upload of " -".egg/bdist_egg distribution files. If you are " -"not already, and require binary releases, update your release tooling to " -"upload .whl/bdist_wheel distribution files " -"instead." -msgstr "" - -#: warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.html:30 -#: warehouse/templates/email/egg-uploads-deprecated/body.html:30 -msgid "" -"Read more about Wheels vs Egg distribution files." -msgstr "" - -#: warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.html:19 -#, python-format -msgid "" -"Since January 1, 2023, we noticed upload(s) of " -".egg/bdist_egg distribution file(s) to %(site)s" -" for %(project_name)s." -msgstr "" - #: warehouse/templates/email/gpg-signature-uploaded/body.html:19 #, python-format msgid "" diff --git a/warehouse/packaging/tasks.py b/warehouse/packaging/tasks.py index 245c7ad7f183..b7676b75b673 100644 --- a/warehouse/packaging/tasks.py +++ b/warehouse/packaging/tasks.py @@ -25,7 +25,6 @@ from warehouse import tasks from warehouse.accounts.models import User, WebAuthn -from warehouse.email import send_egg_uploads_deprecated_initial_email from warehouse.metrics import IMetricsService from warehouse.packaging.interfaces import IFileStorage from warehouse.packaging.models import Description, File, Project, Release, Role @@ -528,30 +527,3 @@ def populate_data_using_schema(file): json_rows, table_name, job_config=LoadJobConfig(schema=table_schema) ).result() break - - -@tasks.task(ignore_result=True, acks_late=True) -def send_pep_715_notices(request): - """ - Notifies projects that have uploaded eggs since Jan 1, 2023 of PEP 715 - """ - projects = set() - for release_file in request.db.query(File).filter( - File.packagetype == "bdist_egg", - File.upload_time >= "2023-01-01", - ): - projects.add(release_file.release.project) - - for project in projects: - contributors = project.users - if project.organization: - contributors += project.organization.owners - for teamrole in project.team_project_roles: - contributors += teamrole.team.members - - for contributor in sorted(set(contributors)): - send_egg_uploads_deprecated_initial_email( - request, - contributor, - project_name=project.name, - ) diff --git a/warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.html b/warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.html deleted file mode 100644 index f6c4f44e6cee..000000000000 --- a/warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.html +++ /dev/null @@ -1,32 +0,0 @@ -{# - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. --#} -{% extends "email/_base/body.html" %} - -{% block content %} -

{% trans %}What?{% endtrans %}

-

- {% trans site=request.registry.settings["site.name"] %}Since January 1, 2023, we noticed upload(s) of .egg/bdist_egg distribution file(s) to {{ site }} for {{ project_name }}.{% endtrans %} -

-

- {% trans site=request.registry.settings["site.name"] %}{{ site }} is in the process of deprecating bdist_egg distribution file uploads, and will not accept them beginning August 1, 2023.{% endtrans %} -

- -

{% trans %}What should I do?{% endtrans %}

-

- {% trans %}Update your release tooling to cease upload of .egg/bdist_egg distribution files. If you are not already, and require binary releases, update your release tooling to upload .whl/bdist_wheel distribution files instead.{% endtrans %} -

-

- {% trans %}Read more about Wheels vs Egg distribution files.{% endtrans %} -

-{% endblock %} diff --git a/warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.txt b/warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.txt deleted file mode 100644 index 15293a92b24f..000000000000 --- a/warehouse/templates/email/egg-uploads-deprecated-initial-notice/body.txt +++ /dev/null @@ -1,28 +0,0 @@ -{# - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. --#} -{% extends "email/_base/body.txt" %} - -{% block content %} -# {% trans %}What?{% endtrans %} - -{% trans site=request.registry.settings["site.name"] %}Since January 1, 2023, we noticed upload(s) of `.egg`/`bdist_egg` distribution file(s) to {{ site }} for {{ project_name }}.{% endtrans %} - -{% trans site=request.registry.settings["site.name"] %}{{ site }} is in the process of deprecating `bdist_egg` distribution file uploads, and will not accept them beginning August 1, 2023.{% endtrans %} - -# {% trans %}What should I do?{% endtrans %} - -{% trans %}Update your release tooling to cease upload of `.egg`/`bdist_egg` distribution files. If you are not already, and require binary releases, update your release tooling to upload `.whl`/`bdist_wheel` distribution files instead.{% endtrans %} - -{% trans %}Read more about [Wheels vs Egg](https://packaging.python.org/en/latest/discussions/wheel-vs-egg) distribution files.{% endtrans %} -{% endblock %} diff --git a/warehouse/templates/email/egg-uploads-deprecated-initial-notice/subject.txt b/warehouse/templates/email/egg-uploads-deprecated-initial-notice/subject.txt deleted file mode 100644 index f8a0610b80f8..000000000000 --- a/warehouse/templates/email/egg-uploads-deprecated-initial-notice/subject.txt +++ /dev/null @@ -1,17 +0,0 @@ -{# - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. --#} - -{% extends "email/_base/subject.txt" %} - -{% block subject %}{% trans site=request.registry.settings["site.name"] %}Deprecated bdist_egg uploaded to {{ site }}{% endtrans %}{% endblock %} diff --git a/warehouse/templates/email/egg-uploads-deprecated/body.html b/warehouse/templates/email/egg-uploads-deprecated/body.html deleted file mode 100644 index 2b609dd8477c..000000000000 --- a/warehouse/templates/email/egg-uploads-deprecated/body.html +++ /dev/null @@ -1,32 +0,0 @@ -{# - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. --#} -{% extends "email/_base/body.html" %} - -{% block content %} -

{% trans %}What?{% endtrans %}

-

- {% trans site=request.registry.settings["site.name"] %}During a recent upload of {{ project_name }} to {{ site }}, we noticed you uploaded an .egg/bdist_egg distribution file.{% endtrans %} -

-

- {% trans site=request.registry.settings["site.name"] %}{{ site }} is in the process of deprecating bdist_egg distribution file uploads, and will not accept them beginning August 1, 2023.{% endtrans %} -

- -

{% trans %}What should I do?{% endtrans %}

-

- {% trans %}Update your release tooling to cease upload of .egg/bdist_egg distribution files. If you are not already, and require binary releases, update your release tooling to upload .whl/bdist_wheel distribution files instead.{% endtrans %} -

-

- {% trans %}Read more about Wheels vs Egg distribution files.{% endtrans %} -

-{% endblock %} diff --git a/warehouse/templates/email/egg-uploads-deprecated/body.txt b/warehouse/templates/email/egg-uploads-deprecated/body.txt deleted file mode 100644 index 11d90646cc01..000000000000 --- a/warehouse/templates/email/egg-uploads-deprecated/body.txt +++ /dev/null @@ -1,28 +0,0 @@ -{# - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. --#} -{% extends "email/_base/body.txt" %} - -{% block content %} -# {% trans %}What?{% endtrans %} - -{% trans site=request.registry.settings["site.name"] %}During a recent upload of {{ project_name }} to {{ site }}, we noticed you uploaded an `.egg`/`bdist_egg` distribution file.{% endtrans %} - -{% trans site=request.registry.settings["site.name"] %}{{ site }} is in the process of deprecating `bdist_egg` distribution file uploads, and will not accept them beginning August 1, 2023.{% endtrans %} - -# {% trans %}What should I do?{% endtrans %} - -{% trans %}Update your release tooling to cease upload of `.egg`/`bdist_egg` distribution files. If you are not already, and require binary releases, update your release tooling to upload `.whl`/`bdist_wheel` distribution files instead.{% endtrans %} - -{% trans %}Read more about [Wheels vs Egg](https://packaging.python.org/en/latest/discussions/wheel-vs-egg) distribution files.{% endtrans %} -{% endblock %} diff --git a/warehouse/templates/email/egg-uploads-deprecated/subject.txt b/warehouse/templates/email/egg-uploads-deprecated/subject.txt deleted file mode 100644 index f8a0610b80f8..000000000000 --- a/warehouse/templates/email/egg-uploads-deprecated/subject.txt +++ /dev/null @@ -1,17 +0,0 @@ -{# - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. --#} - -{% extends "email/_base/subject.txt" %} - -{% block subject %}{% trans site=request.registry.settings["site.name"] %}Deprecated bdist_egg uploaded to {{ site }}{% endtrans %}{% endblock %}