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

FIX for "No module named 'public'" during installation #242

Merged
merged 8 commits into from
Feb 7, 2021
Merged

FIX for "No module named 'public'" during installation #242

merged 8 commits into from
Feb 7, 2021

Conversation

manfred-kaiser
Copy link
Contributor

@manfred-kaiser manfred-kaiser commented Feb 5, 2021

(Original PR notes moved into HTML comment)

What do these changes do?

Move the __version__ attribute from smtp.py to __init__.py

This is enough to prevent breakage when installing using setuptools<46.4.0 (see this PR which resulted in this change for 46.4.0)

Another benefit is that this new location is Semantically more correct -- version applies to all aiosmtpd package, not just smtp.py

Are there changes in behavior for the user?

Only if user actively searches for __version__ in the source code of smtp.py (via regex, startswith, or AST) instead of importing that attribute from smtp.py

User that do from aiosmtpd.smtp import __version__ will NOT be affected, though it will be better if the import is done from aiosmtpd instead.

Related issue number

Fixes #241 (partially? Not sure if encoding error in the output posted in that issue is related to this...)

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • tox testenvs have been executed in the following environments:
    • Windows 10 (via PyCharm tox runner): (ALL)
    • Windows 10 (via PSCore 7.1.1): (ALL)
    • Windows 10 (via Cygwin): qa,py36-{nocov,cov}
    • Ubuntu 18.04 on WSL 1.0: (ALL) + pypy3-{nocov,cov,diffcov}
    • FreeBSD 12.2 on VBox: (ALL) + pypy3-{nocov,cov,diffcov}
    • OpenSUSE Leap 15.2 on VBox: (ALL) + pypy3-{nocov,cov,diffcov}
    • AlmaLinux 8.3 Beta 1 on VBox: (ALL) + pypy3-{nocov,cov,diffcov}
  • Documentation reflects the changes
  • Add a news fragment into the NEWS.rst file

@manfred-kaiser manfred-kaiser changed the title Create setup.cfg FIX for "No module named 'public'" during installation Feb 5, 2021
This should solve issue #241, in which setuptools < 46.4.0 tries to
naively import smtp.py (due to version being specified as "attr:
aiosmtpd.smtp.__version__" and barfs when encountering "from public
import public"

Moving __version__ to __init__.py seems to be the wisest -- and most
semantically accurate -- decision. Not only can setuptools < 46.4.0
simply do a naive import of __init__.py (which contains no deps), but
this signifies the version number applies to the _whole_ aiosmtpd
package instead of just the smtp.py module.

This impacts the following files
* setup.cfg -- scan inside aiosmtpd instead of aiosmtpd.smtp
* smtp.py -- it now needs to import
* conf.py -- no longer scan smtp.py; import from __init__ instead
In this case, ensure __version__ from __init__.py is exact same object
as __version__ from smtp.py
@pepoluan pepoluan mentioned this pull request Feb 6, 2021
11 tasks
Copy link
Collaborator

@pepoluan pepoluan left a comment

Choose a reason for hiding this comment

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

Let's marinate this for 1x24 and squamerge afterwards.

@pepoluan pepoluan added this to the 1.3 milestone Feb 6, 2021
@pepoluan pepoluan added ready-to-merge PRs that are ready to merge compatibility labels Feb 6, 2021
@pepoluan
Copy link
Collaborator

pepoluan commented Feb 6, 2021

master merge only changes README.rst so we'll not reset the countdown to squamerging.

@pepoluan pepoluan merged commit 1288566 into aio-libs:master Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility ready-to-merge PRs that are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't install Version 1.2.4 - No module named 'public'
2 participants