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

Add compatibility for Python 3.13 #473

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rominf
Copy link

@rominf rominf commented Jun 28, 2024

What do these changes do?

  • Fix tox for Python >= 3.12
  • Remove pytest-profiling
  • Remove pytest-asyncio traces
  • Add compatibility for Python 3.13

Are there changes in behavior for the user?

  • Add compatibility for Python 3.13

Related issue number

Closes #403.

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • tox testenvs have been executed in the following environments:
    • Linux (Fedora 40): {py38,py39,py310,py311,py312,py313}-{cov}
  • Documentation reflects the changes
  • Add a news fragment into the NEWS.rst file
    • Add under the "aiosmtpd-next" section, creating one if necessary
      • You may create subsections to group the changes, if you like
    • Use full sentences with correct case and punctuation
    • Refer to relevant Issue if applicable

@rominf rominf marked this pull request as ready for review June 28, 2024 05:48
tox.ini Outdated Show resolved Hide resolved
@webknjaz
Copy link
Member

@rominf this needs rebasing

@rominf
Copy link
Author

rominf commented Sep 4, 2024

@webknjaz I rebased the PR. Could you please re-review it?

aiosmtpd/docs/NEWS.rst Outdated Show resolved Hide resolved
@@ -4,6 +4,14 @@

.. towncrier release notes start
Copy link
Member

Choose a reason for hiding this comment

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

weird to see this and no towncrier config in the repo..

@@ -99,6 +104,22 @@ def cache_fqdn(session_mocker: MockFixture):
# region #### Common Fixtures #########################################################


def _server_resource(name: str, /) -> Generator[Path, None, None]:
ref = importlib_resources.files("aiosmtpd.tests.certs") / name
Copy link
Member

Choose a reason for hiding this comment

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

Weird this is shipped in wheels.. I'd go for a relative path myself.

OTOH, I recommend integrating https://trustme.rtfd.io like I did in aiohttp and many other places so that the TLS certificates are ephemeral and don't even exist in the repo.

Copy link
Author

Choose a reason for hiding this comment

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

I agree it is possible, however for me it looks like it is out of scope for this PR.

tox.ini Show resolved Hide resolved
@webknjaz
Copy link
Member

webknjaz commented Sep 5, 2024

@rominf I've triggered the CI for you but I'll leave it to the maintainers to merge. It looks like you missed a dependency file update somewhere (the CI doesn't call tox it seems).

@rominf
Copy link
Author

rominf commented Sep 5, 2024

UPD: ah, disregard this. tox is called indirectly via release.py.

@rominf I've triggered the CI for you but I'll leave it to the maintainers to merge. It looks like you missed a dependency file update somewhere (the CI doesn't call tox it seems).

It looks it like it is not in GitHub Actions workflows at all (rg is ripgrep):

$ rg tox .github/
.github/pull_request_template.md
20:- [ ] tox testenvs have been executed in the following environments:

.github/PULL_REQUEST_TEMPLATE/pull_request_template.md
20:- [ ] tox testenvs have been executed in the following environments:

Fix import error:
```
py312-cov: commands[2]> pytest --cov --cov-report=xml --cov-report=html --cov-report=term --tb=short
ImportError while loading conftest '/home/rominf/dev/aiosmtpd/aiosmtpd/tests/conftest.py'.
aiosmtpd/tests/conftest.py:15: in <module>
    from pkg_resources import resource_filename
E   ModuleNotFoundError: No module named 'pkg_resources'
```
by migrating to `importlib.resources`:
https://importlib-resources.readthedocs.io/en/latest/migration.html#pkg-resources-resource-filename
Remove [pytest-profiling](https://pypi.org/project/pytest-profiling/),
as it does not support latest Python versions, was not updated for 5
years, and according to the comment in `aiosmtpd/docs/testing.rst` was
not very useful anyway.
`pytest-asyncio` is unnecessary, it was missing in `tox.ini`, and tests
pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

assert_smtp_socket fails with Python 3.13.0a3
2 participants