Mailing List Archive

Remove asyncore, asynchat and smtpd modules
Hi,

The asyncore module is a very old module of the Python stdlib for
asynchronous programming, usually to handle network sockets
concurrently. It's a common event loop, but its design has many flaws.

The asyncio module was added to Python 3.4 with a well designed
architecture. Twisted developers, who have like 10 to 20 years of
experience in asynchronous programming, helped to design the asyncio
API. By design, asyncio doesn't have flaws which would be really hard
to fix in asyncore and asynchat.

It was decided to start deprecating the asyncore, asynchat and smtpd
modules in Python 3.6 released in 2016, 5 years ago. Python 3.10 emits
DeprecationWarning. asynchat and smtpd are implemented with asyncore.
Open issues in asyncore, asynchat and smtpd have been closed as "wont
fix" because these modules are deprecated. These modules are basically
no longer maintained.

I propose to remove asyncore, aynchat and smtpd in Python 3.11 to
reduce the Python maintenance burden, while asyncio remains available
in stdlib and is maintained:

* asyncore and asynchat can be replaced with asyncio
* smtpd can be replaced with aiosmtpd which is based on asyncio:
https://aiosmtpd.readthedocs.io/

If someone wants to continue using asyncore, asynchat or smtpd, it's
trivial to copy Python 3.10 asyncore.py, asynchat.py and smtpd.py to
their project, and maintain these files there. Someone is also free to
continue maintaining these modules as third-party projects on PyPI.

The removal is discussed at:
https://bugs.python.org/issue28533

I wrote a PR to remove the 3 modules:
https://github.com/python/cpython/pull/29521


... in short, the intent is to move the asyncore, asynchat and smtpd
maintenance outside the Pyhon project ;-) (if anyone still use them)


Victor
--
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/LZOOLX5EKOITW55TW7JQYKLXJUPCAJB4/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: Remove asyncore, asynchat and smtpd modules [ In reply to ]
Yes please. Long overdue.

On Thu, Nov 11, 2021 at 4:38 AM Victor Stinner <vstinner@python.org> wrote:

> Hi,
>
> The asyncore module is a very old module of the Python stdlib for
> asynchronous programming, usually to handle network sockets
> concurrently. It's a common event loop, but its design has many flaws.
>
> The asyncio module was added to Python 3.4 with a well designed
> architecture. Twisted developers, who have like 10 to 20 years of
> experience in asynchronous programming, helped to design the asyncio
> API. By design, asyncio doesn't have flaws which would be really hard
> to fix in asyncore and asynchat.
>
> It was decided to start deprecating the asyncore, asynchat and smtpd
> modules in Python 3.6 released in 2016, 5 years ago. Python 3.10 emits
> DeprecationWarning. asynchat and smtpd are implemented with asyncore.
> Open issues in asyncore, asynchat and smtpd have been closed as "wont
> fix" because these modules are deprecated. These modules are basically
> no longer maintained.
>
> I propose to remove asyncore, aynchat and smtpd in Python 3.11 to
> reduce the Python maintenance burden, while asyncio remains available
> in stdlib and is maintained:
>
> * asyncore and asynchat can be replaced with asyncio
> * smtpd can be replaced with aiosmtpd which is based on asyncio:
> https://aiosmtpd.readthedocs.io/
>
> If someone wants to continue using asyncore, asynchat or smtpd, it's
> trivial to copy Python 3.10 asyncore.py, asynchat.py and smtpd.py to
> their project, and maintain these files there. Someone is also free to
> continue maintaining these modules as third-party projects on PyPI.
>
> The removal is discussed at:
> https://bugs.python.org/issue28533
>
> I wrote a PR to remove the 3 modules:
> https://github.com/python/cpython/pull/29521
>
>
> ... in short, the intent is to move the asyncore, asynchat and smtpd
> maintenance outside the Pyhon project ;-) (if anyone still use them)
>
>
> Victor
> --
> Night gathers, and now my watch begins. It shall not end until my death.
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-leave@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/LZOOLX5EKOITW55TW7JQYKLXJUPCAJB4/
> Code of Conduct: http://python.org/psf/codeofconduct/
>


--
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
Re: Remove asyncore, asynchat and smtpd modules [ In reply to ]
On 11. 11. 21 13:31, Victor Stinner wrote:
> Hi,
>
> The asyncore module is a very old module of the Python stdlib for
> asynchronous programming, usually to handle network sockets
> concurrently. It's a common event loop, but its design has many flaws.
>
> The asyncio module was added to Python 3.4 with a well designed
> architecture. Twisted developers, who have like 10 to 20 years of
> experience in asynchronous programming, helped to design the asyncio
> API. By design, asyncio doesn't have flaws which would be really hard
> to fix in asyncore and asynchat.
>
> It was decided to start deprecating the asyncore, asynchat and smtpd
> modules in Python 3.6 released in 2016, 5 years ago. Python 3.10 emits
> DeprecationWarning.

Wait, only Python 3.10?
According to the policy, the warning should be there for *at least* two
releases. (That's a minimum, for removing entire modules it might make
sense to give people even more time.)


> asynchat and smtpd are implemented with asyncore.
> Open issues in asyncore, asynchat and smtpd have been closed as "wont
> fix" because these modules are deprecated. These modules are basically
> no longer maintained.
>
> I propose to remove asyncore, aynchat and smtpd in Python 3.11 to
> reduce the Python maintenance burden, while asyncio remains available
> in stdlib and is maintained:
>
> * asyncore and asynchat can be replaced with asyncio
> * smtpd can be replaced with aiosmtpd which is based on asyncio:
> https://aiosmtpd.readthedocs.io/
>
> If someone wants to continue using asyncore, asynchat or smtpd, it's
> trivial to copy Python 3.10 asyncore.py, asynchat.py and smtpd.py to
> their project, and maintain these files there. Someone is also free to
> continue maintaining these modules as third-party projects on PyPI.
>
> The removal is discussed at:
> https://bugs.python.org/issue28533
>
> I wrote a PR to remove the 3 modules:
> https://github.com/python/cpython/pull/29521
>
>
> ... in short, the intent is to move the asyncore, asynchat and smtpd
> maintenance outside the Pyhon project ;-) (if anyone still use them)
>
>
> Victor
>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/2Q22LYRMTYRDSCXXLM2DMVTT3VVRQF5B/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: Remove asyncore, asynchat and smtpd modules [ In reply to ]
> > It was decided to start deprecating the asyncore, asynchat and smtpd
> > modules in Python 3.6 released in 2016, 5 years ago. Python 3.10 emits
> > DeprecationWarning.
>
> Wait, only Python 3.10?
> According to the policy, the warning should be there for *at least* two
> releases. (That's a minimum, for removing entire modules it might make
> sense to give people even more time.)

The PEP 387 says "Similarly a feature cannot be removed without notice
between any two consecutive releases."

It is the case here. The 3 modules are marked as deprecated for 4
releases in the documentation: Python 3.6, 3.7, 3.9 and 3.10. Example:
https://docs.python.org/3.6/library/asyncore.html

Victor
--
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/R5LTSKKEGDDO3TTLLZFDTAKOH3ACBTMV/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: Remove asyncore, asynchat and smtpd modules [ In reply to ]
On Fri, Nov 12, 2021 at 4:16 AM Victor Stinner <vstinner@python.org> wrote:

> > > It was decided to start deprecating the asyncore, asynchat and smtpd
> > > modules in Python 3.6 released in 2016, 5 years ago. Python 3.10 emits
> > > DeprecationWarning.
> >
> > Wait, only Python 3.10?
> > According to the policy, the warning should be there for *at least* two
> > releases. (That's a minimum, for removing entire modules it might make
> > sense to give people even more time.)
>
> The PEP 387 says "Similarly a feature cannot be removed without notice
> between any two consecutive releases."
>
> It is the case here. The 3 modules are marked as deprecated for 4
> releases in the documentation: Python 3.6, 3.7, 3.9 and 3.10. Example:
> https://docs.python.org/3.6/library/asyncore.html
>

But have they been raising exceptions for two releases?
Re: Remove asyncore, asynchat and smtpd modules [ In reply to ]
On Tue, Nov 16, 2021 at 1:15 AM Brett Cannon <brett@python.org> wrote:
> But have they been raising exceptions for two releases?

As I wrote previously, the DeprecationWarning warning is only emitted
at runtime since Python 3.10.

Since my PR got 5 approvals, I just merged it:
https://github.com/python/cpython/pull/29521

The asyncore, asynchat and smtpd modules are now removed in Python
3.11. You should now use asyncio and aiosmtpd instead.

Note: the binhex module has also been removed in Python 3.11. It
emitted a DeprecationWarning in Python 3.9 and 3.10.

Victor
--
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/LVFBHVNV3INGKVVRONVRIA3Q6JIYXMZM/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: Remove asyncore, asynchat and smtpd modules [ In reply to ]
On 12. 11. 21 13:09, Victor Stinner wrote:
>>> It was decided to start deprecating the asyncore, asynchat and smtpd
>>> modules in Python 3.6 released in 2016, 5 years ago. Python 3.10 emits
>>> DeprecationWarning.
>>
>> Wait, only Python 3.10?
>> According to the policy, the warning should be there for *at least* two
>> releases. (That's a minimum, for removing entire modules it might make
>> sense to give people even more time.)
>
> The PEP 387 says "Similarly a feature cannot be removed without notice
> between any two consecutive releases."
>
> It is the case here. The 3 modules are marked as deprecated for 4
> releases in the documentation: Python 3.6, 3.7, 3.9 and 3.10. Example:
> https://docs.python.org/3.6/library/asyncore.html

PEP 387 also contains a detailed process for making incompatible
changes, which calls for warnings to appear in at least two releases.

Do you think the process section can be ignored? We should remove it
from the PEP if that's the case.

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/KF34VL46ZAX6FWEFMXKZASPKF65USOZT/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: Remove asyncore, asynchat and smtpd modules [ In reply to ]
On Tue, Nov 16, 2021 at 3:05 AM Petr Viktorin <encukou@gmail.com> wrote:

> On 12. 11. 21 13:09, Victor Stinner wrote:
> >>> It was decided to start deprecating the asyncore, asynchat and smtpd
> >>> modules in Python 3.6 released in 2016, 5 years ago. Python 3.10 emits
> >>> DeprecationWarning.
> >>
> >> Wait, only Python 3.10?
> >> According to the policy, the warning should be there for *at least* two
> >> releases. (That's a minimum, for removing entire modules it might make
> >> sense to give people even more time.)
> >
> > The PEP 387 says "Similarly a feature cannot be removed without notice
> > between any two consecutive releases."
> >
> > It is the case here. The 3 modules are marked as deprecated for 4
> > releases in the documentation: Python 3.6, 3.7, 3.9 and 3.10. Example:
> > https://docs.python.org/3.6/library/asyncore.html
>
> PEP 387 also contains a detailed process for making incompatible
> changes, which calls for warnings to appear in at least two releases.
>
> Do you think the process section can be ignored? We should remove it
> from the PEP if that's the case.
>

I don't think it should be ignored and the modules got yanked prematurely.
A request can be made to the SC, though, to expedite the removal with only
one release raising an exception.
Re: Remove asyncore, asynchat and smtpd modules [ In reply to ]
I created https://github.com/python/steering-council/issues/86 to ask
for a SC exception.

Victor

On Tue, Nov 16, 2021 at 8:11 PM Brett Cannon <brett@python.org> wrote:
>
>
>
> On Tue, Nov 16, 2021 at 3:05 AM Petr Viktorin <encukou@gmail.com> wrote:
>>
>> On 12. 11. 21 13:09, Victor Stinner wrote:
>> >>> It was decided to start deprecating the asyncore, asynchat and smtpd
>> >>> modules in Python 3.6 released in 2016, 5 years ago. Python 3.10 emits
>> >>> DeprecationWarning.
>> >>
>> >> Wait, only Python 3.10?
>> >> According to the policy, the warning should be there for *at least* two
>> >> releases. (That's a minimum, for removing entire modules it might make
>> >> sense to give people even more time.)
>> >
>> > The PEP 387 says "Similarly a feature cannot be removed without notice
>> > between any two consecutive releases."
>> >
>> > It is the case here. The 3 modules are marked as deprecated for 4
>> > releases in the documentation: Python 3.6, 3.7, 3.9 and 3.10. Example:
>> > https://docs.python.org/3.6/library/asyncore.html
>>
>> PEP 387 also contains a detailed process for making incompatible
>> changes, which calls for warnings to appear in at least two releases.
>>
>> Do you think the process section can be ignored? We should remove it
>> from the PEP if that's the case.
>
>
> I don't think it should be ignored and the modules got yanked prematurely. A request can be made to the SC, though, to expedite the removal with only one release raising an exception.



--
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/VQQPBASN5WHC4GEX7HLVWF26H6CMSNYV/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: Remove asyncore, asynchat and smtpd modules [ In reply to ]
I think it would be fine to wait just one release, until 3.12. Makes no
substantial maintenance difference and maybe easier for users with more
advanced notice, especially for module removal.

I also wonder if maybe we should scale delay between dep -> removal based
on maintenance burden estimate, rather than 2 versions for all. Module
removal certainly takes more effort to adjust in code vs simple function
name change with 1:1 replacement.

--
--Kyle R. Stanley, Python Core Developer (what is a core dev?
<https://devguide.python.org/coredev/>)
*Pronouns: they/them **(why is my pronoun here?*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
)
Re: Remove asyncore, asynchat and smtpd modules [ In reply to ]
Speaking as the author of the doc pages, I think I can safely say that
anyone who was smart enough to use asyncore/asychat back in the day (I used
it in "Python Web Programming") is almost certainly smart enough to have
migrated away from them long ago. They were an interesting approach to
asynchronous networking, but I think it's safe to say that world has moved
on in 20 years.

Kind regards,
Steve


On Wed, Nov 17, 2021 at 6:13 AM Kyle Stanley <aeros167@gmail.com> wrote:

> I think it would be fine to wait just one release, until 3.12. Makes no
> substantial maintenance difference and maybe easier for users with more
> advanced notice, especially for module removal.
>
> I also wonder if maybe we should scale delay between dep -> removal based
> on maintenance burden estimate, rather than 2 versions for all. Module
> removal certainly takes more effort to adjust in code vs simple function
> name change with 1:1 replacement.
>
> --
> --Kyle R. Stanley, Python Core Developer (what is a core dev?
> <https://devguide.python.org/coredev/>)
> *Pronouns: they/them **(why is my pronoun here?*
> <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
> )
>
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-leave@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/F52UKISVFFGBNCL2AZ4XVX2KL35O6ZNH/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
Re: Remove asyncore, asynchat and smtpd modules [ In reply to ]
On 16. 11. 21 1:36, Victor Stinner wrote:
> As I wrote previously, the DeprecationWarning warning is only emitted
> at runtime since Python 3.10.
>
> Since my PR got 5 approvals, I just merged it:
> https://github.com/python/cpython/pull/29521

No mater the number of approvals, this removal does not follow the policy.

--
Miro Hron?ok
--
Phone: +420777974800
IRC: mhroncok

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/RVSMVPGFWCTFDGHKHBZ72NMXXFT2EIIU/
Code of Conduct: http://python.org/psf/codeofconduct/