Re: What to use instead of nntplib?

2023-05-22 Thread Jon Ribbens via Python-list
On 2023-05-22, Skip Montanaro  wrote:
>> My understanding is that nntplib isn't being erased from reality,
>> it's merely being removed from the set of modules that are provided
>> by default.
>>
>> I presume that once it's removed from the core, it will still be
>> possible to install it via pip or some other mechanism.
>
> It won't magically be available via pip unless someone steps up to maintain
> it as a PyPI package

That would appear to have already happened over a month ago.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a Python module to parse a date like the 'date' command in Linux?

2023-05-22 Thread Mike Dewhirst

On 21/05/2023 5:53 am, Chris Green wrote:

I'm converting a bash script to python as it has become rather clumsy
in bash.


What is the use case?


However I have hit a problem with converting dates, the bash script
has:-

 dat=$(date --date "$1" +"%Y/%m/%d")

and this will accept almost anything reasonably sensible that can be
interpreted as a date, in particular it accepts things like "tomorrow",
"yesterday" and "next thursday".

Is there anything similar in Python or would I be better off simply
using os.system() to run date from the python program?




--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Your
email software can handle signing.



OpenPGP_signature
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What to use instead of nntplib?

2023-05-22 Thread Grant Edwards
On 2023-05-22, Keith Thompson  wrote:

> My understanding is that nntplib isn't being erased from reality,
> it's merely being removed from the set of modules that are provided
> by default.
>
> I presume that once it's removed from the core, it will still be
> possible to install it via pip or some other mechanism.

If somebody rescues the code and puts it in Pypi (assuming the
copyright owner allows that). IIRC, somebody is trying to do that, but
there some contention because Pypi won't allow the use of the name
"nntplib" for the package because it conflicts with a library builtin.
>
> import warnings
> warnings.filterwarnings("ignore", category=DeprecationWarning)
> import nntplib

Yep, thanks. That at least prevents the warning from messing up my
slrn screen. :)

> If my understanding is correct, why is this such a big problem?

It's not a "big" problem, but something that "just worked" with any
Python installation now requires that the user install an extra
package. If they don't already have pip, then they have to install
that first. And then they have to do it again, because the first time
they installed pip for the wrong version of python. [I don't really
get how that happens, but there seem to be a constant stream of
postings from people with that problem.]

--
Grant



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What to use instead of nntplib?

2023-05-22 Thread Skip Montanaro
>
> My understanding is that nntplib isn't being erased from reality,
> it's merely being removed from the set of modules that are provided
> by default.
>
> I presume that once it's removed from the core, it will still be
> possible to install it via pip or some other mechanism.
>

It won't magically be available via pip unless someone steps up to maintain
it as a PyPI package

Skip

>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What to use instead of nntplib?

2023-05-22 Thread Keith Thompson
Grant Edwards  writes:
> On 2023-05-21, Retrograde  wrote:
>> Who ever came up with "Removing dead batteries" as a slogan, when
>> some of those batteries still work perfectly well, needs to rethink
>> it. Go ahead and remove code that no longer works, OK.  But removing
>> unpopular modules?  That undercuts the entire philosophy of the
>> platform, in my opinion.
>
> And one of the metrics of "popularity" seems to be "activity"
> (e.g. changes committed).  For things that have been around for 20+
> years and have all the features they need and all of the bugs fixed
> (and are now very stable) that lack of "activity" is interpreted as
> "unpopular" regardless of how many people are using the module.

My understanding is that nntplib isn't being erased from reality,
it's merely being removed from the set of modules that are provided
by default.

I presume that once it's removed from the core, it will still be
possible to install it via pip or some other mechanism.

You can disable the deprecation warning:

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
import nntplib

If my understanding is correct, why is this such a big problem?

-- 
Keith Thompson (The_Other_Keith) keith.s.thompso...@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
-- 
https://mail.python.org/mailman/listinfo/python-list


[Python-announce] [RELEASE] Python 3.12.0 beta 1 released.

2023-05-22 Thread Thomas Wouters
I'm pleased to announce the release of Python 3.12 beta 1 (and feature
freeze for Python 3.12).

https://www.python.org/downloads/release/python-3120b1/
This is a beta preview of Python 3.12

Python 3.12 is still in development. This release, 3.12.0b1, is the first
of four planned beta release previews of 3.12.

Beta release previews are intended to give the wider community the
opportunity to test new features and bug fixes and to prepare their
projects to support the new feature release.

We strongly encourage maintainers of third-party Python projects to test
with 3.12 during the beta phase and report issues found to [the Python bug
tracker (Issues · python/cpython · GitHub) as soon as possible. While the
release is planned to be feature complete entering the beta phase, it is
possible that features may be modified or, in rare cases, deleted up until
the start of the release candidate phase (Monday, 2023-07-31). Our goal is
to have no ABI changes after beta 4 and as few code changes as possible
after 3.12.0rc1, the first release candidate. To achieve that, it will be
extremely important to get as much exposure for 3.12 as possible during the
beta phase.

Please keep in mind that this is a preview release and its use is not
recommended for production environments.


Major new features of the 3.12 series, compared to 3.11

Some of the new major new features and changes in Python 3.12 are:


   - New type annotation syntax for generic classes (PEP 695
   ).
   - More flexible f-string parsing, allowing many things previously
   disallowed (PEP 701 ).
   - Even more improved error messages. More exceptions potentially caused
   by typos now make suggestions to the user.
   - Many large and small performance improvements (like PEP 709
   ).
   - Support for the Linux perf profiler to report Python function names in
   traces.
   - The deprecated wstr and wstr_length members of the C implementation of
   unicode objects were removed, per PEP 623
   .
   - In the unittest module, a number of long deprecated methods and
   classes were removed. (They had been deprecated since Python 3.1 or 3.2).
   - The deprecated smtpd and distutils modules have been removed (see PEP
   594  and PEP 632
   . The setuptools package (installed
   by default in virtualenvs and many other places) continues to provide the
   distutils module.
   - A number of other old, broken and deprecated functions, classes and
   methods have been removed.
   - Invalid backslash escape sequences in strings now warn with
   SyntaxWarning instead of DeprecationWarning, making them more visible.
   (They will become syntax errors in the future.)
   - The internal representation of integers has changed in preparation for
   performance enhancements. (This should not affect most users as it is an
   internal detail, but it may cause problems for Cython-generated code.)
   - (Hey, fellow core developer, if a feature you find important is
   missing from this list, let Thomas know .)

For more details on the changes to Python 3.12, see What’s new in Python
3.12 . The next pre-release
of Python 3.12 will be 3.12.0b2, currently scheduled for 2023-05-29.


More resources

Online Documentation .
PEP 693 , the Python 3.12
Release Schedule.
Report bugs via GitHub Issues .
Help fund Python and its community .


And now for something completely different

As the first beta release marks the point at which we fork off the release
branch from the main development branch, here’s a poem about forks in the
road.

Two roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth;

Then took the other, as just as fair,
And having perhaps the better claim,
Because it was grassy and wanted wear;
Though as for that the passing there
Had worn them really about the same,

And both that morning equally lay
In leaves, no step had trodden black.
Oh, I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.

I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I —
I took the one less traveled by,
And that has made all the difference.


*The Road Not Taken*, by Robert Frost.

Enjoy the new release

Thanks to all of the many volunteers who help make Python Development and
these releases possible! Please consider supporting our efforts by
volunteering yourself or through organization contributions to the Python
Software Foundation.

Your release team,
Thomas 

[RELEASE] Python 3.12.0 beta 1 released.

2023-05-22 Thread Thomas Wouters
I'm pleased to announce the release of Python 3.12 beta 1 (and feature
freeze for Python 3.12).

https://www.python.org/downloads/release/python-3120b1/
This is a beta preview of Python 3.12

Python 3.12 is still in development. This release, 3.12.0b1, is the first
of four planned beta release previews of 3.12.

Beta release previews are intended to give the wider community the
opportunity to test new features and bug fixes and to prepare their
projects to support the new feature release.

We strongly encourage maintainers of third-party Python projects to test
with 3.12 during the beta phase and report issues found to [the Python bug
tracker (Issues · python/cpython · GitHub) as soon as possible. While the
release is planned to be feature complete entering the beta phase, it is
possible that features may be modified or, in rare cases, deleted up until
the start of the release candidate phase (Monday, 2023-07-31). Our goal is
to have no ABI changes after beta 4 and as few code changes as possible
after 3.12.0rc1, the first release candidate. To achieve that, it will be
extremely important to get as much exposure for 3.12 as possible during the
beta phase.

Please keep in mind that this is a preview release and its use is not
recommended for production environments.


Major new features of the 3.12 series, compared to 3.11

Some of the new major new features and changes in Python 3.12 are:


   - New type annotation syntax for generic classes (PEP 695
   ).
   - More flexible f-string parsing, allowing many things previously
   disallowed (PEP 701 ).
   - Even more improved error messages. More exceptions potentially caused
   by typos now make suggestions to the user.
   - Many large and small performance improvements (like PEP 709
   ).
   - Support for the Linux perf profiler to report Python function names in
   traces.
   - The deprecated wstr and wstr_length members of the C implementation of
   unicode objects were removed, per PEP 623
   .
   - In the unittest module, a number of long deprecated methods and
   classes were removed. (They had been deprecated since Python 3.1 or 3.2).
   - The deprecated smtpd and distutils modules have been removed (see PEP
   594  and PEP 632
   . The setuptools package (installed
   by default in virtualenvs and many other places) continues to provide the
   distutils module.
   - A number of other old, broken and deprecated functions, classes and
   methods have been removed.
   - Invalid backslash escape sequences in strings now warn with
   SyntaxWarning instead of DeprecationWarning, making them more visible.
   (They will become syntax errors in the future.)
   - The internal representation of integers has changed in preparation for
   performance enhancements. (This should not affect most users as it is an
   internal detail, but it may cause problems for Cython-generated code.)
   - (Hey, fellow core developer, if a feature you find important is
   missing from this list, let Thomas know .)

For more details on the changes to Python 3.12, see What’s new in Python
3.12 . The next pre-release
of Python 3.12 will be 3.12.0b2, currently scheduled for 2023-05-29.


More resources

Online Documentation .
PEP 693 , the Python 3.12
Release Schedule.
Report bugs via GitHub Issues .
Help fund Python and its community .


And now for something completely different

As the first beta release marks the point at which we fork off the release
branch from the main development branch, here’s a poem about forks in the
road.

Two roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth;

Then took the other, as just as fair,
And having perhaps the better claim,
Because it was grassy and wanted wear;
Though as for that the passing there
Had worn them really about the same,

And both that morning equally lay
In leaves, no step had trodden black.
Oh, I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.

I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I —
I took the one less traveled by,
And that has made all the difference.


*The Road Not Taken*, by Robert Frost.

Enjoy the new release

Thanks to all of the many volunteers who help make Python Development and
these releases possible! Please consider supporting our efforts by
volunteering yourself or through organization contributions to the Python
Software Foundation.

Your release team,
Thomas 

Re: Is there a Python module to parse a date like the 'date' command in Linux?

2023-05-22 Thread Tim Williams
On Mon, May 22, 2023 at 12:41 PM Mats Wichmann  wrote:

> On 5/20/23 13:53, Chris Green wrote:
> > I'm converting a bash script to python as it has become rather clumsy
> > in bash.
> >
> > However I have hit a problem with converting dates, the bash script
> > has:-
> >
> >  dat=$(date --date "$1" +"%Y/%m/%d")
> >
> > and this will accept almost anything reasonably sensible that can be
> > interpreted as a date, in particular it accepts things like "tomorrow",
> > "yesterday" and "next thursday".
> >
> > Is there anything similar in Python or would I be better off simply
> > using os.system() to run date from the python program?
> >
>
> in the standard library, datetime
>
> as an addon module, dateutil  (install as python-dateutil)
>
> Don't know if either are exactly what you want, but do take a look.
>
> --
> https://mail.python.org/mailman/listinfo/python-list


In particular,check out dateutil.parser.
parser — dateutil 2.8.2 documentation


parser


This module offers a generic date/time string parser which is able to parse
most known formats to represent a date and/or time.

This module attempts to be forgiving with regards to unlikely input
formats, returning a datetime object even for dates which are ambiguous. If
an element of a date/time stamp is omitted, the following rules are applied:
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a Python module to parse a date like the 'date' command in Linux?

2023-05-22 Thread Mats Wichmann

On 5/20/23 13:53, Chris Green wrote:

I'm converting a bash script to python as it has become rather clumsy
in bash.

However I have hit a problem with converting dates, the bash script
has:-

 dat=$(date --date "$1" +"%Y/%m/%d")

and this will accept almost anything reasonably sensible that can be
interpreted as a date, in particular it accepts things like "tomorrow",
"yesterday" and "next thursday".

Is there anything similar in Python or would I be better off simply
using os.system() to run date from the python program?



in the standard library, datetime

as an addon module, dateutil  (install as python-dateutil)

Don't know if either are exactly what you want, but do take a look.

--
https://mail.python.org/mailman/listinfo/python-list


Re: What to use instead of nntplib?

2023-05-22 Thread Grant Edwards
On 2023-05-21, Retrograde  wrote:

> Who ever came up with "Removing dead batteries" as a slogan, when
> some of those batteries still work perfectly well, needs to rethink
> it. Go ahead and remove code that no longer works, OK.  But removing
> unpopular modules?  That undercuts the entire philosophy of the
> platform, in my opinion.

And one of the metrics of "popularity" seems to be "activity"
(e.g. changes committed).  For things that have been around for 20+
years and have all the features they need and all of the bugs fixed
(and are now very stable) that lack of "activity" is interpreted as
"unpopular" regardless of how many people are using the module.

--
Grant




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What to use instead of nntplib?

2023-05-22 Thread Retrograde
> >> See PEP 594: https://peps.python.org/pep-0594/
> >
> > Thanks Cameron.
> > A scary list; I must have a dozen projects from the late 90s still
> > live that are using many of these! I'm glad I'm retired and won't
> > be the one who has to fix 'em :-)
> 
> It has been pointed out to me that Perl still has a supported NNTP
> library. That stung. However, it's a CPAN module, which is more
> equivalent to PyPI than to the standard library, so I guess that it
> isn't as bad a loss of face as I feared.


I'm latching onto this thread just so I can bitch:

I always thought "Batteries included" was a great concept, a great
philosophy, a great slogan.  It encouraged me to look into python
because they made the tools available for you to do just about anything
they want.

Who ever came up with "Removing dead batteries" as a slogan, when some
of those batteries still work perfectly well, needs to rethink it. Go
ahead and remove code that no longer works, OK.  But removing
unpopular modules?  That undercuts the entire philosophy of the
platform, in my opinion.
-- 
https://mail.python.org/mailman/listinfo/python-list


Is there a Python module to parse a date like the 'date' command in Linux?

2023-05-22 Thread Chris Green
I'm converting a bash script to python as it has become rather clumsy
in bash.

However I have hit a problem with converting dates, the bash script
has:-

dat=$(date --date "$1" +"%Y/%m/%d")

and this will accept almost anything reasonably sensible that can be
interpreted as a date, in particular it accepts things like "tomorrow",
"yesterday" and "next thursday".

Is there anything similar in Python or would I be better off simply
using os.system() to run date from the python program?

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list