#mailing-lists

1 messages · Page 3 of 1

naive kindleBOT
#

It would be nice to have a string method that checks for a float. Currently there is no support for this, either built-in or in the standard library. There is a thread, dating back to Dec 2020, that proposes a trivial implementation for str.isfloat . I was thinking of a method that did more.

Consider the following code. It returns True if the string is a proper float, False if it is an int and None otherwise.

def isfloat(s):
try:
int(s)
return False
except ValueError:
try:
float(s)
return True
except ValueError:
return None

This will be useful when we want to preserve the type of the number that is in string format. Anywhere a number is input as a string to a method and we want to later on output the original number, we can use the above. If, instead (as suggested in the other thread), the string is simply converted to a float, then the info that the string was an int is lost.

naive kindleBOT
#

ACTIVITY SUMMARY (2021-09-24 - 2021-10-01)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7341 ( +8)
closed 49734 (+50)
total 57075 (+58)

Open issues with patches: 2905

Issues opened (38)

#45288: Inspect - Added sort_result parameter on getmembers function.
https://bugs.python.org/issue45288 opened by Patitotective

#45289: test_dbm and test_dbm_ndbm segfaults in M1 Mac
https://bugs.python.org/issue45289 opened by pablogsal

#45292: Implement PEP 654: Exception Groups
https://bugs.python.org/issue45292 opened by iritkatriel

#45295: Speed up classmethod calls via LOAD_METHOD
https://bugs.python.org/issue45295 opened by kj

#45296: IDLE: Better document close and exit.
https://bugs.python.org/issue45296 opened by terry.reedy

#45297: Improve the IDLE shell save command
https://bugs.python.org/issue45297 opene... continue reading

naive kindleBOT
#

I was curious if / what sort of proposals have been considered for
simplifying the pattern:

def main():
    ...

if  __name__ == "__main__":
    main()

I imagine this topic must have come up before, so I'd be interested in any
relevant history.

But unless I'm missing something, it seems like adding some easier
alternative to this cumbersome entrypoint syntax would be worth considering.

My motivation for writing this suggestion is in an attempt to stop a common
anti-pattern, where instead of defining a main function (or a function by
any other name) an simply calling that by adding the above two lines, a lot
of Python users I work with will just start dumping their logic into the
global scope of the module.

Needless to say, this can have consequences. If there was some default
builtin, let's call it __main__ for now (open to suggestions), that took
a function as an argument and conditionally executed it if __name__ == "__main__" in the caller's scope, that would allow... continue reading

naive kindleBOT
#

Hi everyone,

ensurepip includes private copies of pip and setuptools. But PEP 453 states that "once pip is able to run pip install --upgrade pip without needing setuptools installed first, then the private copy of setuptools will be removed from ensurepip in subsequent CPython releases."
https://www.python.org/dev/peps/pep-0453/#automatic-installation-of-setuptools

At the moment pip itself includes a needed part of setuptools.
https://github.com/pypa/pip/tree/9c474d4862907ae220ced0fcdbd76660955ff732/src/pip/\_vendor/pkg\_resources

I experimented with modifying ensurepip in the main branch not to install setuptools, and then used it to install pip. It worked fine.
Then I run ./python -m pip install --upgrade pip, and it upgraded pip successfully.

Does this mean that we can drop the copy of setuptools?

Note, the venv module has such code CORE_VENV_DEPS = ('pip', 'setuptools'). I am not sure whether it requires setuptools from ensurepip.

Thanks,
Illia

naive kindleBOT
#

Hello,

This is a very simple feature request that does not break anything but
I don't know if you may find it interesting.
It would be nice to have a function or method of list objects that does this :

  • First idea :
    def enumerate_with_rest(my_list):
    for i, item in enumerate(my_list):
    yield i, item, my_list[:i] + my_list[i + 1:]

It could be called easily with:

for i, item, rest in enumerate_with_rest(my_list):

do something

or
for i, item, rest in my_list.enumerate_with_rest():

do something

I am not the only one who had the same need :
https://stackoverflow.com/questions/56966429/getting-pairs-of-one-item-and-the-rest-over-a-python-list

It would be nice to have an optimized C function for this.
However, it may be less interesting than this :

  • Second idea
    enumerate_with_rest above has quadratic complexity.
    It is probably true that most processes that use it will also have
    quadratic complexity.
    However, it would be better to return an iterator i... continue reading
#

Hello everybody,

I've got a suggestion for the std. re module developers: to consider allowing match group name redefinitions, especially in alternatives.
While you may not see the point at first glance, let me try to reason such a thing using a real-world example from my practice:

Imagine a company, using certain codes for their products/product components (unfortunately, I'm not at liberty to disclose the true
nature of them, but bare with me).
Let's say that they may have the following forms:
r"(?P<type>AB|C|D)- ?(?P<number>\d+)(?P<postfix>[A-Z])?"

So far so good. But now, imagine that a particular type of code has a bit different syntax:
r"(?P<type>E)- ?(?P<number>\d+)- ?"

As you can see, the prefix & postfix may be lowercase in case of code type E and moreover, a space or dash is required before the postfix.
If I merged the definitions, I'd have to allow that syntax even for the AB, C and D code types---but that... continue reading

naive kindleBOT
#

This half-baked idea is inspired by this thread here:

https://mail.python.org/archives/list/python-ideas@python.org/message/5LGWV3YLCNBVSL4QHQKJ7RPNTMWOALQA/

which in turn was inspired by this Stackoverflow post:

https://stackoverflow.com/questions/56966429/getting-pairs-of-one-item-and-the-rest-over-a-python-list

Problem: today, more and more people are using Python to work with Big
Data, or at least Biggish Data. For some folks, it is not unusual to
have lists with a gigabyte or more or data. So imagine you have a list
with a hundred million items, and you need a copy of the entire list.
Easy:

alist = [...]  # 100 million items
blist = alist[:]

And that ought to be pretty efficient too, making the slice is basically
just a copy of a bunch of pointers, plus a bit of overhead. A good
implementation should have lightning fast list slicing, close to the
speed of memcopy in C. Give or take.

But now suppose you want a copy of all the items except the item in
position... continue reading

naive kindleBOT
#

We wonder if people have a view on which of the following is clearer/better:

  1. except *E as e: // except *(E1, E2) as e:
  2. except* E as e: // except* (E1, E2) as e:

(The difference is in the whitespace around the *).

At the moment * is a separate token so both are allowed, but we could
change that (e.g., make except* a token), and in any case we need to settle
on a convention that we use in documentation, etc.

It is also not too late to opt for a completely different syntax if a
better one is suggested.

naive kindleBOT
#

We’re happy to release another batch of 35 cut videos of EuroPython 2021
covering most of the second day sessions of the conference. Together
with the first day videos, we now have 77 videos waiting for you. You
can watch them on our YouTube channel:

                 * EuroPython 2021 Playlist *

https://www.youtube.com/playlist?list=PL8uoeex94UhFuRtXhkqOrROsdNI6ejuiq

We’ll release the final batch of EuroPython 2021 videos next week. In
total, we will have more than 115 videos with lots of valuable and
interesting content for you, so please stop by and check the playlist
for more videos, or subscribe to our YouTube channel.

https://europython.tv/

BTW: Our YouTube channel has videos of all EuroPython conferences going
back to 2011. Check out more than 1500 Python videos covering 10
conference years.

Help spread the word

Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

... continue reading

naive kindleBOT
#

On behalf of the Python development community and the Python 3.10 release
team, I’m pleased to announce the availability of Python 3.10.0.
Python 3.10.0 is the newest major release of the Python programming
language, and it contains many new features and optimizations.

https://www.python.org/downloads/release/python-3100/

Major new features of the 3.10 series, compared to 3.9

Among the new major new features and changes so far:

naive kindleBOT
#

On behalf of the Python development community and the Python 3.10 release
team, I’m pleased to announce the availability of Python 3.10.0.
Python 3.10.0 is the newest major release of the Python programming
language, and it contains many new features and optimizations.

https://www.python.org/downloads/release/python-3100/

Major new features of the 3.10 series, compared to 3.9

Among the new major new features and changes so far:

  • PEP 623 -- Deprecate and
    prepare for the removal of the wstr member in PyUnicodeObject.
  • PEP 604 -- Allow writing
    union types as X | Y
  • PEP 612 -- Parameter
    Specification Variables
  • PEP 626 -- Precise line
    numbers for debugging and other tools.
  • PEP 618 -- Add Optional
    Length-Checking To zip.
  • [bpo-12782](... continue reading
naive kindleBOT
#

=======================
Announcing PyYAML-6.0b1

A new beta release of PyYAML is now available:
https://github.com/yaml/pyyaml/releases/tag/6.0b1

The previously-deprecated default loader selection in yaml.load() has
been removed; Loader is now a required argument.

Support for Python 2.7 and 3.5 has been dropped, and support for Python 3.10
added. It now includes libyaml 0.2.5 extension wheels for MacOS M1
(Apple Silicon/arm64), Linux s390x and Linux aarch64.

Numerous other bugfixes and code cleanups are included in this release.

Changes

naive kindleBOT
#

Have folks thought about allowing indexing dictionary views as in the
following code, where d is a dict object?

d.keys()[0]
d.keys()[-1]
d.values()[0]
d.values()[-1]
d.items()[0]
d.items()[-1] # item that would be returned by d.popitem()

I could see value to the last form in particular: you might want to inspect
the last item of a dictionary before possibly popping it.

I've also often wanted to get an arbitrary item/key from a dictionary, and
d.items()[0] seems natural for this. Of course, the universal way to get the
first item from an iterable x is

item = next(iter(x))

I can't say this is particularly readable, but it is functional and fast. Or
sometimes I use this pattern:

for item in x: break

If you wanted the last item of a dictionary d (the one to be returned from
d.popitem()), you could write this beautiful code:

last = next(iter(reversed(d.items())))

Given the dictionary order guarantee from Python 3.7, adding indexing
(__getitem__) to dict views seems n... continue reading

naive kindleBOT
#

Trying to compile python3.10 on openbsd 7.0 on Pi4. It seems to run into
several openssl issue. I have installed openssl as I couldn't find
libreSSL in the package manager.

The configure seems to passthe ssl test.

configure:17559: checking whether compiling and linking against OpenSSL
works
Trying link with OPENSSL_LDFLAGS=; OPENSSL_LIBS= -lssl -lcrypto;
OPENSSL_INCLUDES=
configure:17581: cc -pthread -o conftest conftest.c -lssl -lcrypto
-lpthread -lutil -lm >&5
configure:17581: $? = 0
configure:17583: result: yes

I get following errors:

don't know why this happens
ldd: /usr/lib/libreadline.a: not an ELF executable

Errors when building _ssl module

cc -pthread -fPIC -Wno-unused-result -Wsign-compare -Wunreachable-code
-DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result
-Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes
-Werror=implicit-function-declaration -fvisibility=hidden
-I./Include/internal -I./Include
-I/home/kabira/Dri... continue reading

naive kindleBOT
#

Hi everyone,

Now that 3.10.0 is finally released I wanted to take the time to thank you
all for all your fantastic
work this past year. Is because of the sum of all your fantastic work that
Python 3.10 is going to be
such a fantastic release. No matter if you have been working in fixing
bugs, adding features,
improving the documentation, reviewing contributor PRs, helping with the
infrastructure, helping with
the buildbot fleet, triaging bugs or discussing PEPs and features, your
work is tremendously appreciated:
you make a tremendous impact in Python and its community.

I also wanted to make sure to thank again all the people that helped with
the release itself and with the
numerous release blockers and also for your patience when I had to delay
your feature to 3.11 or your
bugfix to 3.10.1.

It has been a privilege to be able to release the result of your work to
the community!

Thank you all, your work really makes a difference.

Regards from sunny London,
Pablo Galindo Salgado

naive kindleBOT
#

sphinx-codeautolink makes documentation code examples clickable.
Links to reference documentation are inserted for the functions
and classes that the example uses. The key features are:

  • Minimal setup assuming examples are already valid Python
  • Backreference table: display all examples that use a definition
  • Optionally hide import statements or treat examples as concatenated code
  • Autodoc and intersphinx integrations

A live demo is available on our documentation:
https://sphinx-codeautolink.rtfd.io

sphinx-codeautolink uses the MIT licence, and version 0.3.0
was recently released. Please reach out on GitHub (felix-hilden)
or at felix.hilden@gmail.com if you have any questions or suggestions.
Thank you for reading and have a wonderful day!

<P><A HREF="https://sphinx-codeautolink.rtfd.io">
sphinx-codeautolink 0.3.0</A> - make your code examples clickable (06-Oct-21)

naive kindleBOT
#

Now that we are on a release spree, here you have the first alpha release of
Python 3.11: Python 3.11.0a1. Let the testing and validation games begin!

https://www.python.org/downloads/release/python-3110a1/

Major new features of the 3.11 series, compared with 3.10

Python 3.11 is still in development. This release, 3.11.0a1 is the first of
six planned alpha releases.

Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.

During the alpha phase, features may be added up until the start of the
beta phase (2022-05-06) and, if necessary, may be modified or deleted up
until the release candidate phase (2022-08-01). Please keep in mind that
this is a preview release and its use is not recommended for production
environments.

Many new features for Python 3.11 are still being planned and written.
Among the new major new features and changes so far:

naive kindleBOT
#

Now that we are on a release spree, here you have the first alpha release of
Python 3.11: Python 3.11.0a1. Let the testing and validation games begin!

https://www.python.org/downloads/release/python-3110a1/

Major new features of the 3.11 series, compared with 3.10

Python 3.11 is still in development. This release, 3.11.0a1 is the first of
six planned alpha releases.

Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.

During the alpha phase, features may be added up until the start of the
beta phase (2022-05-06) and, if necessary, may be modified or deleted up
until the release candidate phase (2022-08-01). Please keep in mind that
this is a preview release and its use is not recommended for production
environments.

Many new features for Python 3.11 are still being planned and written.
Among the new major new features and changes so far:

naive kindleBOT
#

We are excited to announce the new EuroPython Society Fellow Grant.

The grant is intended to honor and show gratitude towards members of the
EuroPython Society (EPS) and the EuroPython Workgroups who have
contributed significantly towards our mission, the EuroPython conference
and the Society as an organization.

EuroPython Fellows

EuroPython Fellows are eligible to a lifetime free attendance of the
EuroPython conference and will be listed on our EuroPython Society
Fellow Grant page.

https://www.europython-society.org/europython-society-fellow-grant/

The EuroPython Board will decide on new Fellowships based on nominations
by the EPS members and its own deliberations.

Our first Fellows

To launch the grant, the current board has decided to make all board
members since 2012 who have served at least two terms and are not
members of the current board EuroPython Fellows:

  • Alexander Hendorf
  • Alexandre Manhaes Savio
  • Anthon van der Neut
  • Bo... continue reading
naive kindleBOT
#

Hi,

I'm digging into the Python bug tracker history and I found links to
Subversion commits:
"Fixed in r77062 (trunk), r77063 (py3k)."
https://bugs.python.org/issue1811#msg96910

Roundup adds links which are redirected:

Problem: the svn.python.org links require me to log in with an
username and password, and I don't know how to log in. If I cancel the
prompt, it fails with: an HTTP Error 401 "Unauthorized".

Who manages this Subversion server? Would it be possible to remove
this authentication?

I know that the Misc/svnmap.txt file in Python contains a mapping from
Subversion to Mercurial commits, but Python now uses Git, so it's not
convenient. Maybe a new file mapping Subversion to Git commits should
be created? Or the https://hg.python.org/lookup/ service should
redirect to Mercurial com... continue reading

naive kindleBOT
#

I am happy to announce Guppy 3 3.1.2

Guppy 3 is a library and programming environment for Python,
currently providing in particular the Heapy subsystem, which supports
object and heap memory sizing, profiling and debugging. It also
includes a prototypical specification language, the Guppy
Specification Language (GSL), which can be used to formally specify
aspects of Python programs and generate tests and documentation from a
common source.

Guppy 3 is a fork of Guppy-PE, created by Sverker Nilsson for Python 2.

This release adds support for Python 3.10, thanks to smn-3-14.

License: MIT

The project homepage is on GitHub:

https://github.com/zhuyifei1999/guppy3

Enjoy,

YiFei Zhu

#

Hello,

I'm happy to announce that CPython project is participating in
hacktoberfest.
I have just added the hacktoberfest topic to CPython's GitHub Repo (
https://github.com/python/cpython).

Caveat: if we end up receiving too many spammy, invalid, and low-quality
PRs which just adds burden to maintainers, we will opt-out of this
immediately. I will be watching incoming PRs for the next week to determine
whether we should opt-out.

If you're participating in hacktoberfest, your contribution to the repo
will count.
Instead of receiving a t-shirt, you can also choose to have a tree planted
on your behalf, which I personally recommend.

If you're a core dev, you can also participate and get rewarded by
reviewing and merging pull requests. If you spot spammy PRs, please add
either the "spam" or "invalid" label.

Another way to participate is by donating to participating open source
projects. You can donate to CPython development through GitHub Sponsors (
https://github.com/sponsors/python)... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2021-10-01 - 2021-10-08)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7374 (+33)
closed 49772 (+38)
total 57146 (+71)

Open issues with patches: 2920

Issues opened (51)

#33125: Windows 10 ARM64 platform support
https://bugs.python.org/issue33125 reopened by steve.dower

#45163: Haiku build fix
https://bugs.python.org/issue45163 reopened by ned.deily

#45344: Have zipapp respect SOURCE_DATE_EPOCH
https://bugs.python.org/issue45344 opened by bign8

#45347: datetime subject to rounding?
https://bugs.python.org/issue45347 opened by piro

#45351: asyncio doc: List all sockets in TCP echo server using streams
https://bugs.python.org/issue45351 opened by olafvdspek

#45352: Move documentation for typed generic forms of standard collect
https://bugs.python.org/issue45352 opened by pxeger

#45353: sys... continue reading

naive kindleBOT
#

Hello Python community,

Earlier this year I put forward a proposal for decorators on variables
which I felt was well received in concept, but fell flat on the syntax. One
of the responses to that thread was rather than abusing the decorator, to
use a new symbol to get the target of an assignment statement as a string
on the right hand side. I would call this compile-time reflection of
assignment targets, or simply reflection. Although initially continuing on
with my original syntax, the idea of using such a token in my own code came
up on more than one occasion this year and I wanted to see what it might
really look like.

From that, this proposal is to add a new token to Python, currently spelled
<<<, which, at compile time, is replaced with the string representation of
the nearest assignment target, either assignment statement or assignment
expression. It does not bind with either keyword arguments or default
parameters. Neither does it work in any kind of non-assignment binding.
Wh... continue reading

naive kindleBOT
#

Right now, the following code is valid in Python 3.9 (and infinitely loops):

lst = [1, 2, 3]
for i in lst:
    lst.append(i)

IMO this is a source of bugs, and even though this behavior is technically documented (https://bugs.python.org/issue32767), I don't know if it should belong in the core language. For example, you cannot change the size of a set or dict during iteration; you will get a RuntimeError. Allegedly this is due to the underlying implementation of the dict/set iterators (https://bugs.python.org/issue22084) but I think it would be beneficial this was made part of the public API for list, set, and dict iterators.

Concretely, I'm proposing the following set of changes to Python:

  1. If the size of a list, set, or dict changes, invalidate all existing iterators to that containers. Document this behavior as part of the public API.
  2. Attempting to call next() on an invalidated iterator raises a RuntimeError.
  3. Add a key_iter function to itertools (name up for deba... continue reading
naive kindleBOT
#

Hello all,

I was thinking about the following idioms:

__version__ = "1.0"

import sys
if sys.version_info < (3, 6):
# Yell at the user

I feel like there could be a better way to define versions. There's no real
standard way to specify versions in Python, other than "use semantic
versioning." This can cause problems such as:

  • Uncertainty of the type of the version (commence the pattern matching! Or
    if... elif statements if that's your thing)
  • No real way to specify an alpha, beta, pre, or post version number in a
    tuple of ints, e.g. (2, 1, 0, "post0") doesn't really work.

I propose a new Version type, a standard way to define versions. The
signature would look something like Version(major: int, minor: int = 0, patch: Optional[int] = None, alpha: Optional[int] = None, beta: Optional[int] = None, pre: Optional[int] = None, post: Optional[int] = None).

To maintain backwards compatibility, comparisons such as Version(1, 2) == (1, 2) and Version(1, 2) == "1.2"... continue reading

naive kindleBOT
#

Over the past few weeks/months I have had on an off issues with the way python handles class-attributes. Consider the default way to do it:

class A:
    attr = 2
    """Docstring of the attribute"""

There are 2 main issues I have with this way of setting class-attributes:

  1. It does not allow to set class-attributes that depend on other class-attributes. (Example: setting a path that depends on cls.__name__)
  2. It does not allow to set lazily evaluated attributes. If setting the class-attribute involves an expensive computation, it will be done at class definition time.

One possible resolution is to use metaclasses, however this comes with its own issues:

  1. MetaClasses do not work nice with documentation. Attributes defined my metaclasses will neither show up in help(), dir(), nor will they be in the correct place when documenting the class with tools like sphinx.
  2. Who wants to write an additional metaclass whenever they want to write a class and hav... continue reading
naive kindleBOT
#

Hello everyone!

I need to pack a long list of numbers into shared memory, so I thought
about using struct.pack_into.

Its signature is

struct.pack\_into(format, buffer, offset, v1, v2, ...)

I have a long list of nums (several millions), ended up doing the following:

struct.pack\_into(f'{len(nums)}Q', buf, 0, *nums)

However, passing all nums as *args is very inefficient [0]. So I
started wondering why we don't have something like:

struct.pack\_into(format, buffer, offset, values=values)

which would receive the list of values directly.

Is that because my particular case is very uncommon? Or maybe we do
want this but we don't have it yet? Or do we already have a better way
of doing this?

Thanks!

[0] https://linkode.org/#95ZZtVCIVtBbx72dURK7a4

--
. Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org.ar/
Twitter: @facundobatista

naive kindleBOT
#

Consider sequences of bytecode operations on fast locals like the following:

def f(x):  # declare as parameter so that x is a fast local
...     x
...
dis(f)
  2           0 LOAD_FAST                0 (x)
              2 POP_TOP
              4 LOAD_CONST               0 (None)
              6 RETURN_VALUE

Given the following assumptions:

  • a LOAD_FAST cannot possibly have any side-effects outside the interpreter stack [1]

  • a POP_TOP immediately undoes LOAD_FAST's effects on the interpreter stack

I am wondering: why doesn't the peephole optimiser remove these opcode constructs?

Is it maybe because of PEP 626 - an introspection tool needs to know that the variable is being used there? Although surely in that case the peephole optimiser could just replace it with a single NOP? (c.f.: https://bugs.python.org/issue42719)

Or is one of my assumptions wrong?

[1]: global variables are probably supposed to have the same guarantee, but in practice t... continue reading

naive kindleBOT
#

For StreamRequetHandler's rfile attribute, it will block when the read readline readlines reach the end.

It would be nice to add non-blocking read because the seek() is unavailable for rfile. and there is no other way to detect if it is ended.

When the stream is empty and waiting for new input, then it will return None type. This would be a nice feature.

naive kindleBOT
#

So ord is already a really fast function with (last check before this thread was posted) 166 nsec per loop. But I'm wondering... doing ord(a) produces this bytecode:

2 4 LOAD_NAME 1 (ord)
6 LOAD_NAME 0 (a)
8 CALL_FUNCTION 1
10 POP_TOP
12 LOAD_CONST 1 (None)
14 RETURN_VALUE
But doing +a only produces this:
2 4 LOAD_NAME 0 (a)
6 UNARY_POSITIVE
8 POP_TOP
10 LOAD_CONST 1 (None)
12 RETURN_VALUE
So an operator has its own bytecode, doesn't need to LOAD_* a function, and doesn't have the impact on performance when converting arguments to the format of the (after POP()ing every argument) TOS function and then calling that function. And also, the unary + of strings only copies strings, which should be redundant in most cases. Maybe `ord... continue reading

naive kindleBOT
#

I’m happy to announce the release of structlog 21.2.0!

With almost a million downloads per month, structlog is the most popular solution for structured logging in Python. It doesn’t just allow you to log key-value pairs in a structured manner, it also makes it EASIER and FASTER. Check out https://www.structlog.org/en/stable/why.html if you’re intrigued but not convinced!

Heartfelt thanks go to my generous GitHub sponsors https://github.com/sponsors/hynek, companies subscribing on Tidelift https://tidelift.com/subscription/pkg/pypi-structlog (currently nobody :( – tell your boss!), and people who bought me a coffee on https://ko-fi.com/the\_hynek!

Support like that makes me work on FOSS on a Saturday afternoon, so please consider supporting me https://hynek.me/say-thanks/ too! <3

RELEASE HIGHLIGHTS:

• Support for for beautiful (and helpful!) exceptions by integrating ConsoleRenderer with rich or better-exceptions.
• Helpers to access thread-local and context-local context... continue reading

naive kindleBOT
#

We’re happy to release another batch of 41 cut videos of EuroPython 2021
covering the third day sessions of the conference and a number of edited
videos for the previous days. In total, we now have 118 videos waiting
for you. You can watch them on our YouTube channel. We have created a
EuroPython 2021 playlist for this.

                 * EuroPython 2021 Playlist *

https://www.youtube.com/playlist?list=PL8uoeex94UhFuRtXhkqOrROsdNI6ejuiq

All EuroPython Videos

Our YouTube channel has videos of all EuroPython conferences going back
to 2011. Check out more than 1500 Python videos covering 10 conference
years.

EuroPython YouTube Channel:
https://europython.tv/

All 1500+ videos:
https://www.youtube.com/playlist?list=UU98CzaYuFNAA\_gOINFB0e4Q

Help spread the word

Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://blog.europython.eu/europyth... continue reading

naive kindleBOT
#

I posted a previous thread about overloading the unary + operator in strings with ord, and that expanded to more than just the unary + operator. So I'm saying now, there should be these implementations:

+string - int(string, 10) (or just int(string))
-string - int(string, 8)
~string - int(string, 16)

Or:

+string - string.lstrip()
-string - string.rstrip()
~string - string.strip()

If anyone has better ideas, they can post it here.

naive kindleBOT
#

Hello,

It used to be that defining __int__ allowed an object to be accepted as
an integer from various functions, internal and third-party, thanks to
being implicitly called by e.g. PyLong_AsLong.

Today, and since bpo-37999, this is no longer the case. It seems that
__int__ has now become a strict equivalent to __trunc__. Of course,
user code can still look up and call the __int__ method explicitly (or
look up the nb_int slot, in C), but that's a bit of anti-pattern.

Is there a point in having three special methods __index__, __int__ and
__trunc__, if two are them are practically interchangeable?

Regards

Antoine.

naive kindleBOT
#

Hi there, I have a reminder for you if you are:

  • a core developer; or
  • on the triage team; or
  • a mentee in core-mentorship.

We are running an online core sprint next week (October 18 - 24). "Online" means on our internal Core Python Discord. Join us there to plan and chat! You can even get a meal stipend from the PSF for the duration of the sprint! If you need a Discord invite, write to me directly and I'll sort you out 😎

What if you'd like to participate but you're not a core dev, triager, nor mentee? Well, this is a closed event to let our team coordinate in real time. We'd do this one in person if that was possible. In fact, this is how we have done it between 2016 and 2019. The goals don't change though: to have a small event separate from major conferences and free from distractions so we can focus on discussing key changes and making larger code changes. Instead, come to the sprints at PyCon US! And in the mean time, I suggest you pick up bugs on bugs.python.org <http://bugs... continue reading

naive kindleBOT
#

=====================
Announcing PyYAML-6.0

A new release of PyYAML is now available:
https://github.com/yaml/pyyaml/releases/tag/6.0

The previously-deprecated default loader selection in yaml.load() has
been removed; Loader is now a required argument.

Support for Python 2.7 and 3.5 has been dropped, and support for Python 3.10
added. It now includes libyaml 0.2.5 extension wheels for MacOS M1
(Apple Silicon/arm64), Linux s390x and Linux aarch64.

Numerous other bugfixes and code cleanups are included in this release.

Changes

naive kindleBOT
#

Hello,

Today I found myself write a function that returns a tuple of list of list of strings (tuple[list[list[str]], list[list[str]]]). Wouldn’t it easier to read to write it like the following:
([[str]], [[str]])?
Similarly for TypedDict, replace the following..
class Movie(TypedDict):
name: str
year: int
with
{‘name’: str, ‘year’: int}
dict[str, int] will be {str: int}
set[int] will be {int}.
This is similar to the new proposed Callable alternative (i.e., (int, float) -> float) since it mimics the structure of a function.

Also, Annotated[float, “seconds”] can be replaced with something like float #seconds indicating whatever comes after the hashtag is just extra information similar to a normal comment in the code.
Imagine you could replace the following
def func(d: dict[Annotated[str, “product label”], Annotated[list[float], “prices from 2000 to 2015”]])…
With
def func(d: {str # product label: [float] # prices from 2000 to 2015})…
Abdulla
Sent from my iPhone

naive kindleBOT
#

Hello,

I've been following PEP 505 (https://www.python.org/dev/peps/pep-0505/) since it was first proposed for Python 3.8. It's been deferred for some time and I'm interested in seeing it in Python 3.11, but I know there were also a number of objections which resulted in it being deferred (including by one of the original authors, Mr. Dower). I did email both Mr. Dower and Mr. Haase and they graciously gave me their permission to bring it up on this list for discussion and hopefully final pronouncement one way or the other.

I personally believe that the PEP will result in a significant reduction in boilerplate code, and it is substantially similar to the same operators now found in a number of other languages, especially C# and JavaScript (https://wikipedia.org/wiki/Null\_coalescing\_operator and https://wikipedia.org/wiki/Safe\_navigation\_operator).

I believe strong and valid arguments can be made about the use of None being a fundamental flaw in some types of coding (and that add... continue reading

naive kindleBOT
#

PEP 479 introduced this idea that basically boils down to raising your
exceptions only when you mean it.

Specifically: generators only raise StopIteration when they
return/exit/terminate. And they prevent the user from raising it under
other circumstances.

Can we call this "antichecked exceptions"? Generators specifically check
for StopIteration raised in undesired circumstances, and make sure they get
wrapped. This is a form of runtime checking, so the "checked" part of the
name makes sense. But this is unlike "checked exceptions", like those in
java, that mostly just encourage uhh silently ignoring the exception? (And
those are statically checked anyway...) So the prefix "anti"
distinguishes it from that.

Obviously this name is meant to be more broad than just the implementation
of generators. (We made a pypi package that tries to expand on the
concept.) But, thoughts? Naming things is powerful.

(Is this the wrong list for this? Uhh like it's a name idea for a thing in
python? ... continue reading

naive kindleBOT
#

Hello,
I heard not everyone is Discourse, so I'm re-posting here as well.

Information about <topic> is current scattered over the FAQs, active
PEPs (387, 602), an active-but-severely-outdated PEP (6) and the Devguide.

I would like to consolidate as much of this as possible into user-facing
reference documentation.

  • Does that sound like a good idea?
  • Where in the docs should such a page live?

Here is a draft of the docs; if added they’d be accompanied by more changes:

  • The relevant FAQs would be replaced by links to these docs
  • PEP 6 would be retired in favor of 602, 387 and these docs
  • Parts of PEP 387/602 might be replaced by links here (or this document
    should link to the PEP rather than duplicating it)
  • The examples of “backwards-incompatible APIs” from PEP 387 would only
    live in one place, and be linked from the other.
  • C-API stability docs should link back to this more general document.
    (Details specific to the C-API shoudl still be there.... continue reading
naive kindleBOT
#

Hi all,

disclaimer: I have no idea on potential syntax or if it is applicable to
a wide audience or if there is already a good solution to this. It is
more like a "gap" in the type hint spec that I ran across in a project.

In function/method signatures, I can hint at dictionaries for example as
follows:

from numbers import Number
from typing import Dict

from typeguard import typechecked

Data = Dict[str, Number]

@typechecked
def foo(bar: Data):
    print(bar)

Yes, this is using run-time checks (typeguard), which works just fine.
Only strings as keys and Number objects as values are going through. (I
was told that MyPy does not get this at the moment.)

The issue is that bar itself still allows "everything" to go in (and out):

@typechecked
def foo2(bar: Data):
    bar[1.0] = b'should not be allowed'

PEP 589 introduces typed dictionaries, but for a fixed set of predefined
keys (similar to struct-like constructs in other languages). In
contrast, I am ... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2021-10-08 - 2021-10-15)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7401 (+27)
closed 49822 (+50)
total 57223 (+77)

Open issues with patches: 2925

Issues opened (50)

#35081: Move internal headers to Include/internal/
https://bugs.python.org/issue35081 reopened by vstinner

#35134: Add a new Include/cpython/ subdirectory for the "CPython API"
https://bugs.python.org/issue35134 reopened by vstinner

#42248: Raised exception in Enum keeping user objects alive unnecessar
https://bugs.python.org/issue42248 reopened by pitrou

#44559: Enum: revert to 3.9
https://bugs.python.org/issue44559 reopened by pitrou

#45249: Update doctect SyntaxErrors for location range
https://bugs.python.org/issue45249 reopened by pablogsal

#45414: pathlib.Path.parents negative indexing is wrong for absolute p
https://... continue reading

naive kindleBOT
#

Leo http://leoeditor.com 6.5b1 is now available on GitHub.

Leo is an IDE, outliner and PIM.

The highlights of Leo 6.5

  • Add python-to-typescript and view-recent-commands.
  • Add c.findCommands.interactive_search_helper.
  • Leo now uses only traditional unit tests.
    Remove support for @test and @suite. Remove leoTest.py.
  • Many code-level cleanups.
  • 450+ pull requests.

6.5 Links

naive kindleBOT
#

Extended unpacking notation (* and **) from PEP 448 gives us great ways to
concatenate a few iterables or dicts:

(*it1, *it2, *it3)  # tuple with the concatenation of three iterables
[*it1, *it2, *it3]  # list with the concatenation of three iterables
{*it1, *it2, *it3}  # set with the union of three iterables
{**dict1, **dict2, **dict3}  # dict with the combination of three dicts
# roughly equivalent to dict1 | dict2 | dict3 thanks to PEP 584

I propose (not for the first time) that similarly concatenating an unknown
number of iterables or dicts should be possible via comprehensions:

(*it for it in its)  # tuple with the concatenation of iterables in 'its'
[*it for it in its]  # list with the concatenation of iterables in 'its'
{*it for it in its}  # set with the union of iterables in 'its'
{**d for d in dicts} # dict with the combination of dicts in 'dicts'

The above is my attempt to argue that the proposed notation is natural:
[*it for it in its] is exactly an... continue reading

naive kindleBOT
#

I'm sending this to python-list because my emails to python-dev keep
getting bounced back (after a few days delay).  I've no idea why.

Instead of except group ..., what about except for ...?

No new keywords.
Reads naturally in English.
Hints that there is more than one kind of exception coming.

Best wishes
Rob Cliffe

naive kindleBOT
#

PyScripter is a free and open-source Python Integrated Development Environment (IDE) created with the ambition to become competitive in functionality with commercial Windows-based IDEs available for other languages. It is feature-rich, but also light-weight.

New Features

  • Implementation of the Language Server Protocol
  • Python language support provided by the Jedi language server
  • Two new styles added Windows11_Light and Windows11_Dark
  • Copy and paste code as html to Powerpoint and other applications
  • Removed support for python 3.3-3.5
  • Read only indicator on tabs
  • Added traditional Chinese translation
    Issues addressed
  • #939, #951, #1116, #1118, #1119, #1122, #1123, #1125, #1129, #1133
  • #1136

See:
Announcement: https://pyscripter.blogspot.com/
Project home: https://github.com/pyscripter/pyscripter/
Features: https://github.com/pyscripter/pyscripter/wiki/Features
Downloads: https://sourceforge.net/projects/pyscripter/files

naive kindleBOT
#

I don't know if this has been suggested before, or if this is outlandishly impossible (though I would be surprised if it was), so apologies in advance if so.

I have on occasion come across a situation where I use/write a signature like this:

def insert\_x\_into\_y(x, y):
    ...

or worse

def insert\_into(item, container):
    ...

where, despite a driving idea of python syntax being readability in english, the function signature is distinctly not english.
"I'll just go and insert into this item that container", is not only never said but is actually ambiguous in english.

What would be really cool, is if python let you write function signatures like this:

def insert\_(item)\_into\_(container):
    ...

where the arguments dispersed between the function name are positional only argument, and any key word arguments would have to go at the end.
It would create a function that could be called as:

insert\_(1)\_into\_(my\_list)

or

insert\_\_int... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/YMFRX6K22TZNNAP2PPVV7RGNI5HLC764/)
naive kindleBOT
#

I am having compilation issues again with python3.10 with ssl .

The ./configure was invoked with ssl options and ssl modules seems to
be build successfully.

"""
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc _hashlib _ssl
pwd time
"""

However, when I do import ssl from python, I get the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/shared/Builds/Python-3.10.0/lib/python3.10/ssl.py", line
98, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'

I can't find _ssl.so in build or install directory.

Thanks
-S

naive kindleBOT
#

In the context of building Docker images, it is often required to download
stuff. If curl/wget is available, great, but often slim images don't
include that. The urllib could provide a very simple download functionality
(like http offers a simple server):

from urllib.request import urlopen
data = urlopen('https://.../install-poetry.py').read()
# print or save data

naive kindleBOT
naive kindleBOT
#

Hi,

Erlend and me wrote a PEP to move away from macros in the Python C
API. We are now waiting for feedback :-) Read the PEP online:
https://www.python.org/dev/peps/pep-0670/

There is a copy of the PEP below for inline replies.

Victor


PEP: 670
Title: Convert macros to functions in the Python C API
Author: Erlend Egeberg Aasland erlend.aasland@protonmail.com,
Victor Stinner vstinner@python.org
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 19-Oct-2021
Python-Version: 3.11

Abstract

Convert macros to static inline functions or regular functions.

Remove the return value of macros having a return value, whereas they
should not, to aid detecting bugs in C extensions when the C API is
misused.

Some function arguments are still cast to PyObject* to prevent
emitting new compiler warnings.

Rationale

The use of macros may have unintended adverse effects that are hard to
avoid, even for experienced C developers. Some issues... continue reading

naive kindleBOT
#

(For visibility, posted both to python-dev and Discourse.)

Over the last couple of months, ever since delaying PEP 563’s default
change in 3.10
https://mail.python.org/archives/list/python-dev@python.org/message/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/,
the Steering Council has been discussing and deliberating over PEP 563
(Postponed Evaluation of Annotations)
https://www.python.org/dev/peps/pep-0563/, PEP 649 (Deferred Evaluation
Of Annotations Using Descriptors)
https://www.python.org/dev/peps/pep-0649/, and type annotations in
general. We haven’t made a decision yet, but we want to give everyone an
update on where we’re at, what we’re thinking and why, see if there’s
consensus on any of this, and perhaps restart the discussion around the
options.

First off, as Barry already mentioned in a different thread
https://mail.python.org/archives/list/python-dev@python.org/message/4TY3MVJQOLKSTMCJRTGAZEOSIIMAWQ45/,
the SC does not want to see type annotations as separate from the Python
l... continue reading

naive kindleBOT
#

Hi All,

On behalf of the NumPy team I am pleased to announce the release of NumPy
1.21.3. NumPy 1.21.3 is a maintenance release that fixes a few bugs
discovered after the 1.21.2 release. It also provides 64 bit Python 3.10.0
wheels. Note a few oddities about the Python 3.10 wheels:

  • There are no 32 bit wheels for Windows, Mac, or Linux.
  • The Mac Intel builds are only available in universal2 wheels.

The Python versions supported in this release are 3.7-3.10. If you want to
compile your own version using gcc-11 you will need to use gcc-11.2+ to
avoid problems. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.21.3/; source archives, release notes,
and wheel hashes are available on Github
https://github.com/numpy/numpy/releases/tag/v1.21.3. Linux users will
need pip >= 0.19.3 in order to install manylinux2010 and manylinux2014
wheels. A recent version of pip is needed to install the universal2
macos wheels.

Contributors

A total of... continue reading

naive kindleBOT
#

Hi,

Draft PEP attached:

Proposal:

def is_between(n1,n2,n3):
fn"is number {n1} between {n2} and {n3}"
fn"{n2}<{n1}<{n3}?"

the token "fn" immediately following the def statement, speficy the

descriptive text

multipe "fn" specifiers describes multiple ways the funtion can be invoked

the "fn" statement is at the same indentation level as the def statement

return (n1 > n2 and n1 < n3)

.
.
.

if "fn" statements are found indented and not immediately following

def statement, indicate function invocation.

function can be invoked using descriptive text pecified in "fn" statement.

if fn"is number {value} between {valid} and {low_threshold}":
print("underflow")
if is_between(value,low_threshold,high_threshold):
print("in range")
if fn"{low_threshold}>{value}>{high_threshold} ?"
print("overflow")

.
.

Please comment
Thanks
Shash

naive kindleBOT
#

Last year I opened the following issues, to implement
int PyObject_CopyToObject() and PyObject *PyObject_GetMemoryView(PyObject
*obj).

They were meant to be as part of PEP 3118, I wonder if they are worth an
effort now.

https://bugs.python.org/issue39835
https://bugs.python.org/issue39836

Joannah

--
Best,
Joannah Nanjekye

"You think you know when you learn, are more sure when you can write, even
more when you can teach, but certain when you can program." Alan J. Perlis

naive kindleBOT
naive kindleBOT
#

Wing 8.1 adds Delete Symbol and Rename Current Module refactoring
operations, improves some aspects of type analysis, fixes occasional
failure to detect Python Path, fixes starting the remote agent in some
cases, corrects exception reports from Django templates, supports pip
21.3+ in the Packages tool, and makes several other improvements.

Details: https://wingware.com/news/2021-10-19
Downloads: https://wingware.com/downloads

== About Wing ==

Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing's deep code analysis provides
auto-completion, auto-editing, and refactoring that speed up
development. Its top notch debugger works with any Python code, locally
or on a remote host, container, or cluster. Wing also supports
test-driven development, version control, UI color and layout
customization, and includes extensive documentation and support.
... continue reading

naive kindleBOT
naive kindleBOT
#

I’ve just published the August steering council update, also included below:

https://github.com/python/steering-council/blob/main/updates/2021-08-steering-council-update.md

Just as a reminder, if you have any questions or concerns, feel free to
contact us or open an issue in the SC repo:
https://github.com/python/steering-council

August 2

  • The Steering Council met with the Developer-in-Residence (Łukasz Langa)
    to discuss progress. The group also discussed what the focus should be
    going forward and that strategic approaches need to be considered for PRs
    instead of individual reviews.
  • The Steering Council and Ewa (current PSF Executive Director) discussed
    the lack of progress on the GitHub migration project. The contractor will
    be meeting with the SC and Ewa next week to discuss progress and a timeline
    to wrap up the project by end of October 2021.
  • Thomas has several todos that he will take care of this week and he will
    also reach out to the [PEP 505](
    https://www.python.org/d... continue reading
naive kindleBOT
#

Leo http://leoeditor.com 6.5 is now available on GitHub.

Leo is an IDE, outliner and PIM.

The highlights of Leo 6.5

  • Add python-to-typescript and view-recent-commands.
  • Add c.findCommands.interactive_search_helper.
  • Leo now uses only traditional unit tests.
    Remove support for @test and @suite.
    Remove leoTest.py.
  • Many code-level cleanups.
  • 450+ pull requests.

6.5 Links

**... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2021-10-15 - 2021-10-22)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7199 (-202)
closed 50111 (+289)
total 57310 (+87)

Open issues with patches: 2841

Issues opened (65)

#19459: Python does not support the GEORGIAN-PS charset
https://bugs.python.org/issue19459 reopened by vstinner

#40051: Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*
https://bugs.python.org/issue40051 reopened by zach.ware

#43656: TracebackException or StackSummary.extract with capture_locals
https://bugs.python.org/issue43656 reopened by andrei.avk

#45434: [C API] Clean-up the Python.h header file
https://bugs.python.org/issue45434 reopened by vstinner

#45445: Fail if an invalid -X option is provided
https://bugs.python.org/issue45445 reopened by pablogsal

#45474: [C API] marshal.h must not use FILE* ty... continue reading

naive kindleBOT
naive kindleBOT
#

Spun off from PEP 505 thread on python-dev.

One of the weaker use-cases for None-coalescing is function default
arguments, where the technical default is None but the function wants
to use some other value instead. This is a weak argument in favour of
None-coalescing because only a small set of such situations are only
slightly improved by a "??" operator, and the problem is far larger.
Consider the bisect.bisect() function [1]:

def bisect(a, x, lo=0, hi=None):
if lo < 0:
raise ValueError('lo must be non-negative')
if hi is None:
hi = len(a)

It's clear what value lo gets if you omit it. It's less clear what hi
gets. And the situation only gets uglier if None is a valid argument,
and a unique sentinel is needed; this standard idiom makes help()
rather unhelpful:

_missing = object()
def spaminate(thing, count=_missing):
if count is _missing: count = thing.getdefault()

Proposal: Proper syntax and support for late-bound argument defaults.

def spaminate(... continue reading

naive kindleBOT
#

Hello people,
I was thinking of a "def" statement in Python.
Its really weird that it can define only method, since it means "define".

It shouldn't be hard to detect if this is a variable or a method, because method needs "()" to have arguments(even if there are zero of them),
and defining variable value supposed to have "=" as the definition mark.

Hope it would be added someday

naive kindleBOT
#

Incorporates comments from the thread we just had.

Is anyone interested in coauthoring this with me? Anyone who has
strong interest in seeing this happen - whether you've been around the
Python lists for years, or you're new and interested in getting
involved for the first time, or anywhere in between!

https://www.python.org/dev/peps/pep-0671/

PEP: 671
Title: Syntax for late-bound function argument defaults
Author: Chris Angelico rosuav@gmail.com
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 24-Oct-2021
Python-Version: 3.11
Post-History: 24-Oct-2021

Abstract

Function parameters can have default values which are calculated during
function definition and saved. This proposal introduces a new form of
argument default, defined by an expression to be evaluated at function
call time.

Motivation

Optional function arguments, if omitted, often have some sort of logical
default value. When this value depends on other arguments, or needs to b... continue reading

naive kindleBOT
#

Function parameters can have default values which are calculated during
function definition and saved. This proposal introduces a new form of
argument default, defined by an expression to be evaluated at function
call time.

naive kindleBOT
naive kindleBOT
#

I DO expect this thread to be bombarded with negative replies.

Currently, there are in/not in operators which work like this in Python:

def contains(contains_value, iterable, not_in):
for element in iterable:
if element == contains_value:
return True ^ not_in
return False ^ not_in
If I wanted to check if an exact object is in an iterable, I would have to loop like this (reverse boolean values for implementation of not is in):
is_in = False
for element in iterable:
if element is contains_value:
is_in = True
I would want a more convenient way to check for this value. So therefore, there should be is in/not is in operators to do it better. Is this a valid reason?

naive kindleBOT
naive kindleBOT
#

Due to https://www.python.org/dev/peps/pep-0554/ multi-interpreters
implementation going really slow, I had the audicity to try an alternative route
towards the same objective of implementing multicore support of python:
instead of sharing the memory by running multiple threads, I employed
an interprocess shared memory with multiple processes.

I know there are multiprocessing.sharedctypes and multiprocessing.shared_memory,
but I went much deeper into it by solving two problems they failed to solve:
sharing of complex dynamic objects and synchronization of data access.

I have a working prototype to show: https://github.com/byko3y/python-shared-objects
It's a kind of software transactional memory within shared memory. It has a basic support
for fundamental python types (bool, int, str, bytes, tuple, list, dict, object),
for both atomic and non-atomic transactions via fine-grained RW-locks, has a built-in
protection against deadlock and starvation.

Most of my code can also be used for... continue reading

#

I've been thinking for a while that it would be good to be able to use context managers in an expression context, and I haven't been able to come up with any arguments against it (although it may not be to everyone's taste) and I can't see any sign that it's come up before (although the words of it don't make very specific search terms).
My suggestion is that a "with" clause could be written after an expression (consistent with the conditional operator being written with "if" after the first expression).

In general, this would be:
a(b) with c(d) as b
or it could allow multiple context managers:
a(b, c) with d(e) as b, f(g) as c

My original motivating example was this:

if name.startswith("https://"):
data = requests.get(name).json()
else:
with open(name) as stream:
data = json.load(stream)

which I'd much rather be able to write with a single expression:

data = (requests.get(name).json()
if name.startswith("https://")
else (json.load(stream)
... continue reading

naive kindleBOT
#

oxidized_importer - a pure Rust Python extension module implementing high
performance Python module importers - version 0.3 has been released.

The documentation is available at
https://pyoxidizer.readthedocs.io/en/oxidized-importer-0.3/oxidized\_importer.html
.

Like previous versions of this extension module, version 0.3 supports
importing Python modules and resources from memory or from memory mapped
files using the OxidizedFinder class. This is the special importer that
enables PyOxidizer to generate single file Python applications without
relying on run-time extraction of Python modules to a filesystem.

New in version 0.3 is the OxidizedZipFinder (
https://pyoxidizer.readthedocs.io/en/oxidized-importer-0.3/oxidized\_importer\_zip\_finder.html)
class, which aims to be a drop-in replacement for zipimport.zipimporter.
While not quite reaching that goal, this zip file importer is already
considerably faster than the one in the Python standard library and can
often ... continue reading

naive kindleBOT
#

Currently, ipaddress._BaseNetwork (and by extension, ipaddress.IPv4Network and ipaddress.IPv6Network) does not have a __len__ method, it only has num_addresses.

This makes the following code not work:

random.choice(ipaddress.ip_network('6.0.0.0/8'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/nyuszika7h/.pyenv/versions/3.10.0/lib/python3.10/random.py", line 378, in choice
return seq[self._randbelow(len(seq))]
TypeError: object of type 'IPv4Network' has no len()

The workaround is a bit ugly:

(network := ipaddress.ip_network('6.0.0.0/8'))[random.randrange(network.num_addresses)]
IPv4Address('6.60.184.142')

With a custom subclass, all works well:

class MyIPv4Network(ipaddress.IPv4Network):
... def __len__(self):
... return self.num_addresses
...
random.choice(MyIPv4Network('6.0.0.0/8'))
IPv4Address('6.40.110.63')

naive kindleBOT
#

On Tue, 26 Oct 2021, Eric V. Smith wrote:

You may or may not recall that a big reason for the removal of "tuple
parameter unpacking" in PEP 3113 was that they couldn't be supported by the
inspect module. Quoting that PEP: "Python has very powerful introspection
capabilities. These extend to function signatures. There are no hidden
details as to what a function's call signature is."

(Aside: I loved tuple parameter unpacking, and used it all the time! I was
sad to see them go, but I agreed with PEP 3113.)

Having recently heard a friend say "the removal of tuple parameter unpacking
was one thing that Python 3 got wrong", I read this and PEP 3113 with
interest.

It seems like another approach would be to treat tuple-unpacking parameters as
positional-only, now that this is a thing, or perhaps require that they are
explicitly positional-only via in PEP 570:

def move((x, y), /): ... # could be valid?
def move((x, y)): ... # could remain invalid?

Is it worth ... continue reading

naive kindleBOT
#

As part of messing with the parser for PEP 671, I've come across what
looks like a convention, but I'm not sure of the details.

Most AST nodes start with a capital letter: Expr, Name, BoolOp, etc.
Some don't: keyword, arg, withitem.

Is it true that the ones that don't start with a capital are the more
"internal" ones, like how a With statement has a collection of
withitems, but you'd never see a withitem on its own?

Specifically: I'm creating a new type of AST node for an argument
default (either an early-evaluated default value, or a late-evaluated
default expression); should that be Default or default? If my
interpretation is correct, it should be "default".

Thanks to everyone who worked on the PEG parser, by the way. It's a
vast improvement over the old one.

ChrisA

naive kindleBOT
#

https://github.com/Rosuav/cpython/tree/pep-671

So uhh... anyone who knows about the internals of CPython and wants to
join me on this, I would really appreciate coauthors!

The implementation ended up a lot more invasive than I originally
planned. Some of that is inherent to the problem, but other parts
might be able to be done more cleanly. The way I've done it:

  • Argument defaults (either in __defaults__ or __kwdefaults__) are now
    tuples of (desc, value) or (desc,) for early-bound and late-bound
    respectively
  • Early-bound defaults get mapped as normal. Late-bound defaults are
    left unbound at time of function call.
  • For each late-bound default as of the 'def' statement, a check is
    coded: if the local is unbound, set it based on the given expression.

This means that it's possible to replace an early-bound default with a
late-bound, but instead of actually evaluating the expression, it just
leaves it unbound:

def f(x=1): print(x)
...
f.__defaults__
((None, 1),... continue reading

naive kindleBOT
#

Hi,
When you call extractfile() on a TarFile, the result is a buffered version of a _FileInFile pseudo-file.
When fileno() is called on this resulting file, fileno() it not exist (understandably) and an AttributeError is raised.
I would like to suggest raising an io.UnsupportedOperation instead, so that file would act more like other file-like objects.

naive kindleBOT
#

I was using Python 3.10 and got this NameError when I mistyped a name:

NameError: name 'KeyboardInterrupted' is not defined. Did you mean: 'KeyboardInterrupt'?

It even works for attribute errors too.

That's fantastic! This is a really amazing useability improvement, thank
you everyone who was involved! I literally squeed :-)

I just may spend a few days deliberately mistyping names in the REPL
just to see this :-)

--
Steve

naive kindleBOT
#

ACTIVITY SUMMARY (2021-10-22 - 2021-10-29)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7249 (+50)
closed 50157 (+46)
total 57406 (+96)

Open issues with patches: 2868

Issues opened (77)

#45235: argparse does not preserve namespace with subparser defaults
https://bugs.python.org/issue45235 reopened by paul.j3

#45396: Custom frozen modules get ignored.
https://bugs.python.org/issue45396 reopened by eric.snow

#45563: inspect.getframeinfo() doesn't handle frames without lineno
https://bugs.python.org/issue45563 reopened by lemburg

#45578: Missing tests for the dis module
https://bugs.python.org/issue45578 opened by nanjekyejoannah

#45580: argparse.ArgumentParser.add_mutually_exclusive_group : metavar
https://bugs.python.org/issue45580 opened by AbcSxyZ

#45581: [sqlite3] raise MemoryError if sqlite3_open_v2... continue reading

naive kindleBOT
#

Hi

One of the motives for PEP 671 is that the signature of a function fn, and
hence the associated help(fn) is sometimes opaque regarding default values.
I won't repeat the excellent examples already given.

In the current implementation default values are handled outside the
compiled code of the function, which is available at fn.__code__. Instead
they are stored in 'metadata' associated with the function.

Here's one way to see this.

from inspect import signature as sig
def fn(a, b=1, c=2): return a, b, c
sig(fn) # Gives <Signature (a, b=1, c=2)>
fn.\_\_defaults\_\_ = ('hi', 'there')
sig(fn) # Gives <Signature (a, b='hi', c='there')>

We can also change the __code__ object, but care is needed here.

def gn(): return (1, 2, 3)
fn.\_\_code\_\_ = gn.\_\_code\_\_
fn() # Gives (1, 2, 3).
sig(fn) # Gives <Signature ()>
fn.\_\_defaults\_\_  # Gives ('hi', 'there')

The signature of fn, together with the arguments actually supplied, is used
t... continue reading

naive kindleBOT
#

Dear Python developers,

The help(list) shows in a python console the following documentation
string for the list.sort() method.

sort(self, /, *, key=None, reverse=False)
 |      Sort the list in ascending order and return None.
 |
 |      The sort is in-place (i.e. the list itself is modified) and
stable (i.e. the
 |      order of two equal elements is maintained).

Please notice the following inconsistency in Python3.10.0 and before of
a sort(reverse=True) result:

L = [(1, 'a'), (2, 'b'), (1, 'c'), (2, 'd'), (3, 'e')]
L.sort(reverse=True)
L
[(3, 'e'), (2, 'd'), (2, 'b'), (1, 'c'), (1, 'a')]

it should be:

L = [(1, 'a'), (2, 'b'), (1, 'c'), (2, 'd'), (3, 'e')]
reverseTuplesSort(L)
[(3, 'e'), (2, 'b'), (2, 'd'), (1, 'a'), (1, 'c')]

Same inconsistency appears when using a sorting key.

Passing easily unnoticed may produce unexpected and potentially wrong
ranking results.

Best Regards,
RB

--

50, Bvd... continue reading

naive kindleBOT
#

aenum --- support for advanced enumerations, namedtuples, and constants

Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples,
and NamedConstants

aenum includes a Python stdlib Enum-compatible data type, as well as a
metaclass-based NamedTuple implementation and a NamedConstant class.

An Enum is a set of symbolic names (members) bound to unique, constant
values. Within an enumeration, the members can be compared by identity, and
the enumeration itself can be iterated over. If using Python 3 there is
built-in support for unique values, multiple values, auto-numbering, and
suspension of aliasing (members with the same value are not identical), plus
the ability to have values automatically bound to attributes.

A NamedTuple is a class-based, fixed-length tuple with a name for each
possible position accessible using attribute-access notation as well as the
standard index notation.

A NamedCo... continue reading

naive kindleBOT
#

Greetings list,

I am going to start tinkering with the Python source again (on Linux)
I previously built the source etc using Visual Studio on Windows
Now the EFL ui libs re-ignited my passion for C while playing with
python-efl
And Chris last proposal made me want to re-play with the CPython codebase

I dedicate time for Open Source as a maintainer but also as a learner.
So i'd like to ask so as to maximise my chances playing around with CPython

  • Any well grounded C tutorial to recommend? I know CPP but need a
    recommendation for C which is easy to follow and goes deep the C way. Or
    really any tutorial/s which are helpful like code styles or any series or
    ...

  • Any coding environment which you recommend?

  • For devs guide i know there is the official docs, and VStinner's
    unofficial
    but very helpful guide and a core dev's book published. Is there anything
    to know?

  • Any more tips around?

I guess sooner or later people figure out things but i'd be very happy to
have some C tips whi... continue reading

naive kindleBOT
#

I have a suggestion for the implementation.

I think that Chris' current approach is to compile the late-bound
defaults in the function body. So if we have a function like this:

def func(a, b=early\_expression, @c=late\_expression):
    block

the function code looks like this (after compilation):

# Pseudocode
if c is unbound:
    c = late\_expression
block

(except in bytecode of course).

Chris, do I have that right? If it is wrong, probably everything I say
next is irrelevant.

There is a strange asymmetry to the way the default for b and c are
handled. For b, it is the interpreter's responsibilty to load the
default value (pre-evaluated and cached) and bind it to the parameter.
But for c, it is the function object's responsibility.

I'd like to suggest a different approach which I expect will be more
flexible, I hope won't cost too much in performance, and in my opinion
much more closely matches the semantics of the feature.

I think it should remai... continue reading

naive kindleBOT
#

I’ve just published the September steering council update, also included
below:

https://github.com/python/steering-council/blob/main/updates/2021-09-steering-council-update.md

Just as a reminder, if you have any questions or concerns, feel free to
contact us or open an issue in the SC repo:
https://github.com/python/steering-council

September 6

  • There was no SC meeting on September 6 as it was a USA/Canada holiday
    (Labor Day).

September 13

  • The Steering Council met with Łukasz, the Developer-in-Residence. The
    group
    discussed dealing with review requests and folks not giving Łukasz enough
    time to review before things are merged.
  • The group briefly discussed Ezio's progress as the PM for the GitHub
    Issues
    migration and that the group would meet with Ezio on the 20th of Sept.
  • The SC discussed the Exception Groups PEP & Nathaniel's counter-proposal.
    The
    group decided that more time was needed so they will discuss this more at
    their Sept 20th meeting.

*September 20... continue reading

naive kindleBOT
#

Hello,
Today, an attack called "Trojan source" was revealed, where a malicious
contributor can use Unicode features (left-to-right text and homoglyphs)
to code that, when shown in an editor, will look different from how a
computer language parser will process it.
See https://trojansource.codes/, CVE-2021-42574 and CVE-2021-42694.

This is not a bug in Python.
As far as I know, the Python Security Response team reviewed the report
and decided that it should be handled in code editors, diff viewers,
repository frontends and similar software, rather than in the language.

I agree: in my opinion, the attack is similar to abusing any other
"gotcha" where Python doesn't parse text as a non-expert human would.
For example: if a or b == 'yes', mutable default arguments, or a
misleading typo.

Nevertheless, I did do a bit of research about similar gotchas in
Python, and I'd like to publish a summary as an informational PEP,
pasted below.

PEP: 9999
Titl... continue reading

naive kindleBOT
naive kindleBOT
#

Hello everyone:

The scenario/observation:
Beginners sometimes create scripts with the name of a package e.g.
pandas.py or seaborn.py in order to test something.
Later, they create and run another script or Jupyter Notebook in the same
folder which contains e.g. "import seaborn as sns" where the import itself
(most often) succeeds. However - and you see that coming already - when
they try to use attributes of the module, this fails with an AttributeError
and the poor souls don't know what happened and are not familiar and
confident enough to walk the traceback to find out that the import was
resolved by the local seaborn.py file instead of the installed seaborn
module/library. They are blocked until they have access to a senior
Pythonista who helps them out with that or they understand the
Stackoverflow advice even though they think the solution should come from a
different direction. Either way, it does not make Python seem seamless and
intuitive to them
. (And the next time around, ... continue reading

naive kindleBOT
#

I am pleased to announce the availability of beta release 0.7.1 of the "plum
-py" package.

This pure Python package provides classes and utility functions to
transform byte sequences into Python objects and back. While similar
in purpose to Python's standard library struct module, this
package provides a larger set of format specifiers and is extensible,
allowing you to easily create complex ones of your own.

Docs: https://plum-py.readthedocs.io/en/latest/index.html
PyPi: https://pypi.org/project/plum-py/
Repo: https://gitlab.com/dangass/plum
Install: pip install plum-py

License: MIT

With Regards,
Dan Gass
(dan.gass at gmail)

Change List

  • Support BitFields usage as typ in structure bitfield\_member().
naive kindleBOT
#

See the latest changes, which are mostly a (hopefully) improved abstract, better tables, and some slight rewordings.

Feedback welcome!


PEP: 663
Title: Standardizing Enum str(), repr(), and format() behaviors
Version: $Revision$
Last-Modified: $Date$
Author: Ethan Furman ethan@stoneleaf.us
Discussions-To: python-dev@python.org
Status: Draft
Type: Informational
Content-Type: text/x-rst
Created: 23-Feb-2013
Python-Version: 3.11
Post-History: 20-Jul-2021, 02-Nov-2021
Resolution:

Abstract

Update the repr(), str(), and format() of the various Enum types
to better match their intended purpose. For example, IntEnum will have
its str() change to match its format(), while a user-mixed int-enum
will have its format() match its str(). In all cases, an enum's
str() and format() will be the same (unless the user overrides
format()).

Add a global enum decorator which changes the str() and ``repr()`... continue reading

naive kindleBOT
#

As you might have noticed, 3.9.8 was scheduled for release on Monday. This didn't happen yet.

There's a bunch of ongoing work fixing Tcl/Tk problems. macOS Monterey got released with a new incompatible Tcl/Tk version, some fixes were required for tkinter compatibility. Details in https://bugs.python.org/issue44828 https://bugs.python.org/issue44828. This is now a fixed issue (thanks, Ned!) but we're going through some more ttk fixes discovered in failing buildbots, which were sadly unrelated to the Tcl/Tk version bump. In particular, there's a ttk refleak that was discovered by the Windows 8.1 refleak buildbot which turned out to be a widespread issue (other refleak buildbots were simply skipping GUI tests). Example failure: https://buildbot.python.org/all/#/builders/6/builds/168 https://buildbot.python.org/all/#/builders/6/builds/168

I'm fixing the macOS ttk test failures and the refleak now to unblock the 3.9.8 release. I should be done with this tomorrow. We'll go ahead with t... continue reading

naive kindleBOT
#

The final PEP with SC feedback incorporated and one last addition: bytes.ascii as a replacement for the Python 2 idiom
of str(some_var) to get the bytes version, and the Python 3 workaround of either the correct
str(some_var).encode('astii') or the potentially wrong ascii(some_var).encode('ascii').

The rendered version is at https://www.python.org/dev/peps/pep-0467/

Happy reading!

PEP: 467
Title: Minor API improvements for binary sequences
Version: $Revision$
Last-Modified: $Date$
Author: Nick Coghlan ncoghlan@gmail.com, Ethan Furman ethan@stoneleaf.us
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 30-Mar-2014
Python-Version: 3.11
Post-History: 2014-03-30 2014-08-15 2014-08-16 2016-06-07 2016-09-01 2021-04-13 2021-11-03

Abstract

This PEP proposes five small adjustments to the APIs of the bytes and
bytearray types to make it easier to operate entirely in the binary domain:

naive kindleBOT
#

What is cx_Oracle?

cx_Oracle is a Python extension module that enables access to Oracle
Database for Python and conforms to the Python database API 2.0
specifications with a number of enhancements.

Where do I get it?
https://oracle.github.io/python-cx\_Oracle

The easiest method to install/upgrade cx_Oracle is via pip as in

python -m pip install cx\_Oracle --upgrade

What's new?

See the full release notes for all of the details:
https://cx-oracle.readthedocs.io/en/latest/release\_notes.html#version-8-3-november-2021

Please provide any feedback via GitHub issues (
https://github.com/oracle/python-cx\_Oracle/issues).

naive kindleBOT
#

Hi All,

On behalf of the NumPy team I am pleased to announce the release of NumPy
1.21.4. NumPy 1.21.4 is a maintenance release that fixes a few bugs
discovered after 1.21.3. The most important fix here is for the NumPy
header files to make them work for both x86_64 and M1 hardware when
included in the Mac universal2 wheels. Previously, the header files only
worked for M1 and this caused problems for folks building x86_64
extensions. This problem was not seen before Python 3.10 because there were
thin wheels for x86_64 that had precedence. This release also provides thin
x86_64 Mac wheels for Python 3.10. Note that there are no manylinux1
wheels, the needed CentOS 5 repos have gone missing. Make sure you upgrade
your pip version if you have problems downloading the correct wheels.

The Python versions supported in this release are 3.7-3.10. If you want to
compile your own version using gcc-11 you will need to use gcc-11.2+ to
avoid problems. Wheels can be downloa... continue reading

naive kindleBOT
#

Call two or more functions with one args.
one last Day
إلى python-dev-owner
قبل 7 أيام
التفاصيل

#While reading about functions in mathematics, a figure representing the
sum of two functions caught my attention.
#I found it would be useful to add it in the next version of Python. Of
course, what is meant by collecting the two functions in mathematics is to
collect the results of the two functions, but here I mean to collect the
two or more functions on one args.
#If all the added functions have the same parameter and the same number of
them, then the form x = multi (fun1,func2)(3.5) will be very useful

def multi (a,b,s):
#func to return multi func with one arg or multi args
#Operations are performed on all parematers that represent functions using
one args, with the condition that all functions accept the same number of
variables

#In this case, it is just a function that we want to develop to avoid
possible errors and build several scenarios
#It has to be something like that

x = mu... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2021-10-29 - 2021-11-05)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7259 (+10)
closed 50203 (+46)
total 57462 (+56)

Open issues with patches: 2871

Issues opened (37)

#45641: Error In opening a file through tkinter on macOS Monterey
https://bugs.python.org/issue45641 reopened by devesh.dk373

#45675: pkgutil.get_data() doesn't add subpackages to parent packages
https://bugs.python.org/issue45675 opened by godlygeek

#45676: Enum: improve generics support
https://bugs.python.org/issue45676 opened by ethan.furman

#45677: [doc] improve sqlite3 docs
https://bugs.python.org/issue45677 opened by erlendaasland

#45680: Documentation on GenericAlias objects and `class_getitem
https://bugs.python.org/issue45680 opened by AlexWaygood

#45681: tkinter breaks on high resolution screen after ctype... continue reading

naive kindleBOT
#

Tcl/Tk updates

With the recent release of macOS 12 Monterey, we noticed that tkinter file dialogs are failing to show up on this new operating system, including in our built-in IDLE. Thanks to rapid help from the Tk team, and Marc Culler in particular, we were able to fix the issue by bundling Python 3.9.8 and Python 3.11.0a2 with a fixed Tcl/Tk version. In 3.9.8 it’s a patched 8.6.11 release while 3.11.0a2 is rocking the bleeding-edge 8.6.12rc1.

Since the issue also affected our latest stable version, 3.10.0, an updated macOS installer for this version was issued. You can recognize it by the post2 version appendix: python-3.10.0post2-macos11.pkg https://www.python.org/ftp/python/3.10.0/python-3.10.0post2-macos11.pkg. We didn’t have to bump the version number of Python itself since there are no Python source differences between this package and the original 3.10.0. The only difference is the bundled patched Tcl/Tk library.

Initially the original 3.10.0 installer was removed from t... continue reading

#

Tcl/Tk updates

With the recent release of macOS 12 Monterey, we noticed that tkinter file dialogs are failing to show up on this new operating system, including in our built-in IDLE. Thanks to rapid help from the Tk team, and Marc Culler in particular, we were able to fix the issue by bundling Python 3.9.8 and Python 3.11.0a2 with a fixed Tcl/Tk version. In 3.9.8 it’s a patched 8.6.11 release while 3.11.0a2 is rocking the bleeding-edge 8.6.12rc1.

Since the issue also affected our latest stable version, 3.10.0, an updated macOS installer for this version was issued. You can recognize it by the post2 version appendix: python-3.10.0post2-macos11.pkg https://www.python.org/ftp/python/3.10.0/python-3.10.0post2-macos11.pkg. We didn’t have to bump the version number of Python itself since there are no Python source differences between this package and the original 3.10.0. The only difference is the bundled patched Tcl/Tk library.

Initially the original 3.10.0 installer was removed from t... continue reading

naive kindleBOT
#

Hi all,

On behalf of the SciPy development team I'm pleased to announce the release
of SciPy 1.7.2, which is a bug fix release that includes wheels for Python
3.10 on many platforms. Many thanks to upstream developers in the ecosystem
for their assistance in making this possible.

Sources and binary wheels can be found at:
https://pypi.org/project/scipy/
and at: https://github.com/scipy/scipy/releases/tag/v1.7.2
https://github.com/scipy/scipy/releases/tag/v1.6.3
https://github.com/scipy/scipy/releases/tag/v1.6.1

One of a few ways to install this release with pip:

pip install scipy==1.7.2

====================
SciPy 1.7.2 Release Notes

SciPy 1.7.2 is a bug-fix release with no new features
compared to 1.7.1. Notably, the release includes wheels
for Python 3.10, and wheels are now built with a newer
version of OpenBLAS, 0.3.17. Python 3.10 wheels are provided
for MacOS x86_64 (thin, not universal2 or arm64 at this time),
and Windows/... continue reading

naive kindleBOT
#

When is an empty container contained by a non-empty container?

For example:

{} in {1:'a', 'b':2] <-- TypeError because of hashability

set() in {1, 2, 'a', 'b'} <-- ditto

[] in ['a', 'b', 1, 2] <-- False

'' in 'a1b2' <-- True

SomeFlag.nothing in SomeFlag.something <-- ???

Personally, I have never had a use for '' in 'some string' being True, and always have to guard against that scenario.
Likewise, if an empty collection of flags is contained by a collection of flags, then that will trip me up as well; on
the other hand, it seems that collections of related flags are often treated as in set theory, where the empty set is a
member of any non-empty set...

So, does Flag adhere to set theory, or is just happenstance that some operators work the same for both groups?

Can we have SomeFlag.nothing in SomeFlag.something be False, or would that be too surprising?

--
~Ethan~

naive kindleBOT
#

Currently pickling decorated function is impossible due to name collision.

Because the decorated function is what we want, so it would be nice to add syntax sugar in Python to automatically rename original function with random generated prefix or suffix.

This can greatly help the application of parallel computing.

naive kindleBOT
#

Currently, There is two types of Executor in concurrent.futures.

They are ThreadPoolExecutor and ProcessPoolExecutor, there is GIL limitation of ThreadPoolExecutor and ProcessPoolExecutor need to use pickle which have limitation on decorated function.

It would be nice to add new Executor UnixForkExecutor which is based on os.fork and shared memory (to return future).

The drawback of UnixForkExecutor can only be used on Unix platform.

This is not a problem, because the majority people use python for parallel computing on Unix platform.

Anyone have any opinion about it?

naive kindleBOT
#

Currently, Python doesn't allow non-default arguments after default
arguments:

def foo(x=None, y): pass
  File "<stdin>", line 1
    def foo(x=None, y): pass
                     ^
SyntaxError: non-default argument follows default argument

I believe that at the time this was introduced, no use cases for this
were known and this is is supposed to prevent a source of bugs. I have
two use cases for this, one fringe, but valid, the other more important:

The fringe use case: Suppose you have a function that takes a 2D
coordinate value as separate "x" and "y" arguments. The "x" argument is
optional, the "y" argument isn't. Currently there are two ways to do
this, none of them particularly great:

def foo(y, x):  # reverse x and y arguments, confusing
    ...
def foo(x, y=None):  # Treat the x argument as y if only one argument is
provided
    if y is None:
        x, y = y, x
    ...

To me, the "natural" solution looks like this:

def foo(x=... continue reading

naive kindleBOT
#

REF: RITM1146898

Hello, my name is Charita Elmore and I am a Supply Chain Risk Management Coordinator at NASA.  As such, I ensure that all NASA acquisitions of Covered Articles comply with Section 208 of the Further Consolidated Appropriations Act, 2020, Public Law 116-94, enacted December 20, 2019.  To do so, the Country of Origin (CoO) information must be obtained from the developer of the product(s).  Specifically, identify the country where the original code was developed:

  • Homebrew package: mpdecimal

[cid:image001.png@01D7D539.7FD581F0]

naive kindleBOT
#

Hi All,

This is a modest proposal to consider having sorted containers (http://www.grantjenks.com/docs/sortedcontainers/ http://www.grantjenks.com/docs/sortedcontainers/) in standard library. I know that usually adding stuff to standard library requires some strong arguments, so I will try my best to give my reasons here:

  1. Some mainstream language support them out of box: C++ for example have set/map which are sorted by the key order, and Java has TreeMap which is internally a Red-black tree. I understand languages might target different audiences, but I think Python’s standard library is quite extensive compared to peers. Consider we even have a sqlite driver in the stdlib, I do not think it is outrageous to have sorted containers.
  2. These containers are not really easy to implement correctly, and usually is out of the scope of day-to-day projects. Especially considering we have a large audience of non-hardcore programmers in Python community. They may have the need to use the... continue reading
naive kindleBOT
#

(Not sending this out as a SC member, just as myself.)

Because we're half-way through the nomination period, I want to remind
people about the Steering Council elections, and the fact that you do not
have to be a Core Developer to be nominated
, just to nominate someone
(including yourself). If you know someone who you think would be a good
person to have on the Steering Council, Core Developer or not, talk to
them. Offer to nominate them, if you're a Core Developer, or talk to a Core
Developer to do it.

For more information, see PEP 13 (Python Language Governance)
https://www.python.org/dev/peps/pep-0013/, PEP 8103 (2022 Term steering
council election) https://www.python.org/dev/peps/pep-8103/, and Ee's
announcement
https://discuss.python.org/t/steering-council-nominations-are-now-open-2022-term/11676
on
how to nominate.

We still have about a week left, and I know there's several people who are
planning to nominate, so I'm not worried about the number of nominations...
But I... continue reading

naive kindleBOT
#

I am pleased to announce the availability of beta release 0.7.2 of the "plum
-py" package.

This pure Python package provides classes and utility functions to
transform byte sequences into Python objects and back. While similar
in purpose to Python's standard library struct module, this
package provides a larger set of format specifiers and is extensible,
allowing you to easily create complex ones of your own.

Docs: https://plum-py.readthedocs.io/en/latest/index.html
PyPi: https://pypi.org/project/plum-py/
Repo: https://gitlab.com/dangass/plum
Install: pip install plum-py

License: MIT

With Regards,
Dan Gass
(dan.gass at gmail)

Change List

  • Support packing bytearray() with ItemsX transforms.
  • Previously when an exception occurred during pack/unpack operation and the
    dump records were half baked, creating dump representation for exception
    message resulted in a different error and didn't allow the dump to be
    seen and used.
  • A... continue reading
naive kindleBOT
#

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 re... continue reading

naive kindleBOT
#

So I was reading the docs for the threading module and I stumbled upon
this little note:

Note:

In the Python 2.x series, this module contained camelCase names for some
methods and functions. These are deprecated as of Python 3.10, but they are
still supported for compatibility with Python 2.5 and lower.

And it got me thinking.

Given that there is some precedent, would it be feasible to make a
concerted effort to add aliases across the board for all public-facing
stdlib types and functions that don't follow pep8-recommended casing?

I realize that large chunks of the stdlib predates pep8 and therefore use
various non-uniform conventions. For example, the logging module is fully
camelCased, and many core types like str and list don't use PascalCase
as pep8 recommends. The collections module is a veritable mosaic of
casing conventions, with some types like deque and namedtuple being
fully lowercased while others like Counter and ChainMap are PascalCased.

My motivati... continue reading

naive kindleBOT
#

On 11/11/21 11:53 AM, Matt del Valle wrote:

Okay, so from the replies so far it looks like this is very quickly going into the 'never gonna happen'
dumpster, so in the interests of salvaging something out of it:

[...]

I just dislike having to settle for 'it's what we've got'. With these two modules in particular, a lot
of the arguments that have been made so far either don't apply or are not as strong (such as the
confusion of having builtins.list, builtins.List and typing.List). Additionally, these are significantly
more ancillary portions of the stdlib than the builtins, much less likely to cause as severe of a
disruption (I personally don't believe a backward-compatible change like this which only adds aliases
would be as disruptive as many people claim, but concede that that's subjective), and much less likely
to have the implementation change so drastically as to want to change out types for factory functions
or vice-versa.

So perhaps we could narrow t... continue reading

#

On 11/11/21 11:53 AM, Matt del Valle wrote:

Okay, so from the replies so far it looks like this is very quickly going into the 'never gonna happen'
dumpster, so in the interests of salvaging something out of it:

[...]

I just dislike having to settle for 'it's what we've got'. With these two modules in particular, a lot
of the arguments that have been made so far either don't apply or are not as strong (such as the
confusion of having builtins.list, builtins.List and typing.List). Additionally, these are significantly
more ancillary portions of the stdlib than the builtins, much less likely to cause as severe of a
disruption (I personally don't believe a backward-compatible change like this which only adds aliases
would be as disruptive as many people claim, but concede that that's subjective), and much less likely
to have the implementation change so drastically as to want to change out types for factory functions
or vice-versa.

So perhaps we co... continue reading

naive kindleBOT
#

We're rebuilding many popular projects with Python 3.11 alpha, and I see
many failures like:

AttributeError: module 'configparser' has no attribute
'SafeConfigParser'. Did you mean: 'RawConfigParser'?
(bpo-45173)

ImportError: cannot import name 'formatargspec' from 'inspect'
(bpo-45320)

AttributeError: '[...]Tests' object has no attribute 'failUnless'
(bpo-45162)

Are these changes necessary?
Does it really cost us that much in maintainer effort to keep a
well-tested backwards compatibility alias name, or a function that has a
better alternative?

I think that rather than helping our users, changes like these are
making Python projects painful to maintain.
If we remove them to make Python easier for us to develop, is it now
actually that much easier to maitain?

The current backwards compatibility policy (PEP 387) sets a minimum
timeline for deprecations and removals -- "deprecation period must last
at least two years."
But it seems like it's not treated as a mini... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2021-11-05 - 2021-11-12)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7282 (+23)
closed 50241 (+38)
total 57523 (+61)

Open issues with patches: 2886

Issues opened (46)

#44439: stdlib wrongly uses len() for bytes-like object
https://bugs.python.org/issue44439 reopened by malin

#45354: test_winconsoleio fails on Windows 11
https://bugs.python.org/issue45354 reopened by vstinner

#45708: PEP 515-style formatting with underscores does not seem to wor
https://bugs.python.org/issue45708 reopened by serhiy.storchaka

#45732: Update python.org Windows and macOS installers to use Tk 8.6.1
https://bugs.python.org/issue45732 opened by ned.deily

#45733: importlib.abc.Traversable.name does not match
https://bugs.python.org/issue45733 opened by jmg

#45735: Promise the long-time truth that args=list wor... continue reading

naive kindleBOT
naive kindleBOT
#

I’ve not been following the thread, but Steve Holden forwarded me the email from Petr Viktorin, that I might share some of the info I found while recently diving into this topic.

As part of working on the next edition of “Python in a Nutshell” with Steve, Alex Martelli, and Anna Ravencroft, Alex suggested that I add a cautionary section on homoglyphs, specifically citing “A” (LATIN CAPITAL LETTER A) and “Α” (GREEK CAPITAL LETTER ALPHA) as an example problem pair. I wanted to look a little further at the use of characters in identifiers beyond the standard 7-bit ASCII, and so I found some of these same issues dealing with Unicode NFKC normalization. The first discovery was the overlapping normalization of “ªº” with “ao”. This was quite a shock to me, since I assumed that the inclusion of Unicode for identifier characters would preserve the uniqueness of the different code points. Even ligatures can be used, and will overlap with their multi-character ASCII forms. So we have adde... continue reading

naive kindleBOT
#

Usually when we want to make a variable/def/class etc global, we can just declare global v at the beginning, but I feel like there could be a better way to do that.

So my idea is to allow doing stuff like

global a = 3

or

nonlocal def x(): ...

or even

for global i in []: ...

in addition to the current global statement to allow backwards compatibility
What do you think?

naive kindleBOT
#

Wing 8.1.1 fixes stepping into imports in newer Python versions,
improves editing multiple selections, fixes problems with Find Uses in
remote projects, improves some syntax coloring configurations, fixes
creating a Django project with a base installation of Python on Windows,
more gracefully handles temporarily losing the remote agent connection,
sets the correct file type for files opened while the remote agent is
unavailable, fixes Black reformatting in Python 3.10, and makes several
other improvements.

Details: https://wingware.com/news/2021-11-12
Downloads: https://wingware.com/downloads

== About Wing ==

Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing's deep code analysis provides
auto-completion, auto-editing, and refactoring that speed up
development. Its top notch debugger works with any Python code, locally
or on a remote hos... continue reading

naive kindleBOT
#

Get it here: https://www.python.org/downloads/release/python-399/ https://www.python.org/downloads/release/python-399/
Python 3.9.9 is the eighth maintenance release of the legacy 3.9 series. Python 3.10 is now the latest feature release series of Python 3. Get the latest release of 3.10.x here https://python.org/downloads/.

3.9.9 was released out of schedule as a hotfix for an argparse regression in Python 3.9.8 which caused complex command-line tools to fail recognizing sub-commands properly. Details in BPO-45235 https://bugs.python.org/issue45235. There are only three other bugfixes in this release compared to 3.9.8. See the changelog https://docs.python.org/release/3.9.9/whatsnew/changelog.html for details on what changed.

Upgrading to 3.9.9 is highly recommended if you’re running Python 3.9.8.

The next Python 3.9 maintenance release will be 3.9.10, currently scheduled for 2022-01-03.

<https://discuss.python.org/t/python-3-9-9-hotfix-release-is-now-available/11978#we-a... continue reading

naive kindleBOT
#

Get it here: https://www.python.org/downloads/release/python-399/ https://www.python.org/downloads/release/python-399/
Python 3.9.9 is the eighth maintenance release of the legacy 3.9 series. Python 3.10 is now the latest feature release series of Python 3. Get the latest release of 3.10.x here https://python.org/downloads/.

3.9.9 was released out of schedule as a hotfix for an argparse regression in Python 3.9.8 which caused complex command-line tools to fail recognizing sub-commands properly. Details in BPO-45235 https://bugs.python.org/issue45235. There are only three other bugfixes in this release compared to 3.9.8. See the changelog https://docs.python.org/release/3.9.9/whatsnew/changelog.html for details on what changed.

Upgrading to 3.9.9 is highly recommended if you’re running Python 3.9.8.

The next Python 3.9 maintenance release will be 3.9.10, currently scheduled for 2022-01-03.

<https://discuss.python.org/t/python-3-9-9-hotfix-release-is-now-available/11978#we-a... continue reading

naive kindleBOT
#

Hello,

Instead of writing 'class A(Generic[T]): ...', can we do something like rust lang, i.e., 'class A[T]: ...'? Rust uses <T> but in python we use [T]. This reflects the type annotation for the class nicely. For example, a: A[T]. It’s weird seeing the word Generic inside the class inheritance parentheses which should be reserved for abstract base classes (abc) or explicit protocol classes or superclasses in general (even with their generic type parameters. For example, class AT.

Rust also defines the generic type parameter for functions. “fn func<T>(a: A[T]) -> T {function body}”. In Python, we can do the following:
def func[T](a: A[T]) -> T: …

With the new proposed type hint for Callable, The type annotation for the above function will be ..
func: T -> T
And this as well reflects nicely with the function signature.

Now, suddenly, we don’t need to write 'T=TypeVar(“T”, bound=…,)' if the generic type is enclosed for the class and function scopes (lo... continue reading

naive kindleBOT
#

Hi All,
I tried to compose a protable virtualEnvironment using Python. I aready found a solution which already works but still not stable.
So by creating venv in conventional way, I additionally copy the Python executable and related dlls, zip file, ._pth file to the root of venv folder.
The weak point of this solution is the pyvenv.cfg file and the value of the home variable!
It can accept both absolute or relative paths, it is fine and good as it is. Using this solution (copiing Python executable and other files) and changing home path to .\venv(as relative) I am able to fetch packages by using pip install.
But not all the packages! Eg pyinstaller changes the scope of calling Python.exe thatswhy not possible to fetch it. (Not found: .\venv\python.exe)

I assume during parsing of home path inside pyenv.cfg by converting it to absolute path(if a relative path was given) behind the scene, I and anybody else would have a fully functionally portable virtualenv solution!

naive kindleBOT
#

This PEP 1 introduces a simple and intuitive way to annotate methods and classmethods that return an instance of their class. Such methods and classmethods occur quite frequently, but the existing way to annotate them correctly is quite arcane and error-prone. The PEP introduces a special type Self to represent the type of the self parameter, similar to the this type in TypeScript and the Self type in Rust. We have implementations for mypy and pyright. The PEP does not affect CPython directly except for the addition of one special form (Self) to typing.py [2].

Since we have reached consensus on the PEP in typing-sig [3], we wanted to get your comments and suggestions before submitting to the Steering Council.

Thanks,
Pradeep Kumar Srinivasan
James Hilton-Balfe

[2]: Adding Self to typing_extensions.py: https://github.com/python/typing/pull/933
[3]: See the comments from typing-sig members on the Google doc: https://docs.goo... continue reading

naive kindleBOT
#

Hi all,

I have seen discussion of docstrings for class attributes before on this
list, but not with this exact proposal.

My motivation is that I have a dataclass for which I want to write
docstrings that can be accessed at runtime. In my specific case, the
docstrings would be used to create a help message.

Sphinx supports a syntax to document class attributes. It looks like
this:

@dataclass
class A:
"""Docstring for class A."""
x: int
"""Docstring for x"""
y: bool = True
"Docstring for y"

It is a bit awkward that the docstring is below the definition of the
attribute, but it can't be put above because it could be confused for
the class docstring.

My proposal would be to just enshrine this syntax as the syntax for
attribute docstring, and to make them available at runtime. They would
be stored in a dictionary like the type annotations. For example like
this:

A.__attrdoc__ == {"x": "Docstring for x", "y": "Docstring for y"}

Best,
Thomas

naive kindleBOT
#

Does PEP 563 or 649 satisfy static and dynamic typing needs?

In the interest of full transparency, we want to let the Python community know that the Steering Council continues to discuss PEP 563 (Postponed Evaluation of Annotations) and PEP 649 (Deferred Evaluation Of Annotations Using Descriptors). We have concluded that we lack enough detailed information to make a decision in favor of either PEP. As we see it, adopting either PEP 563 or PEP 649 as the default would be insufficient. They will not fully resolve the existing problems these PEPs intend to fix, will break some existing code, and likely don’t address all the use cases and requirements across the static and dynamic typing constituents. We are also uncertain as to the best migration path from the current state of affairs.

Defer decision on PEP 563 and 649 in 3.11

As such, at this time, the only reasonable path forward that the SC sees is to defer the decision in Python 3.11 again, essentially keeping the 3.10 status q... continue reading

#

Hello Mark, Matthew, Pradeep, Vincent, and Guido,

The Python Steering Council discussed the latest version of PEP 646 (Variadic Generics) at our last meeting, and have unanimously decided to accept the PEP. Congratulations!

We want to specifically mention that we appreciate the way you called out the Python grammar changes required by the typing features you proposed. As we’ve said before, the Steering Council strongly believes that the typing language and the “general” Python programming language should remain aligned, so the implications of syntax change proposed in the PEP for typing needed to be addressed for non-typed Python as well. The PEP explains this change well, and does a good job of justifying the semantics and usefulness of the change for non-type related purposes.

Please feel free to change the PEP status to Accepted, and to merge your changes to Python 3.11 at your convenience.

With our appreciation,
-Barry (on behalf of the Python Steering Council)

naive kindleBOT
#

Hello Ethan,

The Steering Council has been discussing PEP 663 (Improving and Standardizing Enum str(), repr(), and format() behaviors), for the last few weeks. We want to thank you for your work on this PEP and your continued work on enums in the standard library.

Upon further consideration, we have decided to reject this PEP, although we do agree with the need to change IntEnum’s str() or format(); see below.

Several reasons are leading the SC to its conclusion. The first is that enums in the stdlib are already highly complex, and consistency is our top priority over time. Having predictable and stable strs and reprs across Python versions is more important than the consistency among the various enum and non-enum types that the PEP proposes. The PEP rightly states that “[b]ackwards compatibility of stringified objects is not guaranteed across major Python versions, and there will be backwards compatibility breaks where software uses the repr(), str(), and format() output of enu... continue reading

naive kindleBOT
naive kindleBOT
#

This is a personal plea (i.e. not coming from the SC at all), but in the
last month we have had PEPs changed twice post-submission to the SC. That's
a big time sink as we take multiple meetings to discuss a PEP and having
things change underneath us causes us to have to re-evaluate our
discussions (and I know I pretty much start thinking about PEPs once they
are submitted, whether we are actively discussing them or not and I'm
probably not the only SC member who does this).

I know no one did this maliciously or anything, but since it's happened
twice now I just want to ask people be cognizant of this. Please reach out
to the SC if you want to make a change so we can discuss whether we think
it will help/hurt the PEP, etc. and we are also not taken off-guard by
things shifting (assume we don't monitor the commits and PRs to the peps
repo, so unless you explicitly say, "hold on", we won't realize discussions
are ongoing in a PR or anything). If that means withdrawing your PEP for
consid... continue reading

naive kindleBOT
#

Hi,

Currrently, is it allowed for process worker to submit new task to its parent executor?

Considering the following Python script:


import concurrent.futures

with concurrent.futures.ProcessPoolExecutor(max_workers=12) as ppe:
    def hello(n: int) -> int:
        if n == 0:
            return 0
        return n+ ppe.submit(hello, n-1).result()

    future = ppe.submit(hello, 1)
    print(future.result())

It will never stuck and never ended.

Sent with ProtonMail Secure Email.

naive kindleBOT
#

ACTIVITY SUMMARY (2021-11-12 - 2021-11-19)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7290 ( +8)
closed 50286 (+45)
total 57576 (+53)

Open issues with patches: 2884

Issues opened (37)

#34592: cdll.LoadLibrary allows None as an argument
https://bugs.python.org/issue34592 reopened by gregory.p.smith

#41735: Thread locks in zlib module may go wrong in rare case
https://bugs.python.org/issue41735 reopened by malin

#45797: AMD64 Arch Linux Asan Debug buildbot sometimes hangs before te
https://bugs.python.org/issue45797 opened by vstinner

#45802: MozillaCookieJar can't read cookies, should support cookies.sq
https://bugs.python.org/issue45802 opened by akkana

#45803: make_dataclass is missing the documented kw_only argument
https://bugs.python.org/issue45803 opened by kintisheff

#45804: IDLE - faster shell wr... continue reading

naive kindleBOT
#

I’m happy to announce the release of structlog 21.3.0!

With more than 2.5 million downloads per month, structlog is the most popular solution for structured logging in Python. It doesn’t just allow you to log key-value pairs in a structured manner, it also makes it EASIER and FASTER. Check out https://www.structlog.org/en/stable/why.html if you’re intrigued but not convinced!

Heartfelt thanks go to my generous GitHub sponsors https://github.com/sponsors/hynek, companies subscribing on Tidelift https://tidelift.com/subscription/pkg/pypi-structlog (currently nobody :( – tell your boss!), and people who bought me a coffee on https://ko-fi.com/the\_hynek!

Support like that makes me work on FOSS on a Saturday afternoon, so please consider supporting me https://hynek.me/say-thanks/ too! <3

RELEASE HIGHLIGHTS:

The main reason for this comparatively timely release is that aiohttp 3.8's new behavior of starting new loops within aiohttp.web.run_app() led to breakage in apps that ... continue reading

naive kindleBOT
#

PyCA cryptography 36.0.0 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.

(As a reminder, cryptography changed its versioning scheme with 35.0.
For more information see
https://cryptography.io/en/latest/api-stability/#versioning)

Changelog (https://cryptography.io/en/latest/changelog/#v36-0-0):

  • FINAL DEPRECATION: Support for verifier and signer on our asymmetric
    key classes was deprecated in version 2.1. These functions had an
    extended deprecation due to usage, however the next version of
    cryptography will drop support. Users should migrate to sign and
    verify.
  • The entire X.509 layer is now written in Rust. This allows alternate
    asymmetric key implementations that can support cloud key management
    services or hardware security modules provided they impl... continue reading
naive kindleBOT
#

Hi, I'd like to revive this thread after what seemed like a decade and see where this might take us 😃

I like this idea that the OP suggested but I'd like to extend this to all iterator objects (range_iterators, list_iterators etc.).

📌Idea
Iterables to expose the .__iter__() method in iterable as .iter().
Iterators to implement 'transformational' functions like map, filter, flat_map, 'reductional' functions like reduce, sum, join, and 'evaluate' functions like to_list and to_set.

(
[1,2,3].iter()
.map(lambda x: x+1)
.filter(lambda x: x % 2 == 0)
.to_list()
)

📌Why?

  1. It is readable in a manner that is procedural and dataflow centric. At one glance, it is easy to reason about how our data gets transformed - we start with the subject, our data, then we perform a sequence of transformations. The previous way of doing this:
    list(
    filter(
    lambda x: x%2==0, map(
    lambda x: x+1, iter([1,2,3]))))
    incurs a lot of cognitive overload. We could... continue reading
naive kindleBOT
#

pyspread 2.0

This is the first stable release of pyspread that runs under Python 3
(>=3.6).

Apart from version changes and release file updates, it is feature
identical with version 1.99.8.

About pyspread

Pyspread is a non-traditional spreadsheet that is based on and written
in the programming language Python.

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website: https://pyspread.gitlab.io/
Download page: https://pypi.org/project/pyspread/
Signature for tarball:

https://gitlab.com/pyspread/downloads/-/raw/master/releases/pyspread-2.0.tar.gz.sig
Source code: https://gitlab.com/pyspread/pyspread

Dependencies

Mandatory:

  • Python (≥ 3.6)
  • numpy (>=1.1)
  • PyQt5 (≥ 5.10, requires PyQt5.Svg)
  • setuptools (>=40.0)
  • markdown2 (>= 2.3)

Recommended:

naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.22.0rc1. NumPy 1.22.0rc1 is a big release featuring the work of 150
contributers spread over 575 pull requests. There have been many
improvements,
highlights are:

  • Annotations of the main namespace are essentially complete. Upstream
    is a moving target, so there will likely be further improvements, but the
    major work is done. This is probably the most user visible enhancement in
    this release.
  • A preliminary version of the proposed Array-API is provided. This is a
    step in creating a standard collection of functions that can be used across
    applications such as CuPy and JAX.
  • NumPy now has a DLPack backend. DLPack provides a common interchange
    format for array (tensor) data.
  • New methods for quantile, percentile, and related functions.
    Thenew methods provide a complete set of the methods commonly found in the
    literature.
  • A new configurab... continue reading
naive kindleBOT
#

Hi all,

On behalf of the SciPy development team, I'm pleased to announced the
release of SciPy 1.7.3,
which is a bug fix release that includes wheels for MacOS 12+ arm64 at
Python versions 3.8, 3.9, and 3.10.

Sources and binary wheels can be found at:
https://pypi.org/project/scipy/
and at: https://github.com/scipy/scipy/releases/tag/v1.7.3
https://github.com/scipy/scipy/releases/tag/v1.6.3
https://github.com/scipy/scipy/releases/tag/v1.6.1

One of a few ways to install this release with pip:

pip install scipy==1.7.3

=====================
SciPy 1.7.3 Release Notes

SciPy 1.7.3 is a bug-fix release that provides binary wheels
for MacOS arm64 with Python 3.8, 3.9, and 3.10. The MacOS arm64 wheels
are only available for MacOS version 12.0 and greater, as explained
in Issue 14688, linked below.

Authors

  • Anirudh Dagar
  • Ralf Gommers
  • Tyler Reddy
  • Pamphile Roy
  • Olivier Grisel
  • Isuru Fernando

A total of 6 people ... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2021-11-19 - 2021-11-26)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7266 (-24)
closed 50367 (+81)
total 57633 (+57)

Open issues with patches: 2879

Issues opened (36)

#45774: Detect SQLite in configure.ac
https://bugs.python.org/issue45774 reopened by erlendaasland

#45853: Misspelled _IGNORED_ERROS in Lib/pathlib.py
https://bugs.python.org/issue45853 opened by andrei.avk

#45854: winreg: implement RegGetValue
https://bugs.python.org/issue45854 opened by imba-tjd

#45855: PyCapsule_Import still using PyImport_ImportModuleNoBlock
https://bugs.python.org/issue45855 opened by georg.brandl

#45857: PEP 604 Union syntax does not support forward references
https://bugs.python.org/issue45857 opened by TNThung

#45858: Deprecate default converters in sqlite3
https://bugs.python.org/issue45858 ope... continue reading

naive kindleBOT
#

pyspread 2.0.1

This is a bugfix release for pyspread 2.0.

Bug fixes:

  • Font tests removed because of frequent issues with Debian's font
    aliasing system
  • Outdated information regarding SVG export removed from documentation

About pyspread

Pyspread is a non-traditional spreadsheet that is based on and written
in the programming language Python.

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website: https://pyspread.gitlab.io/
Download page: https://pypi.org/project/pyspread/
Signature for tarball:

https://gitlab.com/pyspread/downloads/-/raw/master/releases/pyspread-2.0.tar.gz.sig
Source code: https://gitlab.com/pyspread/pyspread

Dependencies

Mandatory:

  • Python (≥ 3.6)
  • numpy (>=1.1)
  • PyQt5 (≥ 5.10, requires PyQt5.Svg)
  • setuptools (>=40.0)
  • markdown2 (>= 2.3)

Recomme... continue reading

naive kindleBOT
#

Many operations involving two literals are optimized (to a certain level). So it sort of surprises me that literal comparisons are not optimized and literal contains only convert the right operand to a constant if possible. I'd like to implement optimizations for these especially for the literal contains. There is a TODO in the ast optimizer for literal comparisons as well, and that's another reason I would like to have these added.

naive kindleBOT
#

sphinx-codeautolink makes documentation code examples clickable.
Links to reference documentation are inserted for the functions
and classes that the example uses. The key aim is a minimal setup
assuming examples are already valid Python, but bells and whistles
for hiding imports, concatenating examples, autodoc and intersphinx
integrations, and custom link styles are available.

A live demo is available on our documentation:
https://sphinx-codeautolink.rtfd.io

In the last few releases we've made significant improvements:

  • Improved parsing to support fluent interfaces, link import statements,
    find relocated functions and classes, and find attributes from subclasses
  • Simplified integration with third-party directives
  • Fixed a plethora of parsing, linking and other runtime bugs

sphinx-codeautolink uses the MIT licence, and version 0.7.0
was recently released. Please reach out on GitHub (felix-hilden)
or at felix.hilden@gmail.com if you have any questions or suggestions.
Thank you... continue reading

naive kindleBOT
#

Dear colleagues,

We are very happy to announce the v5.0 release of astropy, a core Python
package for Astronomy:

http://www.astropy.org

The astropy core package is a community-driven Python package intended to
contain much of the core functionality and common tools needed for
astronomy and astrophysics. It is part of the Astropy Project, which aims
to foster an ecosystem of interoperable astronomy packages for Python.

New and improved major functionality in this release includes:

  • Support for reading, writing, and converting Cosmology objects
  • A new cosmology units module
  • New trigonometric and spline models
  • Support for dask arrays in tables
  • Support for registering array-like objects as mixin columns
  • Support for reading and writing tables to Parquet format
  • Support for reading and writing tables to MRT format
  • Support for masked quantity columns, including masked FITS columns with
    units
  • Converting SkyCoord to QTable
  • A new unified I/O arch... continue reading
naive kindleBOT
#

Andrew Barnert via Python-ideas writes:

...
Is there any commonly used or even imaginable useful type that uses
them in weirder ways than set and float (which are both partially
ordered) or np? array (where they aren’t even Boolean-values)?

I've had occasion (a class for outcomes in two-player games) to define
both < and <= as complete preorders, with "symmetry" in the sense that
A < B iff B > A and A <= B iff B >= A, but < and <= were completely
independent: they could be identical ("game of pure coordination"),
they could be inverse ("game of pure competition"), and they could be
anything else (eg, "prisoners' dilemma"). This system took a little
getting used to, but writing "A > B and A >= B and A != B" [1] to
implement "A Pareto dominates B" was one expressive convenience among
others.

I'm not sure this is "weird" in the sense you mean, and I greatly
doubt this is sufficiently common to deserve an ABC :-), but it's a
real example (long since archived on a dis... continue reading

naive kindleBOT
#

Hi,

I propose to disallow using macros as l-value. Read and comment the
plain text below, or read the PEP 674 online,
https://python.github.io/peps/pep-0674/

While I'm not sure that the proposed changes are really controversial,
I decided to write a formal PEP since the incompatible changes are not
following the PEP 387 deprecation process and so a format PEP 387
exception is better. Well, the list of modified macros is also quite
long. Moreover, a PEP is a way to document and announce the changes
;-)

The Py_TYPE() and Py_SIZE() changes are already approved the Steering
Council, but I prefer to list them in the PEP:
https://github.com/python/steering-council/issues/79

In practice, I'm only aware of 4 projects impacted by these changes,
and I wrote the pythoncapi_compat project which updates automatically
C extensions: add Python 3.11 support, without losing support for
older Python versions. I already prepared major projects like Cython
and numpy for these changes (in total, 14... continue reading

naive kindleBOT
#

Incompatible C API change disallowing using macros as l-value to allow
evolving CPython internals and to ease the C API implementation on other
Python implementation.

naive kindleBOT
#

I've just updated PEP 671 https://www.python.org/dev/peps/pep-0671/
with some additional information about the reference implementation,
and some clarifications elsewhere.

PEP 671: Syntax for late-bound function argument defaults

Questions, for you all:

  1. If this feature existed in Python 3.11 exactly as described, would
    you use it?

  2. Independently: Is the syntactic distinction between "=" and "=>" a
    cognitive burden?

(It's absolutely valid to say "yes" and "yes", and feel free to say
which of those pulls is the stronger one.)

  1. If "yes" to question 1, would you use it for any/all of (a) mutable
    defaults, (b) referencing things that might have changed, (c)
    referencing other arguments, (d) something else?

  2. If "no" to question 1, is there some other spelling or other small
    change that WOULD mean you would use it? (Some examples in the PEP.)

  3. Do you know how to compile CPython from source, and would you be
    willing to try this out? Please? :)

I'd love to hear, also, from ... continue reading

naive kindleBOT
#

I ran into an issue today with str() not behaving as I thought it should.

Given the following test script, what should happen?

-- 8< ------------------------------

class Blah(object):
def __str__(self):
return 'blah'

class Huh(int, Blah):
pass

class Hah(Blah, int):
pass

huh = Huh(7)
hah = Hah(13)

print(huh)
print(hah)

-- 8< ------------------------------

I thought I would get:

7
blah

and indeed, that is what I got for Pythons 2.7 - 3.7. However, starting with Python 3.8 I started getting:

blah
blah

To say the least, I was surprised.

Some searching turned up issue 36793: "Do not define unneeded __str__ equal to __repr__" .

As can be seen, __str__ is needed for inheritance to work properly. Thoughts on reverting that patch?

--
~Ethan~

naive kindleBOT
#

Hi everyone,

NumExpr 2.8.0 is released. This is mostly a version bump. We now support
Python 3.10
and support for 2.7 and 3.5 has been discontinued.

Project documentation is available at:

http://numexpr.readthedocs.io/

Changes from 2.7.3 to 2.8.0

  • Wheels for Python 3.10 are now provided.
  • Support for Python 2.7 and 3.5 has been discontinued.
  • All residual support for Python 2.X syntax has been removed, and
    therefore
    the setup build no longer makes calls to the 2to3 script. The
    setup.py
    has been refactored to be more modern.
  • The examples on how to link into Intel VML/MKL/oneAPI now use the dynamic
    library.

What's Numexpr?

Numexpr is a fast numerical expression evaluator for NumPy. With it,
expressions that operate on arrays (like "3a+4b") are accelerated
and use less memory than doing the same calculation in Python.

It has multi-threaded capabilities, as well as support for Intel's
MKL (... continue reading

naive kindleBOT
naive kindleBOT
#

Hi,

I wrote two scripts based on the work of INADA-san's work to (1)
download the source code of the PyPI top 5000 projects (2) search for
a regex in these projects (compressed source archives).

You can use these tools if you work on an incompatible Python or C API
change to estimate how many projects are impacted.

The HPy project created a Git repository for a similar need (latest
update in June 2021):
https://github.com/hpyproject/top4000-pypi-packages

There are also online services for code search:

(1) Dowload

Script:
https://github.com/vstinner/misc/blob/main/cpython/download\_pypi\_top.py

Usage: download_pypi_top.py PATH

It uses this JSON file:
https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.min.json

From this service:
https://hugovk.github.io/top-pypi-packages/

At December 1, on 5000 projects, it only downloads 4760 tarball and
... continue reading

naive kindleBOT
#

Hi!
When I read PEP7 and check Cpython source code, I found a deficiency that in https://www.python.org/dev/peps/pep-0007/#code-lay-out.
In this section, document said that
'''
For external functions and variables, we always have a declaration in an appropriate header file in the "Include" directory, which uses the PyAPI_FUNC() macro, like this:
PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject );
'''
but when i check python 3.7.12+ and python 2.7.13, external variables actually uses the PyAPI_DATA() macro, like this:
'''
PyAPI_DATA(PyTypeObject) PySuper_Type; /
built-in 'super' */
'''
I wondered whether my error or the document error.
bobozi.

naive kindleBOT
#

The GIL has been a widely discussed topic in the Python community. It's has it's advantages and disadvantages.
I was suggesting that an official way be placed in the Python threading module to release the GIL if one needs to perform some tasks that don't need the GIL.

It could be something as simple as

thd = threading.Thread(target = encrypt, nogil = True)

I saw a nogil option in Cython, I just thought it would be great to have it fully support in Python as we await the results from Sam Gross's paper.

naive kindleBOT
#

ACTIVITY SUMMARY (2021-11-26 - 2021-12-03)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7252 (-14)
closed 50449 (+82)
total 57701 (+68)

Open issues with patches: 2884

Issues opened (47)

#44530: Propagate qualname from the compiler unit to code objects for
https://bugs.python.org/issue44530 reopened by steve.dower

#45813: Importing asyncio after deleting a coroutine object and before
https://bugs.python.org/issue45813 reopened by Dennis Sweeney

#45906: Python github installation issue
https://bugs.python.org/issue45906 opened by mazen001.ahmed001

#45909: sysconfig --generate-posix-vars creates wrong file when cross
https://bugs.python.org/issue45909 opened by christian.heimes

#45910: mailbox should support options for calling email parser
https://bugs.python.org/issue45910 opened by bpoaugust

#45913: readl... continue reading

naive kindleBOT
#

A woefully incomplete review of default argument evaluation in other
languages. Updates and corrections are welcome.

Out of 22 languages apart from Python:

  • 3 use early binding (default is evaluated at compile or function
    definition time);

  • 12 use late binding (default is evaluated at call time);

  • 1 simulates late binding with a standard idiom;

  • and 6 do not support default arguments.

Note that R's model for defaults in particularly interesting.

Early binding

PHP:

function f($arg = const) {body}

PHP default arguments must be constant expressions, not variables or
function calls. I infer from this that they are evaluated at function
definition time (compile time?).

https://www.php.net/manual/en/functions.arguments.php#functions.arguments.default

Dart:

f({arg=const}) {body}

Dart default values appear to be restricted to constants, by which I
infer that they are evaluated at compile-time.

Visual Basic:

Sub F(Optional arg As Type... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/P5JAIGZEI4PXR2TYS5ELB6TN4JVLUNL7/)
naive kindleBOT
#

Hi,

The "master" branch of the following Python GitHub repositories have
been renamed to "main":

  • devguide
  • peps
  • voters

For the rationale of the rename, see:
https://sfconservancy.org/news/2020/jun/23/gitbranchname/

If you already have a Git checkout of one of these repositories, you
can rename your local master branch with these commands (where "orign"
is the github.com/python/... remote):

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a

Tell me if you have any issue with the branch rename.

Thanks Brett, Ee, Mariatta and the Steering Council who helped to
rename these branches ;-)

Victor

Night gathers, and now my watch begins. It shall not end until my death.

naive kindleBOT
#

A new library called pagesign (Python-age-sign) has been released on PyPI [1].
It covers similar functionality to python-gnupg, but uses the modern encryption tool
age [2] and the modern signing tool minisign [3]. The initial release allows you to:

  • Create and manage identities (which are containers for the keys used for
      encryption/decryption and signing/verification).
  • Encrypt and decrypt files to multiple recipients.
  • Sign files and verify signatures.

This release has been signed with my code signing key:

Vinay Sajip (CODE SIGNING KEY) <vinay_sajip at yahoo.co.uk>
Fingerprint: CA74 9061 914E AC13 8E66 EADB 9147 B477 339A 9B86

Recent changes to PyPI don't show the GPG signature with the download links.
An alternative download source where the signatures are available is at [4].
Documentation is available at [5].

As always, your feedback is most welcome (especially bug reports [6],
patches and suggestions for improvement, or any other points).

Enjoy!

Cheers

Vinay Sajip

[... continue reading

naive kindleBOT
naive kindleBOT
#

Lea 3.4.1 is now released!
---> https://pypi.org/project/lea/

What is Lea?

Lea is a Python module for playing with discrete probability distributions
in an intuitive way.
This ranges from simple dice, coin flipping, random sampling . to Bayesian
networks, Probabilistic Programming (PP), machine learning and symbolic
computation.
One salient feature of Lea is the ability to change the probability
representation, viz. float, fractions, decimals, and symbols.
Lea can be used for education, AI, PP, etc. Comprehensive tutorials are
available online (see Wiki pages).
For a 5 minutes tour, check out the poster presented at PROBPROG2020
conference:
https://probprog.cc/2020/assets/posters/fri/69.pdf

What's new in Lea 3.4.1?

  1. Reading BIF files (Bayesian Interchange Format):
    https://bitbucket.org/piedenis/lea/wiki/Lea3\_Tutorial\_2
  2. Misc corrections on Markov chain advanced functions (repair
    dependencies):
    https://bitbucket.org/piedenis/lea/issues/63/
    3... continue reading
#

Hi Petr,

In PEP 384 it is written that no functions starting with an underscore are
part of the stable ABI:

PEP 384 -- Defining a Stable ABI | Python.org
https://www.python.org/dev/peps/pep-0384/#excluded-functions

All functions starting with _Py are not available to applications

OTOH there's a data file in the repo, Misc/stabe_abi.txt, which lists many
functions starting with _Py_, for example _PyObject_GC_Malloc. Then again,
that function is not listed in Doc/data/stable_abi.dat. (I didn't check
other functions, but maybe there are others.)

So is Misc/stable_abi.txt just out of date? Or how can the discrepancy be
explained?

--
--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/

naive kindleBOT
#

TatSu 5.7.0 is now available.

竜 TatSu is a tool that takes grammars in a variation of EBNF as input, and
outputs memoizing (Packrat) PEG parsers in Python.

竜 TatSu can compile a grammar stored in a string into a
tatsu.grammars.Grammar object that can be used to parse any given input,
much like the re module does with regular expressions, or it can generate
a Python module that implements the parser.

竜 TatSu supports left-recursive rules in PEG grammars using the algorithm
by Laurent and Mens. The generated AST has the expected left associativity.

CHANGELOG:

  • Now config: ParserConfig is used in \_\_init\_\_() and parse()
    methods of contexts.ParseContext, grammars.Grammar, and elsewhere
    to avoid long parameter lists. ``ParserConfig` also provides clean and
    clear ways of overriding a group of settings
  • All... continue reading
naive kindleBOT
#

I hope you like bug fixes, because we have a whole shipment of them! Python
3.10.1 is the first maintenance release of Python 3.10 as we have packed
more than 330 commits of fixes and general improvements. You can get it
here:

https://www.python.org/downloads/release/python-3101/

This is the first maintenance release of Python 3.10

Python 3.10.1 is the newest major release of the Python programming
language, and it contains many new features and optimizations.

Major new features of the 3.10 series, compared to 3.9

Among the new major new features and changes so far:

  • PEP 623 -- Deprecate and
    prepare for the removal of the wstr member in PyUnicodeObject.
  • PEP 604 -- Allow writing
    union types as X | Y
  • PEP 612 -- Parameter
    Specification Variables
  • PEP 626 -- Precise line
    nu... continue reading
#

I hope you like bug fixes, because we have a whole shipment of them! Python
3.10.1 is the first maintenance release of Python 3.10 as we have packed
more than 330 commits of fixes and general improvements. You can get it
here:

https://www.python.org/downloads/release/python-3101/

This is the first maintenance release of Python 3.10

Python 3.10.1 is the newest major release of the Python programming
language, and it contains many new features and optimizations.

Major new features of the 3.10 series, compared to 3.9

Among the new major new features and changes so far:

  • PEP 623 -- Deprecate and
    prepare for the removal of the wstr member in PyUnicodeObject.
  • PEP 604 -- Allow writing
    union types as X | Y
  • PEP 612 -- Parameter
    Specification Variables
  • PEP 626 -- Precise line
    numbers for debugging and... continue reading
naive kindleBOT
#

The pytest team is proud to announce the 7.0.0rc1 prerelease!

This is a prerelease, not intended for production use, but to test the upcoming features and improvements
in order to catch any major problems before the final version is released to the major public.

We appreciate your help testing this out before the final release, making sure to report any
regressions to our issue tracker:

https://github.com/pytest-dev/pytest/issues

When doing so, please include the string [prerelease] in the title.

You can upgrade from PyPI via:

pip install pytest==7.0.0rc1

Users are encouraged to take a look at the CHANGELOG carefully:

https://docs.pytest.org/en/7.0.x/changelog.html

Thanks to all the contributors to this release:

  • Adam J. Stewart
  • Alexander King
  • Amin Alaee
  • Andrew Neitsch
  • Anthony Sottile
  • Ben Davies
  • Bernát Gábor
  • Brian Okken
  • Bruno Oliveira
  • Cristian Vera
  • David Szotten
  • Eddie
  • Emmanuel Arias
  • Emmanuel Meric de Bellefon
  • Eric Liu
  • Florian Bruhin
    ... continue reading
naive kindleBOT
#

Hi,

I would like to announce latest PEP, PEP 669: Low Impact Monitoring for CPython.

The aim of this PEP is to provide an API for profilers, debuggers and other tools to avoid the punitive overhead of using sys.settrace.

If you have any interest in profilers, debuggers, coverage tools or anything of that ilk, then do please take a look.

There is no change to the language and it adds 7 functions to the sys module, so shouldn't be too intrusive for those of who aren't planning on implementing any of those tools.

As always, all feedback and comments are welcome.

You can read the PEP here:
https://python.github.io/peps/pep-0669/

Cheers,
Mark.

naive kindleBOT
#

The Python community has a 5 year plan to push the limit of speed in Python. One of the things that reduces Python execution speed is calling methods or functions that are not in the nearest scope.

My suggestion is to introduce inline functions just as they are in C. They can be defined as global functions or class methods but are created in the scope of the function that is calling it at parsetime. I also don’t think it’ll be hard to adapt. inline functions might look something like:

inline def func():
pass

inline async def func():
pass

inline class Executor:
inline def func():
pass

For an inline method, the class must be defined as inline as well, in order to bring to scope whatever class variable or method that the inline function might rely on.

This is just a suggestion, what do you guys think about it.

naive kindleBOT
#

Steering Council, g'day, Hawaii?

("copying" BDFL-emeritus, everyone)

I'm sorry you haven't heard from me in a while. Actually, neither have any
of my other "girl friends" heard from me. I was worried that they might be
sad. Then I found out that one of them was at some kind of party at a club
or something, and got in trouble because she couldn't be reached. I learned
from the newspaper and other media that she indeed was really really sad,
because of this reason.

Yesterday was supposed to be a big day for her, as the president was
throwing a party. But something was missing – because of COVID-19, i
believe. So various kinds of things have been going on, about which I
wasn't sure if i could tell you ;)

Anyway, I really needed to wrap something for her yesterday, but another
day has passed. And that is because of me.

In Finland, we have this thing "me", but it means "we". Then we also have
"hän", which means "he"/"she" etc. But using "hän" may feel needlessly
formal, so we often i... continue reading

naive kindleBOT
#

A few weeks ago, I proposed on this mailing list to write docstrings for
class attributes like this:

@dataclass
class A:
x: int
"""Docstring for x."""

The main criticism, I think, was that it is weird to have the docstring
below the attribute.

To solve this problem, I propose to introduce a new kind of string: a
d-string ('d' for 'docstring'; alternatively also 'v' because it looks a
bit like a downward arrow, or 'a' for 'attribute docstring'). A d-string
is a normal string, except that it is stored in __attrdoc__ when used
inside a class. It is stored with the name of the variable below
it as the key.

Examples:

@dataclass
class InventoryItem:
"""Class for keeping track of an item in inventory."""

d"""Short name of the item."""
name: str
d"""Price per unit in dollar."""
unit\_price: float
d"""Available quantity currently in the warehouse."""
quantity\_on\_hand: int = 0

InventoryItem.__attrdoc__ == {
"name": "Short name of ... continue reading

naive kindleBOT
#

Hi everyone,

I’m happy to announce the release of argon2-cffi 21.2.0!

With more than 13 million downloads per month, argon2-cffi is the most popular package for using the competition-winning Argon2 password hash in Python.

If you want more details on Argon2 and why it matters, check out my blog post Storing Passwords in a Highly Parallelized World https://hynek.me/articles/storing-passwords/.

Heartfelt thanks go to my generous GitHub sponsors https://github.com/sponsors/hynek, companies subscribing on Tidelift https://tidelift.com/subscription/pkg/pypi-argon2-cffi (currently nobody :( – tell your boss!), and people who bought me a coffee on https://ko-fi.com/the\_hynek!

Support like that makes me work on FOSS on a Sunday afternoon, so please consider supporting me too: https://hynek.me/say-thanks/! <3

RELEASE HIGHLIGHTS

  • Pre-compiled wheels for most relevant platforms (yes, including ARM!)
  • Full type hints.
  • Adjusted defaults to RFC 9106 and support to pre-configured ... continue reading
#

Hi all,

It fills us with astronomical joy to announce the release of poliastro
0.16.0! 🚀

poliastro is an open source (MIT) pure Python library for interactive
Astrodynamics and Orbital Mechanics, with a focus on ease of use, speed,
and quick visualization. It provides a simple and intuitive API, and
handles physical quantities with units. It is used in academia and the
industry by people from all around the world.

You can install it using pip or conda:

pip install poliastro
conda install poliastro --channel conda-forge

This release shipped numerous new APIs and performance improvements.
Yash, our Google Summer of Code 2021 student,  added a number of event
detectors for numerical propagation, and several contributors helped
accelerate more parts of the code, which should result in significant
speedups for most workflows. In addition, we have new community-
contributed scripts for relative orbits and mean elements computations.

You can read the full release ... continue reading

naive kindleBOT
#

I've recently released version 0.3.4 of distlib on PyPI [1]. For newcomers,
distlib is a library of packaging functionality which is intended to be
usable as the basis for third-party packaging tools.

The main changes in this release are as follows:

  • Fixed #153: Raise warnings in get_distributions() if bad metadata seen, but keep
      going.

  • Fixed #154: Determine Python versions correctly for Python >= 3.10.

  • Updated launcher executables with changes to handle duplication logic.

Code relating to support for Python 2.6 was also removed (support for Python 2.6 was
dropped in an earlier release, but supporting code wasn't removed until now).

A more detailed change log is available at [2].

Please try it out, and if you find any problems or have any suggestions for improvements,
please give some feedback using the issue tracker! [3]

Regards,

Vinay Sajip

[1] https://pypi.org/project/distlib/0.3.4/
[2] https://distlib.readthedocs.io/en/0.3.4/
[3] https://bitbucket.org/pypa/distlib... continue reading

naive kindleBOT
#

You can tell that we are slowly getting closer to the first beta as the
number of release blockers that we need to fix on every release starts to
increase [image: :sweat_smile:] But we did it! Thanks to Steve Dower, Ned
Deily, Christian Heimes, Łukasz Langa and Mark Shannon that helped get
things ready for this release :)

Go get the new version here:

https://www.python.org/downloads/release/python-3110a3/

This is an early developer preview of Python 3.11

Major new features of the 3.11 series, compared to 3.10

Python 3.11 is still in development. This release, 3.11.0a3 is the third
of seven planned alpha releases.

Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.

During the alpha phase, features may be added up until the start of the
beta phase (2022-05-06) and, if necessary, may be modified or deleted up
until the release candidate phase (2022-08-01). Please keep in mind that
this is a ... continue reading

naive kindleBOT
#

You can tell that we are slowly getting closer to the first beta as the
number of release blockers that we need to fix on every release starts to
increase [image: :sweat_smile:] But we did it! Thanks to Steve Dower, Ned
Deily, Christian Heimes, Łukasz Langa and Mark Shannon that helped get
things ready for this release :)

Go get the new version here:

https://www.python.org/downloads/release/python-3110a3/

This is an early developer preview of Python 3.11

Major new features of the 3.11 series, compared to 3.10

Python 3.11 is still in development. This release, 3.11.0a3 is the third
of seven planned alpha releases.

Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.

During the alpha phase, features may be added up until the start of the
beta phase (2022-05-06) and, if necessary, may be modified or deleted up
until the release candidate phase (2022-08-01). Please keep i... continue reading

naive kindleBOT
#

I'm looking for some guidance on a bug report involving isinstance and
__getattribute__` please.

The issue is that if your class overloads \_\_getattribute\_\_, calling
isinstance on an instance will call the overloaded \_\_getattribute\_\_
method when looking up \_\_class\_\_, potentially causing isinstance to
fail, or return the wrong result.

See b.p.o. #32683

https://bugs.python.org/issue32683

I see no reason why this isn't working as designed, getattribute is
intended to overload attribute access, and that could include the
\_\_class\_\_ attribute. Am I wrong?

It has been suggested that isinstance should call object.\_\_getattribute\_\_
and bypass the class' overloaded method, but I expect that would
probably break objects which intentionally lie about their class.
(Mocks? Stubs? Proxies?)

Thanks,

Steve

naive kindleBOT
naive kindleBOT
#

(replying to https://mail.python.org/archives/list/python-dev@python.org/message/OJ65FPCJ2NVUFNZDXVNK5DU3R3JGLL3J/)

On Wed, Dec 8, 2021 at 10:06 AM Eric Snow ericsnowcurrently@gmail.com wrote:

What about the various symbols listed in Misc/stable_abi.txt that were
accidentally added to the limited API? Can we move toward dropping
them from the stable ABI?

tl;dr We should consider making classifications related to the stable
ABI harder to miss.

<context>

Knowing what is in the limited API is fairly straightforward. [1]
However, it's clear that identifying what is part of the stable ABI,
and why, is not so easy. Currently, we must rely on
Misc/stable_abi.txt [2] (and the associated
Tools/scripts/stable_abi.py). Documentation (C-API docs, PEPs,
devguide) help too.

Yet, there's a concrete disconnect here: the header files are by
definition the authoritative single-source-of-truth for the C-API and
it's too easy to forget about supplemental info in another file or
document... continue reading

naive kindleBOT
#

Hi, I would like to hear the opinion of Python's community on enforcing
types in the future for the language. I've been using Python as my main
language for everything for around 10 years, until I started moving to Rust
2 years ago; one of the main factors was types.

Just before moving to Rust I started to use mypy heavily, which I liked a
lot and uncovered tons of potential problems. Now (2 years later), it seems
the situation hasn't changed much; I might be wrong, so let me know what
improvements you think landed in this area in the last 2-3 years.

I feel it's possible this topic might cause a lot of passionate answers,
but I just want to hear honest opinions on this.

I firmly believe that Python's future would be better if types were
enforced by default at "compile time" (whatever this means in Python), with
an option/flag to disable this, and integrate MyPy or similar into the
interpreter. I'm fully aware that a transition like this would be very hard
and long, but I don't think... continue reading

naive kindleBOT
#

Title: Python standard library TOML module

Hello everyone,

ITT I propose the idea of a TOML module in the standard library for general TOML operations.

The main motivator of this is the growing adoption of PEP 517. Recently I've been following its developments and I've noticed some situations that could make things a bit harder at the moment of working with build systems based on it. Namely I saw that dependency problems like cycles or complicated dependency graphs.

For instance, we have a build system module that depends on a TOML module and the latter depends on the former or on another build system, leading to square one. Chicken and egg scenarios could also be conceived as a consequence of not having an included TOML module for operations with the pyproject.toml file.

The inclusion of a TOML module in the standard library can solve this kind of scenarios by providing an API for TOML deserialization and serialization.

I also propose that the module API can modeled around the e... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2021-12-03 - 2021-12-10)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7195 (-57)
closed 50572 (+123)
total 57767 (+66)

Open issues with patches: 2859

Issues opened (44)

#23469: Delete Misc/*.wpr files
https://bugs.python.org/issue23469 reopened by berker.peksag

#28533: Remove asyncore, asynchat and smtpd modules
https://bugs.python.org/issue28533 reopened by vstinner

#31184: Fix data descriptor detection in inspect.getattr_static
https://bugs.python.org/issue31184 reopened by davidhalter

#45620: A misleading url in 'Floating Point Arithmetic' page
https://bugs.python.org/issue45620 reopened by eric.smith

#45798: Move _decimal build setup into configure
https://bugs.python.org/issue45798 reopened by ned.deily

#45975: Simplify some while-loops with walrus operator
https://bugs.python.org/i... continue reading

naive kindleBOT
#

A former core dev who works at Google just passed the news that Fredrik
Lundh (also known as Effbot) has died.

Fredrik was an early Python contributor (e.g. Elementtree and the 're'
module) and his enthusiasm for the language and community were inspiring
for all who encountered him or his work. He spent countless hours on
comp.lang.python answering questions from newbies and advanced users alike.

He also co-founded an early Python startup, Secret Labs AB, which among
other software released an IDE named PythonWorks. Fredrik also created the
Python Imaging Library (PIL) which is still THE way to interact with images
in Python, now most often through its Pillow fork. His effbot.org site was
a valuable resource for generations of Python users, especially its Tkinter
documentation.

Fredrik's private Facebook page contains the following message from
November 25 by Ylva Larensson (translated from Swedish):

"""

It is with such sorrow and pain that I write this. Fredrik has left us
sudden... continue reading

naive kindleBOT
#

Hi everyone,

This is another maintenance release to further modernize our install script
for
distributions that do not include setuptools by default. Thanks to
Antonio
Valentino for the changes.

Project documentation is available at:

http://numexpr.readthedocs.io/

Changes from 2.8.0 to 2.8.1

  • Fixed dependency list.
  • Added pyproject.toml and modernize the setup.py script. Thanks to
    Antonio Valentino for the PR.

What's Numexpr?

Numexpr is a fast numerical expression evaluator for NumPy. With it,
expressions that operate on arrays (like "3a+4b") are accelerated
and use less memory than doing the same calculation in Python.

It has multi-threaded capabilities, as well as support for Intel's
MKL (Math Kernel Library), which allows an extremely fast evaluation
of transcendental functions (sin, cos, tan, exp, log...) while
squeezing the last drop of performance out of your multi-core
processors. ... continue reading

naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.22.0rc1. NumPy 1.22.0rc1 is a big release featuring the work of 151
contributers spread over 589 pull requests. There have been many
improvements,
highlights are:

  • Annotations of the main namespace are essentially complete. Upstream
    is a moving target, so there will likely be further improvements, but the
    major work is done. This is probably the most user visible enhancement in
    this release.
  • A preliminary version of the proposed Array-API is provided. This is a
    step in creating a standard collection of functions that can be used across
    applications such as CuPy and JAX.
  • NumPy now has a DLPack backend. DLPack provides a common interchange
    format for array (tensor) data.
  • New methods for quantile, percentile, and related functions.
    Thenew methods provide a complete set of the methods commonly found in the
    literature.
  • A new configurab... continue reading
naive kindleBOT
#

TL;DR: it is hard, but not impossible, to set function __globals__
dunder to a ChainMap. Let's make it easier!

Background:

(1) Comprehensions skip class scope, leading to bug reports like these:

https://bugs.python.org/issue3692
https://bugs.python.org/issue26951

Note Guido's comment in the first:

"perhaps __globals__ could be set to a chainmap referencing the class
dict and the globals?"

(2) I want to experiment with namespaces, similar to the C++ feature.
The details don't matter, but one way I can do that experiment is to use
a class and ChainMap.

So let's try an experiment: set up a namespace using ChainMap, and try
to monkey-patch a function to use it instead of the regular globals.

Here is my setup code:

def func():
return (a, b, c)

a = b = c = "global"
from collections import ChainMap
ns = ChainMap({'a': 'CM-0'}, {'b': 'CM-1'}, globals())

Let's see what it takes to set func.__globals__ to ns.

Attempt 1: set __globals__ directly.

func._... continue reading

naive kindleBOT
#

Hello good morning.

I've decided to open a discussion of a topic that I consider should be part of dataclasses, but not sure how suggestions work and many threads recommend to check python dev first so-.

Anyways, at the moment that I write this message in python3.10.1, It happens that when making a class with the dataclasses module, this class can't actually be used in Multiple inheritance for Enum purposes, this is mostly to avoid code repetition by having to write the methods over again.

Here's an example

from dataclasses import dataclass
from enum import Enum

@dataclass
class Foo:
a: int = 0

class Entries(Foo, Enum):
ENTRY1 = Foo(1)
ENTRY2 = Foo(2)
ENTRY3 = Foo(3)

assert Entries.ENTRY1.a == 1

This raises AssertionError, due to the values not being defined at that point, as the class is currently just using the default paremeters. This is why I think it'd be essential to implement __set__ in the module.

Currently there's a workaround to have this work, w... continue reading

naive kindleBOT
#

Wing 8.1.2 improves debug stepping & exception handling in async
coroutines & generators, correctly detects package manager type on
remote hosts, fixes several issues with debugging, analysis & project
creation for Django, improves analysis of union type hints, and makes a
number of other improvements.

Details: https://wingware.com/news/2021-12-13
Downloads: https://wingware.com/downloads

== About Wing ==

Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing's deep code analysis provides
auto-completion, auto-editing, and refactoring that speed up
development. Its top notch debugger works with any Python code, locally
or on a remote host, container, or cluster. Wing also supports
test-driven development, version control, UI color and layout
customization, and includes extensive documentation and support.

Wing is available in three product ... continue reading

naive kindleBOT
#

Hi all,

I'm still hoping to land a per-interpreter GIL for 3.11. There is
still a decent amount of work to be done but little of it will require
solving any big problems:

  • pull remaining static globals into _PyRuntimeState and PyInterpreterState
  • minor updates to PEP 554
  • finish up the last couple pieces of the PEP 554 implementation
  • maybe publish a companion PEP about per-interpreter GIL

There are also a few decisions to be made. I'll open a couple of
other threads to get feedback on those. Here I'd like your thoughts
on the following:

Do we need a PEP about per-interpreter GIL?

I haven't thought there would be much value in such a PEP. There
doesn't seem to be any decision that needs to be made. At best the
PEP would be an explanation of the project, where:

  • the objective has gotten a lot of support (and we're working on
    addressing the concerns of the few objectors)
  • most of the required work is worth doing regardless (e.g. improve
    runtime init/fini, eliminate ... continue reading
#

Hi,

I'm not familiar with the Python release process, but looking at the latest release

https://www.python.org/downloads/release/python-3101/

we can see MD5 is still used ... which doesn't sound right in 2021 ...
especially since we proved it's possible to build different .tar.gz that have
the same MD5

https://twitter.com/ydroneaud/status/1448659749604446211
https://twitter.com/angealbertini/status/1449736035110461443

You would reply there's OpenPGP / GnuPG signature. But then I would like to raise
another issue regarding the release process:

As the announcement on comp.lang.python.announce /python-announce-list@python.org
doesn't record the release digest / release signature, the operator behind
https://www.python.org/downloads/release/python-3101/ are free to change the release
content at any time, provided there's a valid signature. And there will no way for
us to check the release wasn't modified after the announcement.

It would be great ifhttps://www.... continue reading

naive kindleBOT
#

One of the open questions relative to subinterpreters is: how to
reduce the amount of work required for extension modules to support
them? Thanks to Petr Viktorin for a lot of work he's done in this
area (e.g. PEP 489)! Extensions also have the option to opt out of
subinterpreter support.

However, that's only one part of the story. A while back Nathaniel
expressed concerns with how making subinterpreters more accessible
will have a negative side effect affecting projects that publish large
extensions, e.g. numpy. Not all extensions support subinterpreters
due to global state (incl. in library dependencies). The amount of
work to get there may be large. As subinterpreters increase in usage
in the community, so will demand increase for subinterpreter support
in those extensions. Consequently, such projects be pressured to do
the extra work (which is made even more stressful by the short-handed
nature of most open source projects) .

So we (the core devs) would effectively be requ... continue reading

naive kindleBOT
#

Most of the work toward interpreter isolation and a per-interpreter
GIL involves moving static global variables to _PyRuntimeState or
PyInterpreterState (or module state). Through the effort of quite a
few people, we've made good progress. However, many globals still
remain, with the majority being objects and most of those being static
strings (e.g. _Py_Identifier), static types (incl. exceptions), and
singletons.

On top of that, a number of those objects are exposed in the public
C-API and even in the limited API. :( Dealing with this specifically
is probably the trickiest thing I've had to work through in this
project.

There is one solution that would help both of the above in a nice way:
"immortal" objects.

The idea of objects that never get deallocated isn't new and has been
explored here several times. Not that long ago I tried it out by
setting the refcount really high. That worked. Around the same time
Eddie Elizondo at Facebook did something similar but modified
Py... continue reading

naive kindleBOT
#

PyCA cryptography 36.0.1 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.

Changelog (https://cryptography.io/en/latest/changelog/#v36-0-1):

  • Updated Windows, macOS, and Linux wheels to be compiled with OpenSSL 1.1.1m.

-Paul Kehrer (reaperhulk)

naive kindleBOT
#

Hello,

The idea is to add 3 functions to get "config", "data" and "cache" directories that are commonly used to store application files in user home / system.

This look very straightforward to get theses directories path, but in practices it depends on many factors like OS, environnement variables, user or system dir.

For instance, with the "config" directory:

  • Linux, user: os.path.join(os.getenv("XDG_CONFIG_HOME", os.path.expanduser("~/.config")), app_name)
  • Linux, system: os.path.join("/etc", app_name)
  • Windows, user: os.path.join(os.path.expandvars("%APPDATA%"), app_name)
  • Windows, system: os.path.join(os.path.expandvars("%CSIDL_COMMON_APPDATA%"), app_name)

For linux, the full spec is here: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

I see many applications that just use "~/.app_name" to not have to handle theses cases.

The functions prototypes may look like and may be added to "shutil" (or "os.path" ?):

def getcachedir(app_name... continue reading

naive kindleBOT
#

Hi,

One option to solve the https://bugs.python.org/issue40601 "[C API]
Hide static types from the limited C API" issue without breaking the
backward compatibility is to leave the C API and the stable ABI as
they are for the main interpreter (static types), but force
subinterpreters running in parallel to use their own heap types. It
means that subinterpreters would be able to use the main interpreter
GIL or own their GIL. By default, the GIL would still be shared.

C extensions using "&PyLongType" (static type) would continue to work
in the main interpreter.

C extensions which want to opt-in for running subinterpreters in
parallel would not access to "&PyLong_Type" but be forced to call
PyLong_GetType() (heap type).

Internally, Python should be modified to replace "&PyLongType" with
PyLong_GetType(). So the code would work with static types and heap
types.

It also means that a subinterpreter running in parallel would only be
able to import C extensions built with explicit suppo... continue reading

naive kindleBOT
#

Hello all,

Thanks everyone for comments on our earlier thread [1] about callable type syntax. We now have a draft PEP [2] proposing an arrow-based syntax for callable types, for example:

(int, str) -> bool     # equivalent to Callable[[int, str], bool]

In support of the PEP we also have:

  • a reference implementation of the parser [3] to ensure the grammar is correct (tests [5], [6], [7])
  • a detailed specification of planned runtime behavior [4], which is not yet in the reference implementation

We'd like to get your feedback about the PEP in general, and especially details and edge cases we need to consider regarding runtime behavior.

Cheers,
Steven Troxler


[1] Earlier python-dev thread https://mail.python.org/archives/list/python-dev@python.org/thread/VBHJOS3LOXGVU6I4FABM6DKHH65GGCUB/
[2] PEP 677: https://www.python.org/dev/peps/pep-0677/
[3] Reference implementation of Parser: https://github.com/stroxler/cpython/tree/callable-type-syntax--shorthand
[4] Detai... continue reading

naive kindleBOT
#

Hi,

I am wondering if it would be good to add an additional keyword seed to the builtin function hash to allow us to set arbitrary seed to ensure reproducible results.
As far as I know, there exists already the environment variable PYTHONHASHSEED that allows us to set arbitrary seed or disable the seed globally for the python interpreter.
However, it looks like that it would be too bold to use that environment variable to change the default behavior because the random seed generation helps improve the security my reducing the risk of hash flooding.

In parallel, we have identified a couple of real use cases that require that an arbitrary seed is used for a limited scope.
For instance, if we create a caching programming interface that relies on a distributed kv store, it would be very important to make sure that the hash key stays the same when the application is rebooted or replicated. It is generally more cautious to use the above capability to limit the scope to the caching libr... continue reading

naive kindleBOT
#

I am delighted to announce the release 3.2.0 of Austin. If you haven't heard of Austin before, it is an open-source frame stack sampler for CPython, distributed under the GPLv3 license. It can be used to obtain statistical profiling data out of a running Python application without a single line of instrumentation. This means that you can start profiling a Python application straight away, even while it's running in a production environment, with minimal impact on performance.

https://github.com/P403n1x87/austin

The best way to leverage Austin is to use the new extension for VS Code, which brings interactive flame graphs straight into the text editor to allow you to quickly jump to the source code with a simple click. You can find the extension on the Visual Studio Marketplace and install it directly from VS Code:

https://marketplace.visualstudio.com/items?itemName=p403n1x87.austin-vscode

To see how to make the best of Austin with VS Code to find and fix performance issues, check ou... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2021-12-10 - 2021-12-17)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7180 (-15)
closed 50665 (+93)
total 57845 (+78)

Open issues with patches: 2857

Issues opened (56)

#20741: Documentation archives should be available also in tar.xz form
https://bugs.python.org/issue20741 reopened by iritkatriel

#23522: Misleading note in Statistics module documentation
https://bugs.python.org/issue23522 reopened by gvanrossum

#29221: ABC Recursion Error on isinstance() with less than recursion l
https://bugs.python.org/issue29221 reopened by serhiy.storchaka

#43749: venv module does not copy the correct python exe
https://bugs.python.org/issue43749 reopened by eryksun

#44413: OverflowError: mktime argument out of range after 2019
https://bugs.python.org/issue44413 reopened by andrei.avk

#46044: Update di... continue reading

naive kindleBOT
#

In the following situations:

class Data(object):
@staticmethod
@property
def imagesTotal():
return 10

print(Data.imagesTotal)

The "print(Data.imagesTotal)" can't print "10", it print "<property object at 0x...>".

It might be a good idea to use "@staticproperty" to solve this problem.
"@staticproperty" is a decorators, it mix the @staticmethod and @property.
Then the static property has getter and setter.

naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.22.0rc3. NumPy 1.22.0rc3 is a big release featuring the work of 152
contributors spread over 602 pull requests. There have been many
improvements,
highlights are:

  • Annotations of the main namespace are essentially complete. Upstream
    is a moving target, so there will likely be further improvements, but the
    major work is done. This is probably the most user visible enhancement in
    this release.
  • A preliminary version of the proposed Array-API is provided. This is a
    step in creating a standard collection of functions that can be used across
    applications such as CuPy and JAX.
  • NumPy now has a DLPack backend. DLPack provides a common interchange
    format for array (tensor) data.
  • New methods for quantile, percentile, and related functions.
    Thenew methods provide a complete set of the methods commonly found in the
    literature.
  • A new configurab... continue reading
naive kindleBOT
#

The output of "python -h" is 104 lines long now. It was only 51 lines in
3.6. 35% of it is about the -X option, and 30% about environment
variables. Also some lines in the -X option description are too long
(102 columns). Both topics are "advanced" and mostly interested for
debugging. I suggest to move them out of the main help output.

The are two options:

  1. Move it to pydoc topics. The advantage is that it is a standard way,
    there are already 88 topics. The disadvantage is that this information
    will be not available in "minimal" installations of Python which do not
    include docs.

  2. Add command-line options like -hX and -henv. The information will
    always be available with the interpreter, but the interface is special.

naive kindleBOT
#

Hello,

Being a programmer myself I realise that a report on performance degradation should ideally contain a small test program that clearly reproduces the problem. However, unfortunately, I do not have the time at present to isolate the issue to a small test case. But the good news (or bad news, I suppose) is that the problem appears to be reasonably general, namely it happens with two completely different programs.

Anyway, what I am claiming is that Python 3.10 is between 1.5 and 2.5 times SLOWER than Python 3.8, for rather generic scientific calculations such as Fourier analysis, ODE solving and plotting. On the one hand, the "test case" is a rather complex program that calculates Wigner function of a quantum system and the result is 9 seconds when run with 3.8 and 23 seconds when run with 3.10 (very easy to reproduce: just clone this repository: https://github.com/tigran123/quantum-infodynamics and run "time bin/harmonic-oscillator-solve.sh" from the dynamics subdirectory and the... continue reading

naive kindleBOT
#

Hi All,

On behalf of the NumPy team I am pleased to announce the release of NumPy
1.21.5. NumPy 1.21.5 is a maintenance release that fixes a few bugs
discovered after the 1.21.4 release and does some maintenance to extend the
1.21.x lifetime. The Python versions supported in this release are
3.7-3.10. If you want to compile your own version using gcc-11, you will
need to use gcc-11.2+ to avoid problems.

The Python versions supported in this release are 3.7-3.10. If you want to
compile your own version using gcc-11 you will need to use gcc-11.2+ to
avoid problems. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.21.5/; source archives, release notes,
and wheel hashes are available on Github
https://github.com/numpy/numpy/releases/tag/v1.21.5. Linux users will
need pip >= 0.19.3 in order to install manylinux2010 and manylinux2014
wheels. A recent version of pip is needed to install the universal2
macos wheels.

Contributors

A total of 7 pe... continue reading

naive kindleBOT
#

Hi there

I hope you would indulge me in asking for some details about the new
CFrame structure, even in the form of existing literature (e.g. PEP)
where the idea behind it is explained.

Also, I'd like to a quick question, if I may. There now appear to be
two ways of unwinding the frame stack: either iterate over
CFrame.previous, or the more traditional PyFrameObject.f_back. I
suspect there are reasons why these are perhaps not actually
equivalent, and indeed this is mainly what I'd like to read in the
literature I've requested above.

Cheers,
Gabriele

--
"Egli è scritto in lingua matematica, e i caratteri son triangoli,
cerchi, ed altre figure
geometriche, senza i quali mezzi è impossibile a intenderne umanamente parola;
senza questi è un aggirarsi vanamente per un oscuro laberinto."

-- G. Galilei, Il saggiatore.

naive kindleBOT
#

Hello,

We've done a comparative benchmark (speed and memory usage) with Smil and Scikit-Image.

Smil is a mathematical morphology dedicated library of functions. So comparisons are done only on this area.

We've been working on Mathematical Morphology for more than 50 years now the discipline was created here at our research
department in the sixties. Smil inherits the experience of previous libraries and software we've been writing since the
70's.

In just some few words, Smil can be orders of magnitude faster than Scikit-image (hundreds or even thousands) on some
operations thanks to parallelization and vectorization (SIMD), depending on the computer architecture.

Smil doesn't replace scikit-image but may be a good complement to scikit-image when speed is important.

Benchmark results are available at :
https://smil.cmm.minesparis.psl.eu/smil-vs-skimage

Smil web site is here :
https://smil.cmm.minesparis.psl.eu

Comments are welcome,

Best regards

José-Marcio

--... continue reading

naive kindleBOT
#

Good evening everyone I used python 3.7.3 IDLE i found the bug to solve the problem when list contain repetitive value is come i.e. if i want to delete 2 from list using remove function it's 2 value put containouls 2 and such value is remove using any type of loop all element are not delete from list. Any higher version cover such type of problem? or any other method for delete such value
list1=[1,2,3,2,4,2,7,2,2,2,2,5,5,5,2,4,5,6,7,8]
a=0
while a < len(list1):
if list1[a]==2:
list1.remove(2)
a=a+1
print(list1)

naive kindleBOT
#

I expect some sort of "there's no benefit in this, just write the current implementation", indirectly or directly.
Currently, this is the way to remove num occurrences of an element from a list:

idx = 0
while idx < len(the_list) and num:
if the_list[idx] == element_to_remove:
del the_list[idx]
num -= 1
else:
idx += 1
With a count argument to list.remove, this is how it would be done:
the_list.remove(element_to_remove, count=num)
(Doesn't necessarily have to be a keyword argument)
Is this a good idea?

naive kindleBOT
#

Hello

In thread about PEP 677, I (with the help of another proposal) came up with an alternative to typing.Callable called function prototypes. The basic concept is to create a function prototype object when the body of a function is omitted.

The thread can be found here: https://mail.python.org/archives/list/python-dev@python.org/thread/OGACYN2X7RX2GHAUP2AKRPT6DP432VCN/

Mark Shannon initially proposed that functions be used as types and provided this example:

@Callable
def IntToIntFunc(a:int)->int:
pass

def flat_map(
l: list[int],
func: IntToIntFunc
) -> list[int]:
....

I further proposed that we make the body of a function non-mandatory and create a function prototype if it is omitted. I provided these examples:

import typing

@typing.Callable
def IntToIntFunc(a: int) -> int

def flat_map(
l: list[int],
func: IntToIntFunc
) -> list[int]:
...

import ctypes

@ctypes.CFUNCTYPE
def f(x: int) -> bool

I have since taken it upon myself to implement... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2021-12-17 - 2021-12-24)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7196 (+16)
closed 50706 (+41)
total 57902 (+57)

Open issues with patches: 2866

Issues opened (37)

#44598: test_constructor (test.test_ssl.ContextTests) ... Fatal Python
https://bugs.python.org/issue44598 reopened by sxt1001

#46118: Migrate importlib.resources into a package
https://bugs.python.org/issue46118 opened by jaraco

#46119: Update bundled pip to 21.3.1 and setuptools to 59.7.0
https://bugs.python.org/issue46119 opened by kumaraditya303

#46120: Add note to typing.Union that it is recommended to use | i
https://bugs.python.org/issue46120 opened by sobolevn

#46121: Add a note to QueueListener documentation saying that SimpleQu
https://bugs.python.org/issue46121 opened by iamdbychkov

#46124: Deprecation warnin... continue reading

naive kindleBOT
#

Hello,

I’m happy to announce the release of pymssql 2.2.3, available to download
via pip and GitHub. Pymssql is a simple database interface for Python
that builds on top of FreeTDS to provide a Python DB-API (PEP-249)
interface to Microsoft SQL Server.
The official documentation is available at: https://pymssql.readthedocs.io
The sources, discussions and bug tracker: https://github.com/pymssql/pymssql.

Below please see the changes since last announcement.

Enjoy,
Mikhail

Version 2.2.3 - 2021-12-21 - Mikhail Terekhov

General

  • Build wheels for Python-3.10.
  • Use FreeTDS-1.3.4 for official wheels on PyPi.
  • Enable krb5 in Linux wheels (#734).
  • Fix UnicodeEncodeError for non-ascii database name (#484).
  • Fix pymssql.Binary (#504).
  • On macOS check for FreeTDS in homebrew prefix when building.
  • Some documentation changes.

Version 2.2.2 - 2021-07-24 - Mikhail Terekhov

General
-----... continue reading

naive kindleBOT
#

Hello,

Thank you all for attending PyCon India 2021 online.

The PyCon India 2021 online videos are available now.
Here is the playlist link for all videos:
https://www.youtube.com/playlist?list=PL6GW05BfqWIcKgvP3KsQKYsDm8tLJapVW

and Keynote playlist link:
https://www.youtube.com/playlist?list=PL6GW05BfqWIerlriJKq-o5aKB4luR3xkN

Keep watching, Happy Holidays and see you all in the next edition of
PyCon India :-)

Thanks,

Chandan Kumar

naive kindleBOT
#

Apologies if this is the wrong place to raise this (where is the right
place?) but over the last four days, I've received ten subscription
notices for python/issues-test-2 on Github.

Is anyone else also getting multiple subscription notices?

--
Steve

naive kindleBOT
#

On behalf of the Nikola team, I am pleased to announce the immediate
availability of Nikola v8.2.0. This release includes some new features
as well as a bunch of bugfixes.

What is Nikola?

Nikola is a static site and blog generator, written in Python.
It can use Mako and Jinja2 templates, and input in many popular markup
formats, such as reStructuredText and Markdown — and can even turn
Jupyter Notebooks into blog posts! It also supports image galleries,
and is multilingual. Nikola is flexible, and page builds are extremely
fast, courtesy of doit (which is rebuilding only what has been changed).

Find out more at the website: https://getnikola.com/

Downloads

Install using pip install Nikola.

Changes

Features

  • Add category\_titles, category\_descriptions, tag\_titles,
      tag\_descriptions to default context of tags page (Issue #3584)
  • Add Maori translation
  • Add Occitan translation
  • New ... continue reading
naive kindleBOT
#

Hi everyone,

I’m happy to announce the release of attrs 21.3.0: https://github.com/python-attrs/attrs/releases/tag/21.3.0

attrs is the direct ancestor of – and the inspiration for – dataclasses in the standard library and remains the more powerful toolkit for creating regular classes without getting bogged down with writing identical boilerplate again and again: https://www.attrs.org/

Heartfelt thanks go to my generous sponsors https://github.com/sponsors/hynek, companies subscribing on Tidelift https://tidelift.com/subscription/pkg/pypi-attrs, and people who bought me a coffee on https://ko-fi.com/the\_hynek! Support like that makes me work on FOSS on a Saturday afternoon! <3


This is a big release in the history of attrs and finishes an arc that took way too long and also delayed this very overdue release. But it's done: import attrs that has been talked about for years[1], but fell victim to “just... continue reading

naive kindleBOT
#

For various reasons you might want to know which Python versions are
“current”:

  • provide a list of pyXY targets to tox
  • remove a no longer supported version of Python from the .whl files
    you generate to upload to PyPI
  • determine which ‘Programming Language :: Python ::’ classifiers to
    include in your package information
  • check if you have the latest micro version of a Python installed on
    all of your servers

extracting this kind of information from various PEPs (that often have
slightly different formats), python.org and other web pages, is
cumbersome. This package both provides a commandline utility
python_release_info that you can use in scripts, makefiles, etc. and a
programmatic interface to get to release information.

The release information is retrieved from the internet and can be
updated e.g. only a daily basis, without having update the package
itself. A Python or shell script, can check if one or more new versions
are av... continue reading

naive kindleBOT
#

[re-posting this as the original was accidentally discarded]

Greetings lists,

I have started a newspaper (not newsletter) focused
on interesting reads on Python mailing lists. Don't tag
on the fact that holiday seasons are the worst times for
launch according to marketing folks, I started this to note
down interesting mails. This might also be a great way to
bring mailing list gems to a wider readership. So, here's
the url https://pyherald.com/

Kind Regards,

Abdur-Rahmaan Janhangeer
about | blog
github
Mauritius

naive kindleBOT
#

I am pleased to announce the release of SfePy 2021.4.

Description

SfePy (simple finite elements in Python) is a software for solving systems of
coupled partial differential equations by finite element methods. It is
distributed under the new BSD license.

Home page: https://sfepy.org
Mailing list: https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
Git (source) repository, issue tracker: https://github.com/sfepy/sfepy

Highlights of this release

  • improved pyvista-based visualization script resview.py
  • gallery images generated using resview.py
  • homogenization tools: new parallel recovery of multiple microstructures
  • new "dry water" flow example

For full release notes see [1].

Cheers,
Robert Cimrman

[1] http://docs.sfepy.org/doc/release\_notes.html#id1


Contributors to this release in alphabetical order:

Robert Cimrman
Yves Delley
Florian Le Bourdais
Vladimir Lukes
Brylie Christopher Oxley... continue reading

naive kindleBOT
#

Hello all,
I'm glad to announce the release of psutil 5.9.0:
https://github.com/giampaolo/psutil

About

psutil (process and system utilities) is a cross-platform library for
retrieving information on running processes and system utilization (CPU,
memory, disks, network) in Python. It is useful mainly for system
monitoring, profiling and limiting process resources and management of
running processes. It implements many functionalities offered by command
line tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free,
nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It
currently supports Linux, Windows, macOS, Sun Solaris, FreeBSD, OpenBSD,
NetBSD and AIX, both 32-bit and 64-bit architectures. Supported Python
versions are 2.6, 2.7 and 3.4+. PyPy is also known to work.

What's new

2021-12-29

Enhancements

1851, [Linux]: cpu_freq() is slow on systems with many CPUs. Read current
frequency values for all CPUs from /pr... continue reading

naive kindleBOT
#

tl;dr: I'd like to deprecate and eventually remove the option to use 15-bit digits in the PyLong implementation. Before doing so, I'd like to find out whether there's anyone still using 15-bit PyLong digits, and if so, why they're doing so.

History: the use of 30-bit digits in PyLong was introduced for Python 3.1 and Python 2.7, to improve performance of int (Python 3) / long (Python 2) arithmetic. At that time, we retained the option to use 15-bit digits, for two reasons:

  • (1) use of 30-bit digits required C99 features (uint64_t and friends) at a time when we hadn't yet committed to requiring C99
  • (2) it wasn't clear whether 30-bit digits would be a performance win on 32-bit operating systems

Twelve years later, reason (1) no longer applies, and I suspect that:

  • No-one is deliberately using the 15-bit digit option.
  • There are few machines where using 15-bit digits is faster than using 30-bit digits.

But I don't have solid data on either of these suspicions, hence this post.
... continue reading

naive kindleBOT
#

I'm happy to announce the release of Pygments 2.11. Pygments is a
generic syntax highlighter written in Python.

Pygments 2.11 provides ten new lexers and various improvements to
existing lexers. Please have a look at the changelog
https://pygments.org/docs/changelog/.

Report bugs and feature requests in the issue tracker:
https://github.com/pygments/pygments/issues. Thanks go to all the
contributors of these lexers, and to all those who reported bugs and
waited very patiently for this release.

Download it from https://pypi.org/project/Pygments/, or look at
the demonstration at https://pygments.org/demo/.

Enjoy,
Matthäus

naive kindleBOT
#

Hi all,

I submitted my first PR against Python a month or so ago and was wondering
if someone could take a quick look at it and let me know if anything needs
to be fixed before it can be merged.

It's a pretty simple change (mostly just boilerplate delegation) that
allows SpooledTemporaryFile objects to be used like all other io.IOBase
objects. This brings it more inline with the documentation, as well as
fixes a variety of use cases that require the seekable, readable, etc.
methods to be available on it.

Python bug: https://bugs.python.org/issue26175
Current PR: https://github.com/python/cpython/pull/29560

Thanks!

Carey

naive kindleBOT
#

ACTIVITY SUMMARY (2021-12-24 - 2021-12-31)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7195 ( -1)
closed 50747 (+41)
total 57942 (+40)

Open issues with patches: 2871

Issues opened (32)

#46118: Migrate importlib.resources into a package
https://bugs.python.org/issue46118 reopened by jaraco

#46175: Zero argument super() does not function properly inside genera
https://bugs.python.org/issue46175 opened by tritium

#46177: can't install launcher for all users
https://bugs.python.org/issue46177 opened by Amine

#46178: Remove .travis.yml?
https://bugs.python.org/issue46178 opened by sobolevn

#46180: Button clicked failed when mouse hover tooltip and tooltip des
https://bugs.python.org/issue46180 opened by Jason990420

#46181: Destroying an expaned Combobox prevents Entry focus until Alt+
https://bugs.python.org/... continue reading

naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.22.0. NumPy 1.22.0 is a big release featuring the work of 153
contributors spread over 609 pull requests. There have been many
improvements,
highlights are:

  • Annotations of the main namespace are essentially complete. Upstream
    is a moving target, so there will likely be further improvements, but the
    major work is done. This is probably the most user visible enhancement in
    this release.
  • A preliminary version of the proposed Array-API is provided. This is a
    step in creating a standard collection of functions that can be used across
    applications such as CuPy and JAX.
  • NumPy now has a DLPack backend. DLPack provides a common interchange
    format for array (tensor) data.
  • New methods for quantile, percentile, and related functions. The
    new methods provide a complete set of the methods commonly found in the
    literature.
  • A new configurable al... continue reading
naive kindleBOT
#

Hi everyone,

I am writing this to notify you that unfortunately the release of 3.11.0a4
is blocked as there are a bunch of release blockers
(some of them affect Python 3.10):

https://bugs.python.org/issue46263
https://bugs.python.org/issue46208
https://bugs.python.org/issue46006
https://bugs.python.org/issue43683

If this was a single release blocker I would think about moving forward but
unfortunately, there are several of them and one of
them is that Python fails to compile FreeBSD, so I am halting the release
until these are fixed.

Regards from rainy London,
Pablo Galindo Salgado

naive kindleBOT
#

Hey everyone.

Quick sanity check: The ctypes docs
https://docs.python.org/3.10/library/ctypes.html#ctypes.\_CData refer to
_CData as a non-public class which is in the module, but _ctypes.c doesn't
actually export it
https://github.com/python/cpython/blob/main/Modules/\_ctypes/\_ctypes.c#L5680.
(I discovered this because it turns out that typeshed is referencing
_CData, e.g. in its type annotations for RawIOBase
https://github.com/python/typeshed/blob/master/stdlib/\_typeshed/\_\_init\_\_.pyi#L190
)

Is this intended behavior in CPython (in which case the docs are a bit off
and typeshed has a bug), or is it unexpected to people on this list (in
which case it's an issue in _ctypes.c)?

Yonatan

naive kindleBOT
#

Hi all,

I am currently doing some research on the security of CPython. I used the open source vulnerability analysis engine, Infer(https://fbinfer.com/), to scan the native code of CPython 3.10.0.

The scan results show that there are still a number of vulnerabilities in the CPython native code, such as Null dereference, Uninitialized variable, Resource/Memory leak, etc. Moreover, I found that some of the vulnerabilities are related to Python/C API. I enclose the vulnerability report for your reference.

Based on the research of the result, I tried to design a tool to automatically detect and repair vulnerabilities in CPython and make this tool available. See:

https://github.com/PVMPATCH/PVMPatch

Python is my favourite programming language. I sincerely hope that I can help Python become stronger and safer. I hope this discovery can be useful for you to develop Python in the future.

Thank you for your time and consideration!

Lin

naive kindleBOT
#

With the recent submission of PEP 677, I was reminded of an idea I had with function annotation syntax since the very beginning:

why not let me write:

def f() -> tuple[int, str]:
    return 42, 'foo'

as:

def f() -> (int, str):
    return 42, 'foo'

Is there any inherent reason for this, other than that it isn't an actual "type"?

I think it looks much cleaner, and if there isn't any drawbacks to adding this syntax, I'd love to work on bringing this to life.

naive kindleBOT
#

ACTIVITY SUMMARY (2021-12-31 - 2022-01-07)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7199 ( +4)
closed 50825 (+78)
total 58024 (+82)

Open issues with patches: 2886

Issues opened (50)

#34931: os.path.splitext with more dots
https://bugs.python.org/issue34931 reopened by xnovakj

#46009: sending non-None values makes generator raise StopIteration on
https://bugs.python.org/issue46009 reopened by christian.heimes

#46110: compile("-"*3000000 + "4", '', mode) causes hard crash
https://bugs.python.org/issue46110 reopened by pablogsal

#46216: spurious link to os.system() from os.times() documentation ent
https://bugs.python.org/issue46216 opened by emery.berger

#46217: 3.11 build failure on Win10: new _freeze_module changes?
https://bugs.python.org/issue46217 opened by terry.reedy

#46220: imaplib.py "select" m... continue reading

naive kindleBOT
#

While there are many reasons to welcome the end of 2021, I would like to give a shout-out to Python 3.6 which officially reached end-of-life on 2021-12-23, 6.5 years after its development began and exactly five years after its initial release.

Building on the success of previous Python 3 releases, 3.6 added many new features and improvements too numerous to list: over 10000 commits by some 160 contributors, including one of the most popular features in recent Python releases, f-strings (thanks, EVS!). I think it is fair to say that, with Python 3.6, the long transition from Python 2 was finally settled. As release manager for 3.6, I would like to personally thank all those contributors, and mostly volunteers: you made my job an easy one with your overwhelmingly positive attitude and support. I would also like to thank the authors and maintainers of the many third-party packages that were updated to support 3.6 as well as the downstream distributors of Python whose rapid uptake and rel... continue reading

naive kindleBOT
#

I posted this suggestion earlier in the callable type syntax discussion, at which point it was completely ignored. Possibly because it’s a really stupid idea, but let me post it again on the off chance that it isn’t a stupid idea but was overlooked.

If I can make a wild suggestion: why not create a little language for type specifications?

If you look at other programming languages you’ll see that the “type definition sub-language” is often completely different from the “execution sub-language”, with only some symbols in common and used in vaguely related ways. bool (*myfuncptr)(int, float*) uses a completely different set of syntactic rules than rv = (*myfunptr)(*myintptr, &myfloat). So with some grains of salt you could say that C is comprised of a declarative typing sublanguage and an imperative execution sublanguage.

And an even better example is Pascal, which uses a set of syntactic constructs for typing that are completely different from the execution statement synt... continue reading

naive kindleBOT
#

Hi,

I would like to remind everybody that Python's support for OpenSSL 3.0
is preliminary [1]. Python compiles with OpenSSL 3.0.0 and simple code
kinda works. However there are known performance regressions, missing
features (e.g. usedforsecurity flag), and potential bugs cause by API
incompatibilities.

Due to the experimental state I advise against using Python with OpenSSL
3.0 in production.

It may take a while until Python gains full support for the next version
of OpenSSL. I have shifted my personal OSS time to more fun topics like
performance and WASM. My work time is currently limited, too.

Christian

[1] https://docs.python.org/3/whatsnew/3.10.html#ssl

naive kindleBOT
#

Hi everyone,

I would like to start a discussion about a small PEP proposal to allow
parentheses in
assert statements to fix a common gotcha with assert statements.

Link to the PEP: https://www.python.org/dev/peps/pep-0679/

*Please, redirect all discussions to: *

https://discuss.python.org/t/pep-679-allow-parentheses-in-assert-statements/13003

as I will not be monitoring answers to this thread.

Thanks, everyone for your time!

Regards from cloudy London,
Pablo Galindo Salgado

naive kindleBOT
#

Apologies for one of these review request emails. Anybody with ctypes experience in the core reviewer team available to review and comment/merge? This has gotten reviewed and passes checks.

Python bug: https://bugs.python.org/issue33178
Current PR: https://github.com/python/cpython/pull/25480

Thanks,

David Goncalves

#

Hi,

I would like to announce PEP 676 to python-dev. It is a meta-PEP focussed on modernising the PEP build infrastructure. From the abstract, "This PEP addresses the infrastructure around rendering PEP files from reStructuredText files to HTML webpages. We aim to specify a self-contained and maintainable solution for PEP readers, authors, and editors."

Link: https://www.python.org/dev/peps/pep-0676/
Rendered through the PEP 676 system: https://python.github.io/peps/pep-0676/

Please see https://discuss.python.org/t/10774 for prior discussion and to give any feedback.

Thanks,

Adam Turner

naive kindleBOT
naive kindleBOT
#

Hi everyone,

I want to report on the status of Python 3.11.0a4. We had a ton of release
blockers (some extra ones
since I reported the last time) and it seems that we managed to fix them
all (thanks to Mark Shannon,
Christian Heimes, Gregory P. Smith, Neil Schemenauer, Steve Dower and many
others that helped with
the blockers.

Unfortunately it seems that the release is cursed and we are having some
problems with the certificates
to create and sign the Windows artefacts so we are waiting for that to
unblock us.

I will keep you posted on new developments.

Regards from rainy London,
Pablo Galindo Salgado

naive kindleBOT
#

Hello all,

We’d like to make a last call for discussion on PEP 677: Callable Type Syntax [1] before sending this to the Steering Council.

For context, PEP 677 proposes an arrow-like callable syntax for python:

(int, str) -> bool # equivalent to Callable[[int, str], bool]

Thanks everyone for comments on our earlier thread [2]. We made some changes to the PEP, but not the proposal itself, in response to that discussion:

  • More discussion about readability of return types and parentheses
  • Noting that complex code might be improved by using TypeAliases
  • Discussion of additional ideas in the Rejected Alternatives section

Many of the concerns in the previous thread are about whether new callable syntax is worth the implementation complexity, which is an important question. We’ve seen demand for this from regular typed Python users. And given that Callable is one of the most used and complicated type annotations, we at typing-sig favor new syntax.

We have con... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-01-07 - 2022-01-14)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7202 ( +3)
closed 50906 (+81)
total 58108 (+84)

Open issues with patches: 2886

Issues opened (48)

#32876: HTMLParser raises exception on some inputs
https://bugs.python.org/issue32876 reopened by iritkatriel

#46298: Automatically check for __slots__-mistakes in Lib
https://bugs.python.org/issue46298 opened by ariebovenberg

#46304: Unable to iterate over lines in a file without a block of code
https://bugs.python.org/issue46304 opened by jaraco

#46309: Task created by StreamReaderProtocol gets garbage collected.
https://bugs.python.org/issue46309 opened by simwr872

#46311: Clean up PyLong_FromLong and PyLong_FromLongLong
https://bugs.python.org/issue46311 opened by mark.dickinson

#46312: range() function could accep... continue reading

naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.22.1. NumPy 1.22.1 fixes several bugs discovered after the 1.22.0
release. Notable fixes are:

  • Fix for f2PY docstring problems (SciPy)
  • Fix for reduction type problems (AstroPy)
  • Fixes for various typing bugs.

The Python versions supported in this release are 3.8-3.10. Wheels can be
downloaded from PyPI https://pypi.org/project/numpy/1.22.1; source
archives, release notes, and wheel hashes are available on Github
https://github.com/numpy/numpy/releases/tag/v1.22.1. Linux users will
need pip >= 0.19.3 in order to install the manylinux2014 wheels. A recent
version of pip is needed to install the universal2 macos wheels.

Contributors

A total of 14 people contributed to this release. People with a "+" by
their
names contributed a patch for the first time.

  • Arryan Singh
  • Bas van Beek
  • Charles Harris
  • Denis Laxalde
  • Isuru Fernando
  • ... continue reading
naive kindleBOT
#

Hi there,
before we begin the usual round of release notes, please do note that the three new versions of Python released today do not contain Windows installers yet. This is temporary, due to a more complex than expected code signing certificate renewal.
We’ve held the releases all week while the situation is getting resolved but the urgency of 3.10.2 in particular made us release without the Windows installers after all. We apologize for the inconvenience and are doing everything we can to put the Windows installer in place as soon as possible.

We’re rooting for both Ee Durbin and Steve Dower who are helping us resolve this. Thanks for your hard work! Hopefully, by this time next week, this will only be a footnote in release management history.

The releases you’re looking at were all cursed in some way. What a way to start 2022! Besides the certificate hold up, Python 3.10.2 is an expedited release (you’ll want to upgrade, read below!), Python 3.11.0a4 had almost 20 (sic, twenty!) ... continue reading

#

Hi there,
before we begin the usual round of release notes, please do note that the three new versions of Python released today do not contain Windows installers yet. This is temporary, due to a more complex than expected code signing certificate renewal.
We’ve held the releases all week while the situation is getting resolved but the urgency of 3.10.2 in particular made us release without the Windows installers after all. We apologize for the inconvenience and are doing everything we can to put the Windows installer in place as soon as possible.

We’re rooting for both Ee Durbin and Steve Dower who are helping us resolve this. Thanks for your hard work! Hopefully, by this time next week, this will only be a footnote in release management history.

The releases you’re looking at were all cursed in some way. What a way to start 2022! Besides the certificate hold up, Python 3.10.2 is an expedited release (you’ll want to upgrade, read below!), Python 3.11.0a4 had almost 20 (sic, twenty!) ... continue reading

naive kindleBOT
#

There's a long time issue of trying to differentiate mappings and sequences
in the C-API in a fast and reliable way.

Due to recent changes, we might be able to do so at last, by checking
tp_flags + str/bytes/bytearray which are considered unique.

This might be a breaking change in the Stable ABI promise but one that can
be considered a bug fix as the current behavior is lacking.

What do you think?

bpo: https://bugs.python.org/issue46376

Best regards,
Bar Harel

naive kindleBOT
#

Inspired by this enhancement request:

https://bugs.python.org/issue46393

I thought it might be time to revist the idea of a frozenset display.
This has been discussed a few times before, such as here:

https://mail.python.org/pipermail/python-ideas/2018-July/051902.html

We have displays for the most important builtin data structures:

  • lists [1, 2, 3]
  • tuples (1, 2, 3)
  • dicts {1: 0, 2: 0, 3: 0}
  • sets {1, 2, 3}

(as well as literals for ints, floats, strings and bytes)

but not for frozensets. So the only way to guarantee that you have a
frozenset is to explicitly call the builtin, which is not only a runtime
call rather than a compile-time operation, but can be monkey-patched or
shadowed.

CPython already has some neat optimizations in place to use frozensets
instead of sets, for example:

import dis
dis.dis("x in {1, 2, 3}")
1 0 LOAD_NAME 0 (x)
2 LOAD_CONST 0 (frozenset({1, 2, 3}))
4 CONTAIN... continue reading

naive kindleBOT
#

Example use cases:

  • Loop variables and similar, it is sometimes more comfortable to scope
    it to the loop body only
  • Not having to name variables var1, var2, var3, or makeup unnecessarily
    unique variable names, in some situations

In other languages the curly bracket is used, in Python round brackets
might fit more in the syntax.

I don’t have much experience with the implementation of Python, so not sure
if there’s a technical reason against such idea,

feedback is very appreciated

Best regards,

Iyad Ahmed

Email: iyadahmed@cgonfire.com

Socials: Twitter https://twitter.com/cgonfire

GitHub: https://github.com/iyadahmed

naive kindleBOT
#

There was a discussion on another forum that mentioned the 'input'
function, and it made me wonder whether 'input' should be printing the
prompt to stderr instead of stdout.

The convention is for normal output to go to stdout and error messages
to go to stderr, so if a program needs to ask the user, shouldn't it be
using stderr for prompts in order not to mess up the normal output?

naive kindleBOT
naive kindleBOT
#

Perhaps the time isn't ripe for this, and perhaps it never will be, but
UTF8 seems to be handled by just about everything these days. I suspect
this is a crazy suggestion, but on the other hand perhaps people looking
back from 2100 will think "It was crazy that they stuck exclusively with
ASCII syntax characters for so long after Unicode was widely available".

Sometimes when you have quite a few levels of brackets, and there are more
than one of the same type, might it be better to allow variants of each
type of bracket character? Unicode provides bold, double, small,
superscript, subscript, and white-filled (hollow) variants of round, square
and curly brackets, and top and bottom ticked variants of square brackets.

Perhaps not enough platforms will be able to display them? And entering
them may be fiddly, although programmable editors and IDEs could let you
type the standard characters but pick variants on a round-robin basis
within each expression.

But it might be handled better... continue reading

naive kindleBOT
#

Hi folks,
From gdbm 1.21, gdbm supports the crash tolerance feature.
see: https://www.gnu.org.ua/software/gdbm/manual/Crash-Tolerance.html

I would like to introduce this feature since python standard library is the
only gdbm binding library that is available for end-users.
And this is also effort for end-users to provide the latest new features.
If this feature is added following methods will be added.

  • 'x' flag will be added for extended gdbm format.
  • gdbm.gdbm_failure_atomic('path1', 'path2') API will be added for
    snapshot paths.
  • gdbm.gdbm_latest_snapshot('path1', 'path2') API will be added for
    getting latest valid snapshot path.

The above APIs will be used for people who need to recover their gdbm file
if disaster situations happen.
However, this feature is not yet decided to land to CPython.
and we have already discussed this issue at
https://bugs.python.org/issue45452
but I would like to hear other devs opinions.

I cc the original authors of this feature and Serhi... continue reading

naive kindleBOT
#

Hi,

I made the following changes to the PEP since the version 1 (November 30):

  • Elaborate the HPy section and add a new "Relationship with the HPy
    project" section
  • Elaborate which projects are impacted and which changes are needed
  • Remove the PyPy section

The PEP can be read online:
https://python.github.io/peps/ep-0674/

And you can find the plain text below.

Victor

PEP: 674
Title: Disallow using macros as l-value
Author: Victor Stinner vstinner@python.org
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 30-Nov-2021
Python-Version: 3.11

Abstract

Incompatible C API change disallowing using macros as l-value to:

  • Allow evolving CPython internals;
  • Ease the C API implementation on other Python implementation;
  • Help migrating existing C extensions to the HPy API.

On the PyPI top 5000 projects, only 14 projects (0.3%) are affected by 4
macro changes. Moreover, 24 projects just have to regenerate their
Cython code to use Py\_SET\_TYPE().
... continue reading

naive kindleBOT
#

Hi,

My colleagues Tomáš Hrnčiar and Miro Hrončok made good progress on
updating Python 3.10 to Python 3.11 in Fedora, but some specific
Python 3.11 incompatible changes are causing more troubles than
others:
https://discuss.python.org/t/experience-with-python-3-11-in-fedora/12911

We propose to revert the following 2 changes in Python 3.11 and
postpone them in a later Python version, once most projects will be
compatible with these changes:

  • Removal of unittest aliases (bpo-45162): it broke 61 Fedora packages
  • Removals from configparser module (bpo-45173) - broke 28 Fedora packages

--

We reported the issue to many affected projects, or when possible, we
also wrote a pull request to make the code compatible (lot of those
were made by others, e.g. Hugo van Kemenade, thank you!).

The problem is that fixing a Fedora package requires multiple steps:

  • (1) Propose a pull request upstream
  • (2) Get the pull request merged upstream
  • (3) Wait for a new release upstream
  • (4) Update the... continue reading
naive kindleBOT
#

mimetypes are parsed from the file /etc/mime.types

cat /etc/mime.types | grep javascript
application/javascript js
application/x-javascript js

actual:
mimetypes.guess_type("x.js") == "application/x-javascript"
-> deprecated mimetype

expected:
mimetypes.guess_type("x.js") == "application/javascript"

spoiler: here, the "x-" part is deprecated.

mimetypes.guess_type returns the deprecated mimetype
because python returns the last entry in the /etc/mime.types file
which is sorted alphabetically

proposed solution:
use a smarter conflict-resolution when parsing /etc/mime.types.
when two entries are found for one file-extension,
avoid using a deprecated mimetype.
rfc4329 lists 16 items for "unregistered media type"
these could be hard-coded as set-of-strings, or as regex.

related bug report
https://bugs.python.org/issue46035

mimetypes.guess_type
https://docs.python.org/3/library/mimetypes.html#mimetypes.guess\_type

unregistered media type
https://datatracker.ietf.org/d... continue reading

naive kindleBOT
#

"When printing tracebacks, the interpreter will now point to the exact
expression that caused the error instead of just the line."

I get the motivation for better error messages, but there are scenarios
where you can't provide useful new information. I've been lax in
getting to testing the project I work on with 3.11, but here's some spew
from one testcase (this is an intentionally triggered error - the
testcase is testing predictable behavior in the face of this error, 3.11
didn't cause this, as can be fairly easily seen):

Traceback (most recent call last):
File "C:\Users\mats\Documents\github\scons\SCons\Script\Main.py", line
1403, in main
_exec_main(parser, values)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mats\Documents\github\scons\SCons\Script\Main.py", line
1366, in _exec_main
_main(parser)
^^^^^^^^^^^^^
File "C:\Users\mats\Documents\github\scons\SCons\Script\Main.py", line
1034, in _main
SCons.Script._SConscript._SConscript(fs, script)
... continue reading

naive kindleBOT
#

I have written an xsd parser to generate python classes. I also have
written a utility to read in an xml file to populate the python classes.
As well as a utility to write xml from the python classes thus generated.
For example the code below that I include here shows a small sample of the
generated code.
The __annotations__ for these are very easy to use by the utility code for
doing their job.

Using the typing list[x] and tuple[a,b] do not work as well as

  • [x] instead of list[x]
  • (a, b) instead of tuple(a, b)

I seem to feel list[x] and tuple[a,b] are far more non Python, requiring
having to parse the string they return in a complicated way.

Looping through the annotations to get the field types it's easy to test
for list or tuple and then get the field type for the list or tuple and the
usage for the tuple.

I have been using Python from version 1.6 and have been involved in writing
and generating tons of lines of Python.

ATTRIB, PSEUDO, ASIS = range(3)

class RecordType:
... continue reading

naive kindleBOT
#

I've been wondering whether it would make sense to have a function in inspect that returns the signature of a type, rather than the signature of a specific callable object.

I'm not attached to any name for such a function, two ideas are inspect.signature_of or inspect.signature_of_type.

Context: the behavior of inspect.signature

The existing inspect.signature function specified in PEP 362 [0] returns the call signature of a particular object, in other words given

class Dog:
    def __init__(self, color: str):
        self.color = color
    def __call__(self, command: str):
        print(command)

we will get

>>> import inspect
>>> inspect.signature(Dog)
<Signature (color: str)>
>>> inspect.signature(Dog("brown"))
<Signature (command: str)>

Outline of the idea

In some cases it might be nice to be able to access the signature of an instance of Dog given the type Dog, without actually needing to instantiate it.

Moreover, there are some cases where... continue reading

naive kindleBOT
#

Hi all,

python-ideas moderator here. It’d be great if y’all could take a few days to cool off the frozen set discussion, which is veering off the rails a little bit into emotional language.

I’ll keep an eye on it and put emergency moderation into effect if I must, but it’d be nicer if I didn’t feel the need to do that.

thanks,
—titus

naive kindleBOT
#

ACTIVITY SUMMARY (2022-01-14 - 2022-01-21)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7175 (-27)
closed 51014 (+108)
total 58189 (+81)

Open issues with patches: 2878

Issues opened (59)

#24711: Document getpass.getpass behavior on ^C
https://bugs.python.org/issue24711 reopened by iritkatriel

#44133: Some C-API symbols (e.g. Py_FrozenMain) are not always exporte
https://bugs.python.org/issue44133 reopened by vstinner

#45522: Allow to build Python without freelists
https://bugs.python.org/issue45522 reopened by vstinner

#46035: mimetypes.guess_type returns deprecated mimetype application/x
https://bugs.python.org/issue46035 reopened by iritkatriel

#46133: Feature request: allow mechanism for creator of exec-generated
https://bugs.python.org/issue46133 reopened by posita

#46381: Improve documentation of CFL... continue reading

naive kindleBOT
#

Hello,

I’m happy to announce the release of pymssql 2.2.4, available to download
via pip and GitHub. Pymssql is a simple database interface for Python
that builds on top of FreeTDS to provide a Python DB-API (PEP-249)
interface to Microsoft SQL Server.
The official documentation is available at: https://pymssql.readthedocs.io
The sources, discussions and bug tracker: https://github.com/pymssql/pymssql.

Below please see the changes since last announcement.

Enjoy,
Mikhail

Version 2.2.4 - 2022-01-23 - Mikhail Terekhov

General

- Build wheels for Python-3.10 on Linux.
- Fix include paths in setup.py.
naive kindleBOT
#

Hello Pythonistas.

In (development branch of) Fedora, we have juts upgraded to GCC 12.

It seems that the presence of AC_C_CHAR_UNSIGNED in Python's autotools files
(configure.ac?) is causing the __CHAR_UNSIGNED__ symbol to be defined in
pyconfig.h and that breaks some other packages with GCC 12.

The GCC maintainers told us it is a reserved symbol,
see https://bugzilla.redhat.com/2043555 for details.

It seems that using AC_C_CHAR_UNSIGNED is not recommended and also not
required, but I must confess that I am pretty much horrified by autotools and I
don't really know if we can get rid of AC_C_CHAR_UNSIGNED or not. I can test
this in Fedora and I am quite sure it'll work, but I don't know the impact on
all the other environments where CPython can be compiled.

Is there anybody on this list who knows a reason we need to keep
AC_C_CHAR_UNSIGNED around in 2022? Or is it safe to get rid of it?

Thanks,

Miro Hrončok

Phone: +4207779748... continue reading

naive kindleBOT
#

Hello Pradeep, James and Jelle,

The Steering Council discussed PEP 673 -- Self Type, and unanimously
decided to accept it. Congratulations!

Please change the PEP status to Accepted, and merge the change to Python
3.11, at your convenience.

Happy typing!

  • Petr (on behalf of the Python Steering Council)
naive kindleBOT
#

Hi,

tl; dr Python no longer leaks memory at exit on the "python -c pass" command ;-)

== Bug report ==

In 2007, the bpo-1635741 issue was reported on SourceForge:
"Interpreter seems to leak references after finalization".

This bug is 15 years old. It saw the bugs migration from SourceForge
to Roundup (bugs.python.org) in 2007, the code migration from
Subversion to Mercurial in 2009, and the second code migration from
Mercurial to Git in 2016!

Link to the main issue: https://bugs.python.org/issue1635741

Some people reported similar issues seen by WinCRT debug (bpo-6741),
MSVC Debug C Runtime (bpo-32026), GCC AddressSanitzer (bpo-26888), or
LeakSanitizer and Valgrind (bpo-21387).

In general, "leaking memory" at Python exit doesn't matter, since the
operating system releases all memory when a process completes. It
matters when Python is embedded in an application. For example, Python
can be used by a plugin which is unloaded and reloaded multiple times.
It also matters for sub-int... continue reading

naive kindleBOT
#

Hi all,

I've written PEP 678, proposing the addition of a __note__ attribute
which can be used to enrich displayed exceptions. This is particularly
useful with ExceptionGroup, or where exception chaining is unsuitable, and
ensures that 'orphan' output is not produced if the annotated exception is
caught.

Link to the PEP: https://www.python.org/dev/peps/pep-0678/

Please, redirect all discussions to:
https://discuss.python.org/t/pep-678-enriching-exceptions-with-notes/13374

Thanks for your time, and to those who have already made (very helpful!)
comments!

Best wishes from just-moved-to San Francisco,
Zac Hatfield-Dodds

naive kindleBOT
#

Hello all,

Link to the PEP: https://www.python.org/dev/peps/pep-0680/
Please redirect discussion to: https://discuss.python.org/t/13040

PEP 680 proposes adding the tomllib module to the standard library for
parsing TOML https://toml.io. The main motivation is to address
bootstrapping problems with pyproject.toml based builds.

Thank you to everyone who has already left comments, suggestions and reacts
on the Discuss thread! We welcome any further suggestions before submitting
to the Steering Council :-)

Thanks,
Shantanu Jain
Taneli Hukkinen

naive kindleBOT
#

Dear *,

on behalf of the Numba team, I am happy to announce that Numba 0.55.1
has become available! This is a bugfix release that closes all the
remaining issues from the accelerated release of 0.55.0 and also any
release critical regressions discovered since then.

For more information, please point your browsers at:

https://numba.discourse.group/t/ann-numba-0-55-1/1161

Best,

V-

naive kindleBOT
#

Hi,

There is a reason why I'm bothering C extensions maintainers and
Python core developers with my incompatible C API changes since Python
3.8. Let me share my plan with you :-)

In 2009 (Python 3.2), Martin v. Löwis did an amazing job with the PEP
384 "Defining a Stable ABI" to provide a "limited C API" and a "stable
ABI" for C extensions: build an extension once, use it on multiple
Python versions. Some projects like PyQt5 and cryptograpy use it, but
it is just a drop in the PyPI ocean (353,084 projects). I'm trying to
bend the "default" C API towards this "limited C API" to make it
possible tomorrow to build more C extensions for the stable ABI.

My goal is that the stable ABI would be the default, and only a
minority of C extensions would opt-out because they need to access to
more functions for best performance.

The basic problem is that at the ABI level, C extensions must only
call functions, rather than getting and setting directly to structure
members. Structures changes ... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-01-21 - 2022-01-28)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7157 (-18)
closed 51138 (+124)
total 58295 (+106)

Open issues with patches: 2888

Issues opened (71)

#33205: GROWTH_RATE prevents dict shrinking
https://bugs.python.org/issue33205 reopened by rhettinger

#38195: A bug in the multiprocessing module
https://bugs.python.org/issue38195 reopened by eshkrig

#44733: Feature request: maxtasksperchild for ProcessPoolExecutor
https://bugs.python.org/issue44733 reopened by gregory.p.smith

#44734: turtle: tests for Vec2D.__abs__ are too strict
https://bugs.python.org/issue44734 reopened by petr.viktorin

#45162: Remove old deprecated unittest features
https://bugs.python.org/issue45162 reopened by gregory.p.smith

#45200: Address Sanitizer: libasan dead lock in pthread_create() (t... continue reading

naive kindleBOT
#

I am delighted to announce the release 3.3.0 of Austin. If you haven't heard of Austin before, it is an open-source frame stack sampler for CPython, distributed under the GPLv3 license. It can be used to obtain statistical profiling data out of a running Python application without a single line of instrumentation. This means that you can start profiling a Python application straight away, even while it's running in a production environment, with minimal impact on performance.

https://github.com/P403n1x87/austin

The best way to leverage Austin is to use the new extension for VS Code, which brings interactive flame graphs straight into the text editor to allow you to quickly jump to the source code with a simple click. You can find the extension on the Visual Studio Marketplace and install it directly from VS Code:

https://marketplace.visualstudio.com/items?itemName=p403n1x87.austin-vscode

To see how to make the best of Austin with VS Code to find and fix performance issues, check ou... continue reading

naive kindleBOT
#

Hi everyone,

We have a huge amount of buildbots failing and seems to be related to
different issues
that keep piling up. To prevent this from going worse,* I am blocking the
main branch*
until these issues are resolved.

Only release managers and the developer in residence will be able to merge
pull requests
until these issues are fixed. Please, ping me if you have a pull request
for fixing any of these
issues so we can merge.

I apologize for the inconvenience.

Thanks for your understanding,

Regards from rainy London,
Pablo Galindo Salgado

naive kindleBOT
#

I'm planning on moving us to a simpler, more efficient alternative to
_Py_IDENTIFIER(), but want to see if there are any objections first
before moving ahead. Also see https://bugs.python.org/issue46541.

_Py_IDENTIFIER() was added in 2011 to replace several internal string
object caches and to support cleaning up the cached objects during
finalization. A number of "private" functions (each with a
_Py_Identifier param) were added at that time, mostly corresponding to
existing functions that take PyObject* or char*. Note that at present
there are several hundred uses of _Py_IDENTIFIER(), including a number
of duplicates.

My plan is to replace our use of _Py_IDENTIFIER() with statically
initialized string objects (as fields under _PyRuntimeState). That
involves the following:

  • add a PyUnicodeObject field (not a pointer) to _PyRuntimeState for
    each string that currently uses _Py_IDENTIFIER() (or
    _Py_static_string())
  • statically initialize each object as part of th... continue reading
naive kindleBOT
#

Hi Guido et. al.,

since May 2021 I have been working at running PyPy on PySide6,
which was a difficult undertaking, since PyPy internally is quite
a bit different.

I declared the project to be ready-to-use when the Mandelbrot
example of the PySide examples
(examples/corelib/threads/mandelbrot.py)
is working.

This was finally solved this week on 2022-02-01, so we have the

 first advanced Gui working with PyPy

and with the amazing result of speed:

PyPy 3.8 works
10 times faster than the identical code on Python 3.10
and
5.5 times slower than the same example in C++ Qt.

I think to send an official announce when this is available on pip.

This effort marks the completion of my PyPy support, which began
in 2003 and ended involuntarily in 2006 due to a stroke.

All the best -- Chris

Christian Tismer-Sperling :^) tismer@stackless.com
Software Consulting : http://www.stackless.com/
Strandstraße 37 : ... continue reading

naive kindleBOT
#

Greetings,

This library* seems to be used by many people for some treemap operations.
Would it be a good idea to include it in upcoming versions? Leetcode
has it by default for the lack of a similar something in Python. I did not
check,
but it seems other languages cater to structures better.

Thanks.

Kind Regards,

Abdur-Rahmaan Janhangeer
about https://compileralchemy.github.io/ | blog
https://www.pythonkitchen.com
github https://github.com/Abdur-RahmaanJ
Mauritius

naive kindleBOT
#

Wing 8.1.3 adds support for using Unreal Engine with Wing, writes a
preconfigured wingdbstub.py when creating new projects, expands Run
Arguments and other dialog fields, correctly finds printers on Linux,
and fixes a number of code analysis problems and other minor issues.

Details: https://wingware.com/news/2022-02-01
Downloads: https://wingware.com/downloads

== About Wing ==

Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing's deep code analysis provides
auto-completion, auto-editing, and refactoring that speed up
development. Its top notch debugger works with any Python code, locally
or on a remote host, container, or cluster. Wing also supports
test-driven development, version control, UI color and layout
customization, and includes extensive documentation and support.

Wing is available in three product levels:  Wing Pro is the
full... continue reading

naive kindleBOT
#

I am proposing to add smth like JS destructing assignment to python.
Basically, it will allow unpacking any mapping (should have __getitem__ and keys() methods) into variables.

Proposed syntax:

m = {"a": 1, "b": 2, "c": 3, "d": 4}

{a, b} = m # a: 1, b: 2
{a, b, **rest} = m # a: 1, b: 2, rest: {c: 3, d: 4}

It will be rawly equal to:

m = {"a": 1, "b": 2, "c": 3, "d": 4}

# {a, b} = m
a = m["a"]
b = m["b"]

# {a, b, **rest}
rest = {**m}
a = rest.pop("a")
b = rest.pop("b")

This is fully backward compatible feature because currently syntax like above is not supported:

    {a, b} = m # a: 1, b: 2
    ^^^^^^
SyntaxError: cannot assign to set display here. Maybe you meant '==' instead of '='?
naive kindleBOT
#

We needed to tame some angry buildbots, but after a small fight, we won
with just some scratches! Here you have a shiny new alpha release: Python
3.11.0a5.

https://www.python.org/downloads/release/python-3110a5/

This is an early developer preview of Python 3.11

Major new features of the 3.11 series, compared to 3.10

Python 3.11 is still in development. This release, 3.11.0a5 is the fifth
of seven planned alpha releases.

Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.

During the alpha phase, features may be added up until the start of the
beta phase (2022-05-06) and, if necessary, may be modified or deleted up
until the release candidate phase (2022-08-01). Please keep in mind that
this is a preview release and its use is not recommended for production
environments.

Many new features for Python 3.11 are still being planned and written.
Among the new major new ... continue reading

#

We needed to tame some angry buildbots, but after a small fight, we won
with just some scratches! Here you have a shiny new alpha release: Python
3.11.0a5.

https://www.python.org/downloads/release/python-3110a5/

This is an early developer preview of Python 3.11

Major new features of the 3.11 series, compared to 3.10

Python 3.11 is still in development. This release, 3.11.0a5 is the fifth
of seven planned alpha releases.

Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.

During the alpha phase, features may be added up until the start of the
beta phase (2022-05-06) and, if necessary, may be modified or deleted up
until the release candidate phase (2022-08-01). Please keep in mind that
this is a preview release and its use is not recommended for production
environments.

Many new features for Python 3.11 are still being planned and written.
Among the new major new features and changes so... continue reading

naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.22.2. NumPy 1.22.2 fixes several bugs discovered after the 1.22.1
release. Notable fixes are:

  • Build related fixes for downstream projects and other platforms.
  • Various annotation fixes/additions.
  • Fixes for the CVE-2021-41495 complaint.
  • Toolchain fixes on Windows. Numpy wheels now use the 1.41 tool chain,
    fixing downstream link problems for projects using NumPy provided libraries
    on Windows.

Note that OSX wheels are provided for both the x86_64 and arm64
architectures, but there are no universal2 wheels. The minimum supported OS
X version is now 10.14 for the former and 11.0 for the latter. The Python
versions supported in this release are 3.8-3.10. Wheels can be downloaded
from PyPI https://pypi.org/project/numpy/1.22.2; source archives, release
notes, and wheel hashes are available on Github
https://github.com/numpy/numpy/releases/tag/v1.22.2. Linux ... continue reading

naive kindleBOT
#

Hey,

The pytest team is proud to announce the 7.0.0 release, after more than
a year of development since 6.2.0!

This release contains new features, improvements, bug fixes, and breaking changes, so users
are encouraged to take a look at the CHANGELOG carefully:

https://docs.pytest.org/en/stable/changelog.html

For complete documentation, please visit:

https://docs.pytest.org/en/stable/

As usual, you can upgrade from PyPI via:

pip install -U pytest

Thanks to all of the contributors to this release:

  • Adam J. Stewart
  • Alexander King
  • Amin Alaee
  • Andrew Neitsch
  • Anthony Sottile
  • Ben Davies
  • Bernát Gábor
  • Brian Okken
  • Bruno Oliveira
  • Cristian Vera
  • Dan Alvizu
  • David Szotten
  • Eddie
  • Emmanuel Arias
  • Emmanuel Meric de Bellefon
  • Eric Liu
  • Florian Bruhin
  • GergelyKalmar
  • Graeme Smecher
  • Harshna
  • Hugo van Kemenade
  • Jakub Kulík
  • James Myatt
  • Jeff Rasley
  • Kale Kundert
  • Kian Meng, Ang
  • Miro Hrončok
  • Naveen-Pratap
  • Oleg Höfling
  • Olga Matoula
  • Ran Beni... continue reading
naive kindleBOT
#

ACTIVITY SUMMARY (2022-01-28 - 2022-02-04)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7144 (-13)
closed 51222 (+84)
total 58366 (+71)

Open issues with patches: 2890

Issues opened (44)

#45711: Simplify the interpreter's (type, val, tb) exception represent
https://bugs.python.org/issue45711 reopened by vstinner

#45773: Compiler hangs during jump elimination
https://bugs.python.org/issue45773 reopened by brandtbucher

#46570: Windows support for OpenSSL 3.0
https://bugs.python.org/issue46570 opened by jay0lee

#46571: Strange @typing.no_type_check behavior for class variables
https://bugs.python.org/issue46571 opened by sobolevn

#46575: One-off errors in hashlib.scrypt error messages
https://bugs.python.org/issue46575 opened by ron_kaminsky

#46577: Hostname spoofing via backslashes in URL
https://bugs.pytho... continue reading

naive kindleBOT
#

Brand new pip package I created just to understand how building a package works.
It allows you to save an image as a spreadsheet or as a Minecraft pixel art (please to check the wiki to see some outputs and get a feel of what's possible with it).

The code is open source. Stars and contributions are welcome :)
https://github.com/Eric-Mendes/unexpected-isaves

Have fun!
Eric.

naive kindleBOT
naive kindleBOT
#

Hello there,

I have an idea for initializing a variable the first time it’s created; it
can especially be helpful with containers, and dicts specifically. Let me
demonstrate with some examples:

Dic = {} # format fruit:count
for fruit in fruits:
If fruit in Dic:
Dic[fruit]+=1
Else:
Dic[fruit]=1

With my proposal, using := to init (similar to how in math parlance, the :=
is used for defining something for the first time)

Dic = {} # format fruit:count
For fruit in fruits:
Dic[fruit]:= 0
Dic[fruit]+=1

Would be great to hear your feedback. Thanks.

Moj

naive kindleBOT
#

Hi all,

On behalf of the SciPy development team, I'm pleased to announce the
release of SciPy 1.8.0.

Sources and binary wheels can be found at:
https://pypi.org/project/scipy/
and at: https://github.com/scipy/scipy/releases/tag/v1.8.0
https://github.com/scipy/scipy/releases/tag/v1.6.3
https://github.com/scipy/scipy/releases/tag/v1.6.1

One of a few ways to install this release with pip:

pip install scipy==1.8.0

=====================
SciPy 1.8.0 Release Notes

SciPy 1.8.0 is the culmination of 6 months of hard work. It contains
many new features, numerous bug-fixes, improved test coverage and better
documentation. There have been a number of deprecations and API changes
in this release, which are documented below. All users are encouraged to
upgrade to this release, as there are a large number of bug-fixes and
optimizations. Before upgrading, we recommend that users check that
their own code does not use deprecated SciPy functionali... continue reading

naive kindleBOT
#

Hi,

I propose to deprecate the urllib module in Python 3.11. It would emit
a DeprecationWarning which warn users, so users should consider better
alternatives like urllib3 or httpx: well known modules, better
maintained, more secure, support HTTP/2 (httpx), etc.

I don't propose to schedule its removal. Let's discuss the removal in
1 or 2 years.

--

urllib has many abstraction to support a wide range of protocols with
"handlers": HTTP, HTTPS, FTP, "local file", proxy, HTTP
authentication, HTTP Cookie, etc. A simple HTTP request using Basic
Authentication requires 10-20 lines of code, whereas it should be a
single line.

Users (me included) don't like urllib API which was too complicated
for common tasks.

--

Unhappy users created multiple better alternatives to the stdlib urllib module.

In 2008, the "urllib3" module was created to provide an API designed
to be as simple as possible for the most common HTTP and HTTPS
requests. Example:

req = http.request('GET', 'http://httpbin.o... continue reading

naive kindleBOT
naive kindleBOT
#

[image: image.png]

Hello Everyone,

We are reaching out to you about the 21st annual Scientific Computing with
Python Conference — also known as SciPy 2022
https://www.scipy2022.scipy.org/ — that will be held July 11-17, 2022 in
Austin, Texas.

The call for submissions https://www.scipy2022.scipy.org/participate is
now open, and we would love to receive proposals from folks in your
organization. We seek submissions for talks and posters
https://www.scipy2022.scipy.org/talk-poster-presentations by February 11.
This year, in addition to the general conference track and domain
mini-symposia, we are accepting submissions for two specialized tracks: (1)
Machine Learning and Data Science, and (2) Data Life Cycle. We are also
seeking tutorial https://www.scipy2022.scipy.org/tutorials
submissions by February
15.

This year's conference will be held in-person in Austin, Texas. Registration
https://www.scipy2022.scipy.org/attend opens February 3 an... continue reading

naive kindleBOT
#

Hi,

I would like to replace runtime checks on C function arguments with
assertions. For example, replace:

PyObject *
PyDict_GetItemWithError(PyObject *op, PyObject *key)
{
if (!PyDict_Check(op)) {
PyErr_BadInternalCall();
return NULL;
}
...
}

with:

PyObject *
PyDict_GetItemWithError(PyObject *op, PyObject *key)
{
assert(PyDict_Check(op));
...
}

I'm not asking to remove all of them. For example,
PyList_GetItem(list, index) will continuing raising an IndexError if
the index is out of range.

I'm asking to replace runtime checks with assertions when the C API is
"obviously" misused: replace PyErr_BadInternalCall(),
_Py_CheckFunctionResult() and _Py_CheckSlotResult() with assertions.
The exact scope should be defined.

--

Python tries to be nice to C extensions authors and calls
PyErr_BadInternalCall() to emit a nice SystemError exception when the
C API is misused. There are many sanity checks run at runtime. We pay
the cost of these ru... continue reading

naive kindleBOT
naive kindleBOT
#

Hi,

I made a change to require C99 <math.h> "NAN" constant and I'm was
asked to update the PEP 7 to clarify the C subset is needed to build
Python 3.11.

Python 3.6 requires a subset of the C99 standard to build defined by the PEP 7:
https://www.python.org/dev/peps/pep-0007/

I modified Python 3.11 to require more C99 features of the <math.h> header:

  • bpo-45440: copysign(), hypot(), isfinite(), isinf(), isnan(), round()
  • bpo-46640: NAN

After my NAN change (bpo-46640), Petr Viktorin asked me to update the
PEP 7. I proposed a change to simply say that "Python 3.11 and newer
versions use C99":
https://github.com/python/peps/pull/2309

I would prefer to not have to give an exhaustive list of C99 features
used by CPython, since it's unclear to me what belongs to C99 or to
ISO C89. As I wrote before, Python already uses C99 features since
Python 3.6.

On my PEP PR, Guido van Rossum asked me to escalate the discussion to
python-dev, so here I am :-)

In "C99", the number "99" refers to t... continue reading

naive kindleBOT
#

PEP 675 [1] introduces a supertype for precise literal string types, such as Literal["foo"], called LiteralString.

The PEP allows libraries to distinguish the type of command strings from data. Powerful, command-executing libraries try to prevent security vulnerabilities by accepting arguments separately from the SQL query or shell command. However, these libraries have no way to prevent programmers from, say, using f-strings to embed arguments within the command string, which can allow malicious users to execute arbitrary commands (called "SQL/shell injection"). With this PEP, libraries can rely on type checkers to prevent such common, undesired uses.

Scala has a very similar concept that is used to prevent SQL injection at compile time. [5] We also discuss the drawbacks of alternative approaches, such as security linters, full taint analysis, and NewTypes [6].

Since we have reached consensus on the PEP in typing-sig [2], we wanted to get your comments and suggestions before su... continue reading

naive kindleBOT
#

Currently, some type checkers rightly complain that a method is decorated
with abc.abstractmethod when the class's type does not inherit from
ABCMeta. Adding a metaclass is a fairly heavy dependency since you're
forced to poison all of your other metaclasses with the same base
metaclass. It also brings in possibly unwanted type registration that ABC
comes with.

Now that abstractmethod's usage is extremely well-understood, would it make
sense to move the checking logic out of ABCMeta?

It could either be put into object so that no base class is necessary (at
the cost of slightly slower class creation), or else in a non-meta base
class (say, HasAbstractMethods) now that __init_subclass__ is in all extant
versions of Python. Inheriting from such a non-meta base class would avoid
the poisoning problem described above.

As far as I can tell, neither solution breaks code.

Best,

Neil

naive kindleBOT
#

Hello all,

Sorry to bother you again with the generic thing. Golang will soon release a new version with Generics. I like their way of doing it. Like Rust, they don’t bother with TypeVars. It makes you wonder why we are not doing something similar in Python.
[T: Type] ——> T is invariant and Type is the bound. [T] is Ok.
[T_co:: Type] ——> T is covariant and Type is the bound. [T_co::] is Ok.
[T_contra::: Type] —-> T is contravariant and Type is the bound . [T_contra:::] is Ok.

Or some other symbol next to : to distinguish the variance.

[T: Type1 | Type2] —-> T is invariant and Type1 and Type2 are the constraints.
Or anything else to communicate these are constraints (maybe enclose them in parentheses — tuple)

Example:

class IndexableT_co:::
def __getitem__(self, n: int) -> T_co: …

@dataclass
class AInt:
seq: list[int]

def \_\_getitem\_\_(self, n: int) -> Int:
    return self.seq[n] 

@dataclass
class BStr:
seq: list[str... continue reading

naive kindleBOT
#

Thank you for submitting PEP 670 (Convert macros to functions in the
Python C API)!
The steering council is still discussing it. We're not ready to accept
the PEP as a whole, but there are parts on which we agree unanimously.
To unblock the work, we're making the following pronouncements:

All other things being equal, static inline functions are better than
macros.

Specifically, inline static functions should be preferred over
function-like macros in new code. Please add a note about this to PEP 7.

The performance impact of changing macros to static inline functions is
negligible.

The performance changes are indistinguishable from noise caused by other
factors, such as layout changes and specific compiler optimizations.
It's possible that this isn't true in all cases. If any are found, they
should be kept as macros and added to the benchmark suite to avoid
regressions.
More generally, if there is a non-obvious reason for a conscious design
decision, it should be explaine... continue reading

naive kindleBOT
#

Hi all,
In the dark moments of code optimization, line_profiler from Robert Kern (now https://github.com/pyutils/line\_profiler) helped me a lot. To ease the usage of this tool I created a GUI, namely "Line Profiler GUI".
The installation is just a pip command away (choose your favorite python Qt binding):

$ pip install line-profiler-gui[PySide2]
$ pip install line-profiler-gui[PyQt5]

The code is available on Github: https://github.com/Nodd/lineprofilergui

Happy optimization!
Joseph

naive kindleBOT
naive kindleBOT
#

I wanted to generate all the dates between two date ranges for which I was
using count function in the itertools and to my surprise count function
doesn't support datetime operation.

For example

import datetime
from itertools import count
count(datetime.date.today(), datetime.timedelta(1))

Why is count function only limited to numbers shouldn't we make it generic
that it should support operation like datetime where addition between the
objects is possible.

Would like to hear thoughts from you people.

naive kindleBOT
#

Greetings list,

Here is a nobody proposing something to be picked
up by more skilled people.

The urllib deprecation thread is scary for many reasons.
I cannot just ignore it as it affects me as a noob user.
The security issues makes one think if we continue shipping
something that always has known open holes,
can we sleep soundly?

On the other hand, removing the library completely is
weird. How can programming be fun if it does not
provide 'internet'-related libraries? Heu, should users
start diving into C stuffs?

Mere patches will work but seeing advances in
3rd party libraries, one think that to have something
comparable in the stdlib seems a big task.
A minimal library will work but is it the solution?

I had the opportunity to get some ideas about how
the asyncio implementation went. Folks who had
really amazing async experience helped, even wrote PEPs.
I think setting up a workgroup with experienced
urllib devs and 3rd party library authors will be very productive.
It might be... continue reading

naive kindleBOT
#

Over the last couple of years I've been tidying up the pathlib internals,
with a view towards adding an AbstractPath class to the hierarchy. Users
would be able to subclass AbstractPath to implement other kinds of
filesystems: s3, google cloud storage, pandas, ftp, git, zip and tar files,
etc. By implementing some abstract methods (stat(), iterdir(), open(), etc)
they'd benefit from a number of derived methods (is_dir(), glob(),
read_text(), etc). There's already a healthy ecosystem of PyPI packages
attempting this, but there's presently no officially-supported route.

I've now submitted a PR that adds an initial underscore-prefixed
implementation of this class: https://github.com/python/cpython/pull/31085.
The implementation is simple: wherever Path calls functions in os, io, pwd,
etc, AbstractPath instead raises NotImplementedError. The Path class
becomes an implementation of AbstractPath.

These methods directly raise NotImplementedError: cwd(), stat(), iterdir(),
readlink(), reso... continue reading

naive kindleBOT
#

Thank you PEP authors for producing a very well written and laid out PEP.
That made it easy to understand the proposal, rationale, and alternatives
considered. We agree that the existing typing.Callable syntax, while
capable, is less than ideal for humans. That said, we deliberated last week
and ultimately decided to reject PEP-677 Callable Type Syntax.

Why? Several considerations led us here:

  1. We feel we need to be cautious when introducing new syntax. Our new
    parser presents understandably exciting opportunities but we don’t want its
    existence to mean we add new syntax easily. A feature for use only in a
    fraction of type annotations, not something every Python user uses, did not
    feel like a strong enough reason to justify the complexity needed to parse
    this new syntax and provide meaningful error messages. Not only code
    complexity, humans are also parsers that must look forwards and backwards.

  2. While the current Callable[x, y] syntax is not loved, it does work. This
    PEP isn’t ... continue reading

naive kindleBOT
#

All,

I know that /os.path/ includes a function /expandvars(..)/ which expands
any environment variables in a given path, but from looking at the
/pathlib/ documentation It seems there is
no equivalent to /os.path.expandvars(..) on any class/ in /pathlib/, and
the recommendation seems to be to use /pathlib/ to do any and all path
manipulations, with the exception of expanding environment variables.

It appears that the recommended /pathlib/ compatible code to fully
convert any file path (which may have environment variables and or ~ or
~user constructs) to a fully resolved absolute path is :

import os.path

import pathlib

given\_path = input('Provide the full path')

abs\_path =
pathlib.Path(os.path.expandvars(pathlib.Path(givenpath).expanduser())).resolve()

It seems to me that /pathlib.Path/ would benefit massively from an
/os.path.expandvars(..)/ equivalent - so that the equivalent code could be :

import os.path

import pathlib

given\_path ... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/IJSOTVIDYLWRYEXFZCOFWSCIYHORQS6Z/)
naive kindleBOT
#

Hi,

About a month ago, I opened BPO 46337 with regard to urllib's inflexible
handling of URL schemes. (Another discussion (from 2013) occured in
BPO-18828.) In my ticket, I proposed supplementing the hard-coded uses_*
scheme lists that control URL parsing and joining behavior with an enum
that may override behavior when calling a function that would effect it.
(More detail is available in BPO 46337 and potential code is available
in cpython PR#30520.)

Do you think this would be a generally useful/good thing to have?
Comments, questions, feedback?

This would be my first interaction with Python development, so I'm not
too certain about where everything goes. Rereading the dev docs, it
looks like the appropriate channel for discussion of this is on this
mailing list, not BPO. Github just reminded me that my PR is stale, so I
figured I'd retry this whole thing with a closer look at the dev
documentation - thanks for bearing with me :)

--
Lincoln Auster
They/Them

naive kindleBOT
#

Hi all,

It fills us with astronomical joy to announce the release of poliastro
0.16.2! 🚀

(Yes, we skipped 0.16.1 because of unimportant infrastructure problems)

poliastro is an open source (MIT) pure Python library for interactive
Astrodynamics and Orbital Mechanics, with a focus on ease of use, speed,
and quick visualization. It provides a simple and intuitive API, and
handles physical quantities with units. It is used in academia and the
industry by people from all around the world.

You can install it using pip or conda:

pip install poliastro
conda install poliastro --channel conda-forge

This release adds support for Python 3.10, fixes some bugs found after
0.16.0, adds a new example to read OMM and TLE data, and restructures
the API documentation to make it more useful. You can read the full
release notes here:

https://docs.poliastro.space/en/v0.16.2/changelog.html#poliastro-0-16-2-
2022-02-10

If you want to learn more about poliastro, don't miss my... continue reading

naive kindleBOT
#

Hi -
Newbie post here...

We need to be able to produce both arm64 and x86_64 builds of cpython on a single machine. I can see that, by default, it chooses the target architecture based on the current running architecture. The docs say that we can target one platform from the other, but it's not specific about how to do that?

I figure this is some sort of 'configure' option -- maybe "--build"? -- but so far nothing I've tried has worked.

Can someone help point us in the right direction? What's the magic to specify one target or the other?

Thank you!
Jeff

naive kindleBOT
#

Hello, consider:

class C:
@property
def f(self) -> int:
return 2

class D(C):
pass

D().f = 2

Gives:

Traceback (most recent call last):
File "/home/neil/src/cmm/a.py", line 10, in <module>
D().f = 2
AttributeError: can't set attribute 'f'

This can be a pain to debug when the property is buried in a base class.
Would it make sense to mention the reason why the attribute can't be set,
namely that it's on a property without a setter?

Best,

Neil

naive kindleBOT
#

Hi,

Would it make sense to move the pythoncapi_compat project under the
GitHub Python or PSF organization to make it more "official" and a
little bit more sustainable?

"The pythoncapi_compat project can be used to write a C extension
supporting a wide range of Python versions with a single code base. It
is made of the pythoncapi_compat.h header file and the
upgrade_pythoncapi.py script."

Documentation: https://pythoncapi-compat.readthedocs.io/en/latest/
GitHub: https://github.com/pythoncapi/pythoncapi\_compat

In the past, I managed to move my personal pyperf project under the
PSF organization. Now other core developers are contributing and using
it. It's better than having it as a personal project.

pythoncapi_compat respects the PSF requirements to move a project in
the GitHub PSF organization: contributors are required to respect the
PSF Code of Conduct and the project has 3 maintainers (Dong-hee Na,
Erlend E. AAsland and me).


Some context.

Incompatible C API changes ... continue reading

naive kindleBOT
#

Hi,

This is a follow-up RFC on PR #30520 (BPO 46337) with regard to urllib's
potentially inflexible scheme-based URL manipulation. In my ticket, I
proposed supplementing the hard-coded uses_* scheme lists that control
URL parsing and joining behavior with an optional enum set that may
override behavior when calling a function that would require it. (More
detail is in that BPO and code is obviously in that PR.)

It's been about a month since I wrote that PR, and it was marked stale a
day or two ago. Would anyone be willing to give it a look for feedback
and a potential merge?

As a side note, I was recently made aware of the bit of an existential
crisis wrt urllib. Without addressing it directly, I would like to say
that my PR is small, backwards compatible, and focused exclusively on
URL parsing, which (at least in my reading of the relevant thread) is
still considered to be useful if a bit fragile. I wouldn't consider my
PR to be in conflict with any ongoing scope reconsideration (t... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-02-04 - 2022-02-11)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7178 (+34)
closed 51272 (+50)
total 58450 (+84)

Open issues with patches: 2912

Issues opened (63)

#42548: debugger stops at breakpoint of pass that is not actually re
https://bugs.python.org/issue42548 reopened by iritkatriel

#44006: symbol documentation still exists
https://bugs.python.org/issue44006 reopened by vstinner

#45459: Limited API support for Py_buffer
https://bugs.python.org/issue45459 reopened by vstinner

#46430: intern strings in deepfrozen modules
https://bugs.python.org/issue46430 reopened by christian.heimes

#46639: Ceil division with math.ceildiv
https://bugs.python.org/issue46639 opened by Vladimir Feinberg

#46640: Python can now use the C99 NAN constant or __builtin_nan()
https://bugs.python.org... continue reading

naive kindleBOT
naive kindleBOT
#

Hello,

I had opened this bug because I had a bad regex in my code that was causing
python to hang in the regex evaluation: https://bugs.python.org/issue46627.
I have fixed the problem with that specific regex, but more generally I
think it would be good to have a timeout option that could be configurable
when compiling the regex so that if the regex didn't complete within the
specified timeframe, it would abort and throw an exception.

The bug was closed as Won't Fix and it was suggested that I bring up my
idea here. The suggestion made to me on the bug was to read Mastering
Regular Expressions and get better at writing regexes. I will take this
advice, but this isn't really a reasonable solution to my problem for a few
reasons.
My use case is log parsing and I have a large number of regexes that run
over many different log lines. With the volume of regexes I have, it's hard
to make sure every regex has no potential problems, especially when the
pathological behavior only occurs on ce... continue reading

naive kindleBOT
naive kindleBOT
#

Hi everyone,

I would like to ask a question about an issue that we faced regarding profiling memory usage:

We have implemented a custom memory profiler using PyMem_GetAllocator/PyMem_SetAllocator APIs like tracemalloc. Right now, we are facing an issue with numpy: numpy seems to have its own memory allocator and they use PyTraceMalloc_Track APIs to notify tracemalloc about the allocation. A simple search on GitHub reveals there are more projects using this approach: https://github.com/search?q=PyTraceMalloc\_Track&type=code which is fine. I believe it is common to use custom memory allocators for scientific computation which makes perfect sense.

However, I would have expected to have at least some form of PyMem_NotifyAllocator type of API instead of a one that is specific to tracemalloc? I might be missing some context here.

WDYT?

Best,

naive kindleBOT
#

from pathlib import Path
p = Path('/etc/swift/object.ring.gz')
p.suffix
'.gz'
p.suffixes
['.ring', '.gz']
p.stem
'object.ring'
p.stems
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'PosixPath' object has no attribute 'stems'

I think it would have been nice if .stems = ['object', '.ring']

The idiomatic answer for this persons definition of "true" stem:

https://stackoverflow.com/questions/31890341/clean-way-to-get-the-true-stem-of-a-path-object

... seemed to [ab]use with_suffix(‘’), but .stems[0] might be more obvious.

What do you think?

--
Clay Gerrard

Clay Gerrard
210 788 9431

naive kindleBOT
#

Eddie and I would appreciate your feedback on this proposal to support
treating some objects as "immortal". The fundamental characteristic
of the approach is that we would provide stronger guarantees about
immutability for some objects.

A few things to note:

  • this is essentially an internal-only change: there are no
    user-facing changes (aside from affecting any 3rd party code that
    directly relies on specific refcounts)
  • the naive implementation shows a 4% slowdown
  • we have a number of strategies that should reduce that penalty
  • without immortal objects, the implementation for per-interpreter GIL
    will require a number of non-trivial workarounds

That last one is particularly meaningful to me since it means we would
definitely miss the 3.11 feature freeze. With immortal objects, 3.11
would still be in reach.

-eric


PEP: 683
Title: Immortal Objects, Using a Fixed Refcount
Author: Eric Snow ericsnowcurrently@gmail.com, Eddie Elizondo
<eduardo.elizondoru... continue reading

naive kindleBOT
naive kindleBOT
#

Hi,

I've been thinking that it would be nice if regex match objects could be deconstructed with pattern matching. For example, a simple .obj parser could use it like this:

match re.match(r"(v\|f) (\d+) (\d+) (\d+)", line):
    case ["v", x, y, z]:
        print("Handle vertex")
    case ["f", a, b, c]:
        print("Handle face")

Sequence patterns would extract groups directly. Mapping patterns could be used to extract named groups, which would be nice for simple parsers/tokenizers:

match re.match(r"(?P<number>\d+)\|(?P<add>\+)\|(?P<mul>\*)", line):
    case {"number": str(value)}:
        return Token(type="number", value=int(value))
    case {"add": str()}:
        return Token(type="add")
    case {"mul": str()}:
        return Token(type="mul")

Right now, match objects aren't proper sequence or mapping types though, but that doesn't seem too complicated to achieve. If this is something that enough people would consider useful I'... continue reading

naive kindleBOT
#

Hi all,

I'm stumbling with an issue where the co_firstlineno behavior changed from
Python 3.9 to Python 3.10 and I was wondering if this was intentional or
not.

i.e.: Whenever a code is compiled in Python 3.10, the code.co_firstlineno
is now always 1, whereas previously it was equal to the first statement.

Also, does anyone know if there is any way to restore the old behavior in
Python 3.10? I tried setting the module.lineno but it didn't really make
any difference...

As an example, given the code below:

import dis

source = '''
print(1)

print(2)
'''

initial_module = compile(source, '<nofilename>', 'exec', PyCF_ONLY_AST, 1)

import sys
print(sys.version)

for i in range(2):
module = Module([initial_module.body[i]], [])
module_code = compile(module, '<no filename>', 'exec')
print(' --> First lineno:', module_code.co_firstlineno)
print(' --> Line starts :', list(lineno for offset, lineno in
dis.findlinestarts(module_code)))
print('---- dis ---')
... continue reading

naive kindleBOT
#

Wing 8.2 adds additional support for branching, stashing/shelving, and
other operations for Git and Mercurial, improves Extract Function/Method
refactoring, fixes display of some data types in the Source Assistant,
and makes a number of other improvements in code inspection,
reformatting, and search capabilities.

Details: https://wingware.com/news/2022-02-17
Downloads: https://wingware.com/downloads

== About Wing ==

Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing's deep code analysis provides
auto-completion, auto-editing, and refactoring that speed up
development. Its top notch debugger works with any Python code, locally
or on a remote host, container, or cluster. Wing also supports
test-driven development, version control, UI color and layout
customization, and includes extensive documentation and support.

Wing is available in thr... continue reading

naive kindleBOT
#

Hi folks, as illustrated in faster-cpython#150 [1], we have implemented a mechanism that supports data persistence of a subset of python date types with mmap, therefore can reduce package import time by caching code object. This could be seen as a more eager pyc format, as they are for the same purpose, but our approach try to avoid [de]serialization. Therefore, we get a speedup in overall python startup by ~15%.

Currently, we’ve made it a third-party library and have been working on open-sourcing.

Our implementation (whose non-official name is “pycds”) mainly contains two parts:
importlib hooks, this implements the mechanism to dump code objects to an archive and a Finder that supports loading code object from mapped memory.
Dumping and loading (subset of) python types with mmap. In this part, we deal with 1) ASLR by patching ob_type fields; 2) hash seed randomization by supporting only basic types who don’t have hash-based layout (i.e. dict is not supported); 3) interned string... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-02-11 - 2022-02-18)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7218 (+40)
closed 51299 (+27)
total 58517 (+67)

Open issues with patches: 2932

Issues opened (52)

#46725: Unpacking without parentheses is allowed since 3.9
https://bugs.python.org/issue46725 opened by pablogsal

#46726: Thread spuriously marked dead after interrupting a join call
https://bugs.python.org/issue46726 opened by Kevin Shweh

#46727: Should shutil functions support bytes paths?
https://bugs.python.org/issue46727 opened by Jelle Zijlstra

#46729: Better str() for BaseExceptionGroup
https://bugs.python.org/issue46729 opened by iritkatriel

#46731: posix._fcopyfile flags addition
https://bugs.python.org/issue46731 opened by devnexen

#46732: object.__bool__ docstring is wrong
https://bugs.python.org/issue46732 ... continue reading

naive kindleBOT
#

*More than ten years ago, a video game known as "Minecraft" was in its
beta testing-phase.*End-users had many suggestions for Minecraft.

*The Mojang team (developers of Minecraft ) used a web platform for
suggested changes to the videogame. **The website was known as "Get
Satisfaction" *The GetSatisfaction page for Minecraft as so easy to use
that sometimes children posted bug reports for Minecraft. Also, several
less tenable thoughts fielded by people of the same mental maturity were
quickly filtered out and shot down.

More than ten years ago, there was a system for a major software project
which did a good job of floating good ideas to the top and sinking bad
ideas to the bottom.

GetSatisfaction used a voting system, and the most popular suggestions
were often implemented by Mojang's development team. When the Microsoft
corporation bought Minecraft, the Minecraft GetSatisfaction page died, so
it is difficult to look at now.

*Get Satisfaction allowed beta-testers to pri... continue reading

#

Dear,

I would like to contribute to the Python Documentation, to announce the
availability of Python offline documentation to Google Android
devices/Tablets world. Here are the apps available at Google Play store
(free):

Python 3.10 complete HTML offline docs app:
https://play.google.com/store/apps/details?id=com.mohee.jarada.java.pythoncompletehtml310offlinedocs

Python 3.7.4 complete HTML offline docs app:
https://play.google.com/store/apps/details?id=hu.budapest.python.mohi1stapp.hu.budapest.mohi1stAndroidApp

Kindly asking if possible at your Python documentation official site to put
a links (at downloads side), so a lot of Pythonist will able to reach it,
across the globe.

Much appreciated in advance and Best Regards,
Mohee Jarada (Budapest - Hungary)

naive kindleBOT
naive kindleBOT
#

Thanks to all those that provided feedback. I've worked to
substantially update the PEP in response. The text is included below.
Further feedback is appreciated.

-eric


PEP: 683
Title: Immortal Objects, Using a Fixed Refcount
Author: Eric Snow ericsnowcurrently@gmail.com, Eddie Elizondo
eduardo.elizondorueda@gmail.com
Discussions-To:
https://mail.python.org/archives/list/python-dev@python.org/thread/TPLEYDCXFQ4AMTW6F6OQFINSIFYBRFCR/
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 10-Feb-2022
Python-Version: 3.11
Post-History: 15-Feb-2022
Resolution:

Abstract

Currently the CPython runtime maintains a
small amount of mutable state <Runtime Object State_>_ in the
allocated memory of each object. Because of this, otherwise immutable
objects are actually mutable. This can have a large negative impact
on CPU and memory performance, especially for approaches to increasing
Python's scalability. The solution proposed here ... continue reading

naive kindleBOT
#

It crashes because it tries to convert 10**400 to a float and that fails:

10400 / 1e200
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
10
400 / 1e200
OverflowError: int too large to convert to float

But with two ints it succeeds:

10400 / 10200
1e+200

Note that 1e200 is an integer:

1e200.is_integer()
True

So that could losslessly be converted to int, and then the division would succeed:

10**400 / int(1e200)
1e+200

So could/should 10**400 / 1e200 be implemented to do that instead of raising the error? Or is it a too rare use case and not worth the effort, or does something else speak against it?

naive kindleBOT
#

This was discussed here: https://bugs.python.org/issue46757

This came up because I had a dataclass subclass to flax.linen.Module that
had its own post-init. When I figured out that I needed to call super, I
did so. Later, when I refactored my code to remove the superclass, the
super-call was broken.

It have been much simpler to always call super in __post_init__ from the
start. The proposal on the bug report was to get in the habit of doing:

if hasattr(super(), "__post_init__"): super().__post_init__() or: try:
post_init = super().__post_init__ except AttributeError: pass else:
post_init()

I think it will be difficult to convince projects to do this.

Best,

Neil

naive kindleBOT
#

Hi everyone,

I'm sure there's a clear answer, probably written some place obvious,
but I wonder if there is a reason why certain functions are not linked
to console_scripts.  In particular I would think this would be good for
json.tool (though I might call it something else, like pyjson_pp).  Same
with venv. I'm sure I'm missing something obvious.

Thanks,

Eliot

naive kindleBOT
#

Hi folks, as illustrated in faster-cpython#150 [1], we have implemented a mechanism that supports data persistence of a subset of python date types with mmap, therefore can reduce package import time by caching code object. This could be seen as a more eager pyc format, as they are for the same purpose, but our approach try to avoid [de]serialization. Therefore, we get a speedup in overall python startup by ~15%.

Currently, we’ve made it a third-party library and have been working on open-sourcing.

Our implementation (whose non-official name is “pycds”) mainly contains two parts:
importlib hooks, this implements the mechanism to dump code objects to an archive and a Finder that supports loading code object from mapped memory.
Dumping and loading (subset of) python types with mmap. In this part, we deal with 1) ASLR by patching ob_type fields; 2) hash seed randomization by supporting only basic types who don’t have hash-based layout (i.e. dict is not supported); 3) interned strin... continue reading

naive kindleBOT
#

ASPP2022: 14ᵗʰ Advanced Scientific Programming in Python

a Summer School by the ASPP faculty and the Faculty of Engineering of the Mondragon University, Bilbao

https://aspp.school

Scientists spend more and more time writing, maintaining, and debugging
software. While techniques for doing this efficiently have evolved, only few
scientists have been trained to use them. As a result, instead of doing their
research, they spend far too much time writing deficient code and reinventing
the wheel. In this course we will present a selection of advanced programming
techniques and best practices which are standard in the industry, but especially
tailored to the needs of a programming scientist. Lectures are devised to be
interactive and to give the students enough time to acquire direct hands-on
experience with the materials. Students will work in pairs throughout the school
and will team up to practice the newly learned skills in a rea... continue reading

naive kindleBOT
#

Hello,

The Steering Council discussed PEP 680 -- tomllib: Support for Parsing
TOML in the Standard Library, and unanimously decided to accept it.
Congratulations!

I'll change the PEP status to Accepted. Please open a PR for Python 3.11
at your convenience.

  • Petr (on behalf of the Python Steering Council)
#

Hi,

Since Erlend and me posted PEP 670 on python-dev last October, we took
all feedback (python-dev and Steering Council) in account to clarify
the intent of the PEP and to reduce its scope (remove any risk of
backward compatibility).

PEP 670: https://python.github.io/peps/pep-0670/

Changes since the first version:

  • Stricter policy on not changing argument types and return type.
  • Better explain why pointer arguments require a cast to not emit new
    compiler warnings.
  • Macros which can be used as l-values are no longer modified by the
    PEP (I wrote PEP 674 just for that).
  • Macros having multiple return types are no longer modified by the PEP.
  • Limited C API version 3.11 no longer casts pointer arguments (move
    towards a cleaner API, but only if you opt in for that!).
  • No longer remove return values of macros "which should not have a
    return value" (this rule was complicated and in fact, all macros have
    already been fixed).
  • Add "Macros converted to functions since Python 3.8" se... continue reading
naive kindleBOT
#

Hello,
Thank you for submitting PEP 674 -- Disallow using macros as l-values!

For Py_TYPE, we respect the previous steering council's decision:
https://github.com/python/steering-council/issues/79
The Py_TYPE macro can be changed as proposed in 3.11. However, the old
SC explicitly noted that the exception only applies to Py_SET_TYPE, and
that in general, there should be a deprecation notice in some way or form.

After deliberating the proposed changes, the SC agrees that they will
make CPython better. However, we are not convinced that they should be
made right now. We see no reason to rush. We would like to ask you to
rework the PEP to reflect these suggestions.

It is not feasible to provide visible deprecation warnings for the
proposed changes. We feel that this is not a good reason to skip the
deprecation process entirely. Quite the opposite: if we need to skip a
step, we should move even more carefully than usual.

We suggest the following process:

First, add noti... continue reading

naive kindleBOT
#

Hi,

I am working with the PyCon Estonia team, helping them organise a
conference this year. The last three PyCon events were a great success and
after a year of break due to corona, we want to come back to keep on
bringing the Python community together in Tallinn.

As we are preparing for PyCon Estonia 2020, we have also announced our call
for papers. We are looking for talks on various topics. The theme this year
is "Connect. Collab. Contribute" and we want the focus of the conference to
be around the Python ecosystem. However, we are also welcoming talks on
other relevant topics - Python challenges, outstanding packages, security,
automation, AI/ML, web development, IoT, mental health for developers,
conducive work environment for coding, etc.

I would like to invite you to participate in the call for papers and be a
part of PyCon Estonia 2022 as a speaker. We are waiting for the proposals
before the 1st of April here: https://pyconestonia.typeform.com/to/HSWhN8YW

We would have a t... continue reading

naive kindleBOT
#

Hi all,

This is specifically about embedding Python on Windows, and I'm hoping some of the Windows Python devs might have some ideas or be interested in this. I have implemented a partial solution (linked below) and I'm interested to hear what other people think of this.

Currently when embedding Python both python3x.dll and python3.dll get loaded, with python3.dll redirecting stable API calls to python3x.dll. If a process embeds two different versions of Python 3, e.g., python39.dll and python310.dll they both load their respective python3.dlls. At this point I imagine you are thinking "don't do that", but bear with me... The problem comes when the Python loaded second imports an extension module linked with python3.dll. The python3.dll that it gets linked to will be the first one that was loaded, not the one that relates to the second Python that is actually doing the import. This results in a call into the wrong Python dll and 'bad things' happen.

None of this is unexpected and I'... continue reading

naive kindleBOT
#

Leo http://leoeditor.com 6.6b2 is now available on
GitHub and
pypi.

Leo is an IDE, outliner and PIM.

The highlights of Leo 6.6

  • Replace @raw and @end_raw with @section-delims.
  • Leo recognizes section references only when they appear on an otherwise
    blank line.
  • Many improvements to python-to-typescript command.
  • Improved python importer.
  • Add plugins/picture_viewer.py, a stand-alone app that displays images.
  • Add plugins/remove_duplicate_pictures.py, an app that finds duplicate
    pictures.
  • The user may choose other commands after starting
    repeat-complex-command.
  • Improvements to leoserver.py to support leointeg.
  • Many bug fixes.

6.6 Links

naive kindleBOT
#

ACTIVITY SUMMARY (2022-02-18 - 2022-02-25)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7220 ( +2)
closed 51363 (+64)
total 58583 (+66)

Open issues with patches: 2939

Issues opened (46)

#46793: expose expat XML billion laughs attack mitigation APIs
https://bugs.python.org/issue46793 opened by gregory.p.smith

#46794: Please update bundled libexpat to 2.4.6 with security fixes (5
https://bugs.python.org/issue46794 opened by sping

#46797: ast.Constant.n deprecated without warning
https://bugs.python.org/issue46797 opened by jwilk

#46798: xml.etree.ElementTree: get() doesn't return default value, alw
https://bugs.python.org/issue46798 opened by padremayi

#46799: ShareableList memory bloat and performance improvement
https://bugs.python.org/issue46799 opened by tcl326

#46803: Item not shown when using mouse whee... continue reading

naive kindleBOT
#

Hi All,

we are using the python 3.9.5 version in our application.

In 3.9.5 it is using libexpat 2.2.8 version, as part of the Black duck scan, it is showing critical vulnerabilities in libexpat 2.2.8.

(CVE-2022-22824
CVE-2022-23990
CVE-2022-23852
CVE-2022-25236
CVE-2022-22823)

when there are any issues ( security issues ) in external modules like OpenSSL, bzip2, and zlib we were able to get the latest code and build as it is straightforward, but libexpat is an internal module to the python and we don't see how we can upgrade libexpat alone in python 3.9.5

So is there a way we can build python (ex 3.9.5) which is already carrying libexpat 2.2.8 so that it will link to the latest libexpat version (2.4.6 - fixed security issues).

Another solution when we searched over the net and from the mails what we came to know is we need to wait for Python 3.9.11 where this will be linked to libexpat 2.4.6.

Any inputs on this will be helpful.

Thanks,
Raghu

Internal Use - Confidential

naive kindleBOT
#

I've updated PEP 683 for the feedback I've gotten. Thanks again for that!

The updated PEP text is included below. The largest changes involve
either the focus of the PEP (internal mechanism to mark objects
immortal) or the possible ways that things can break on older 32-bit
stable ABI extensions. All other changes are smaller.

Given the last round of discussion, I'm hoping this will be the last
round before we go to the steering council.

-eric


PEP: 683
Title: Immortal Objects, Using a Fixed Refcount
Author: Eric Snow ericsnowcurrently@gmail.com, Eddie Elizondo
eduardo.elizondorueda@gmail.com
Discussions-To:
https://mail.python.org/archives/list/python-dev@python.org/thread/TPLEYDCXFQ4AMTW6F6OQFINSIFYBRFCR/
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 10-Feb-2022
Python-Version: 3.11
Post-History: 15-Feb-2022, 19-Feb-2022, 28-Feb-2022
Resolution:

Abstract

Currently the CPython runtime maintains a
`small amount of mutable ... continue reading

naive kindleBOT
#

We’ve just published the October, November and December steering council
update for 2021, also included below:

https://github.com/python/steering-council/blob/main/updates/2021-10-steering-council-update.md
https://github.com/python/steering-council/blob/main/updates/2021-11-steering-council-update.md
https://github.com/python/steering-council/blob/main/updates/2021-12-steering-council-update.md

Just as a reminder, if you have any questions or concerns, feel free to
contact us or open an issue in the SC repo:
https://github.com/python/steering-council

October 11

  • SC met with the Developer-in-Residence and provided feedback on the
    Developer-in-Residence activity blog.
  • SC decided to keep 2020 dates for 2021 election.
  • SC discussed the draft about the SC's position on the PEP 649 / PEP
    563 situation (stringified annotations) and provided feedback.
  • SC discussed whether or not they should extend their weekly meetings
    and/or do more async communications. The... continue reading
#

Hi,

I built cpython on a mac OSX 12.01. Python runs well.
When starts, Python shows that version info which looks good:
'Python 3.11.0a5+ (heads/fix-issue-43352:f899da7fe5, Feb 25 2022, 10:04:53) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin'

But when I want to used it in VSCode to debug a script, I have the following message:

This version of python seems to be incorrectly compiled
(internal generated filenames are not absolute).
This may make the debugger miss breakpoints.
Related bug: http://bugs.python.org/issue1666807

What do I miss ? I looked for a specific option in ./configure but seen nothing ?
Can someone help me please ?
Thank

Yves

naive kindleBOT
#

Hi,

Cinder https://github.com/facebookincubator/cinder is Meta’s
performance-oriented version of CPython 3.8. It has been in use as the
production Python behind Instagram server for years, as well as powering
various other Python applications across Meta.

We are interested in making the improvements in Cinder more broadly
available to the Python community. As a collection of features and
components built on top of CPython, we’d like to:

  1. Merge the feature into CPython for core features that are highly
    coupled with CPython internals (after we port it over to the main branch)
  2. For features that can work as extension modules (like Cinder JIT) -
    extract them as a new open source standalone pip-installable extension
    module.
  3. To enable the pip-installable extension module, we will need to add a
    few extension hooks to CPython,
    which we intend to carve out and port over to the main branch in order
    to merge upstream.

Please read more about our upstreamin... continue reading

naive kindleBOT
#

I'm sorry for reposting, but this message got stuck in moderation
approval for 5 days so I figured I should try again.

I'd like to propose extending the for statement to include conditionals
akin to comprehensions in order to simplify for loop statements:

 `for .. in .. if ..:`

E.g.

 for x in y if x in c:
     some\_op(x)

which is functionally equivalent as

 for x in y:
     if x not in c:
         continue
     some\_op(x)

The for .. in .. if syntax is a well-known construct from list
comprehension syntax [1]. Other alternative ways to do this with list
comprehension is:

 for x in (a for a in y if c):

or

 it = (a for a in y if c)
 for x in it:

Without having examined all use cases, I believe the same syntax should
be applied this syntax as for asynchronous comprehensions.

[1] PEP 202 - List Comprehensions
[2] PEP 530 - Asynchronous Comprehensions

Best regards,
Svein Seldal

naive kindleBOT
#

Hi,

Currently shutil.copyfileobj returns nothing.
I would like to be able to find out how many bytes were copied.

Whilst most file-like objects have a .tell() which you could use, some don’t, and .tell() is not guaranteed to measure the number of bytes, it could measure with other units.

I don’t think changing the return value from None to not-None would be backwards incompatible.

We could also do the same change for all other shutil.copy* methods (except copytree).

Looking at the code, this seems straightforward to implement.

Existing code:

def copyfileobj(fsrc, fdst, length=0):
    """copy data from file-like object fsrc to file-like object fdst"""
    # Localize variable access to minimize overhead.
    if not length:
        length = COPY_BUFSIZE
    fsrc_read = fsrc.read
    fdst_write = fdst.write
    while True:
        buf = fsrc_read(length)
        if not buf:
            break
        fdst_write(buf)

New code:

def copyfileobj(fsrc, fdst, length=0):
    ... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/ZKVI4DE7RLYQNLV3XYUUW24FOO57WB5P/)
naive kindleBOT
#

Hi everyone,

Unfortunately, we have some issues marked as release blockers that are
holding the 3.11.0a6 release.
Some of these issues have been solved but we still have a couple of them.
Hopefully, we will solve these
soon and I will proceed with the release.

Thanks for your understanding.

Regards from sunny Salamanca,
Pablo Galindo Salgado

naive kindleBOT
#

Hi All,

Steve Dower, Eryk Sun and I have been working on improving the
documentation around how sys.path is initialised and therefore how Python
modules are found.

We're moving the details from
https://docs.python.org/3.11/using/windows.html#finding-modules
to a platform-agnostic new section in
https://docs.python.org/3.11/using/cmdline.html

We're aiming to have one place in the documentation where all the ways to
customize sys.path (PYTHONPATH, ._pth, site, etc) are at least mentioned.

We'd appreciate further community feedback on the changes before they are
merged.
https://bugs.python.org/issue31582
https://github.com/python/cpython/pull/31082

Thank you,
Russel

naive kindleBOT
#

I have created a pip package that converts plain English to a datetime object. It is called textime.
Pass "Second of March of two thousand and twenty two" to its main function and you'll get a datetime object like "2022-03-02 00:00:00".
Not quite sure what it's for. It's just fun.

https://github.com/Eric-Mendes/textime
https://pypi.org/project/textime/

This project is open source and contributions are welcome and appreciated.

Cheers!

naive kindleBOT
#

The code I'm currently working on involves parsing binary data. If I ask for, say, 4 bytes, it's because I actually need 4 bytes and if the file doesn't have 4 bytes for me, it's malformed. Because f.read(4) can silently return less than 4 bytes and I don't want to have to explicitly double check every read, I'm using a wrapper function.

def read_exact(f, size):
data = f.read(size)
if len(data) < size:
raise EOFError(f"expected read of size {size}, got {len(data)}")
return data

I don't think my scenario of "give me exactly the number of bytes/characters I asked for or fail noisily" is particularly uncommon, so I think that a similar function should be added to the standard library somewhere. I guess as a function in io?

Admittedly, as my own code demonstrates, implementing it yourself if you need it is trivial, so it may not actually be worth adding.

naive kindleBOT
#

I am new to open source and think to contribute to python .
I was going through the developer guide and when i run this code "./python -m test -j3" on my terminal i got this result which say it fail .Now can someone tell me this is normal or happning to me only . If this happen to everyone how can i fix this
== Tests result: FAILURE ==
380 tests OK.
2 tests failed:
test_compileall test_distutils
43 tests skipped:
test_asdl_parser test_check_c_globals test_clinic test_curses
test_dbm_gnu test_dbm_ndbm test_devpoll test_epoll test_fcntl
test_fork1 test_gdb test_grp test_ioctl test_kqueue
test_multiprocessing_fork test_multiprocessing_forkserver test_nis
test_openpty test_ossaudiodev test_pipes test_poll test_posix
test_pty test_pwd test_readline test_resource test_smtpnet
test_socketserver test_spwd test_syslog test_threadsignals
test_timeout test_tix test_tk test_ttk_guionly test_urllib2net
test_urll... continue reading

naive kindleBOT
#

Do we officially support NetBSD? Do you know how to find out if we do? You
might think to look at
https://www.python.org/dev/peps/pep-0011/#supporting-platforms , but that
just loosely defines the criteria and it still doesn't list the actual
platforms we support. (BTW I don't know if we do officially support NetBSD,
hence this email.)

I think we should clarify this sort of thing and be a bit more upfront with
the level of support we expect/provide for a platform. As such, I want to
restructure PEP 11 to list the platforms we support, not just list the
platforms we stopped supporting. To do this I want define 3 different tiers
that outline what our support requirements and promises are for platforms.

Tier 1 is the stuff we run CI against: latest Windows, latest macOS, Linux
w/ the latest glibc (I don't know of a better way to define Linux support
as I don't know if a per-distro list is the right abstraction). These are
platforms we won't even let code be committed for if they would b... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-02-25 - 2022-03-04)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7224 ( +4)
closed 51425 (+62)
total 58649 (+66)

Open issues with patches: 2938

Issues opened (48)

#44807: typing.Protocol silently overrides __init__ method of delivere
https://bugs.python.org/issue44807 reopened by gvanrossum

#46623: test_zlib: test_pair() and test_speech128() fail with s390x ha
https://bugs.python.org/issue46623 reopened by petr.viktorin

#46823: Add LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE combined opcode
https://bugs.python.org/issue46823 reopened by brandtbucher

#46858: mmap constructor resets the file pointer on Windows
https://bugs.python.org/issue46858 opened by benrg

#46860: --with-suffix not respected on case-insensitive file systems
https://bugs.python.org/issue46860 opened by brett.ca... continue reading

naive kindleBOT
#

Currently the class can inherit from arbitrary objects, not only types.
If the object was not designed for this you can get a mysterious
mistake, e g.:

class A(1): ...
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: int() takes at most 2 arguments (3 given)

If the object's constructor is compatible with type constructor by
accident you can an unexpected result. To prevent this we usually add an
explicit __mro_entries__() method which raises an exception.

I propose to make __mro_entries__() mandatory if a base is not a type
instance (with a deprecation period).

naive kindleBOT
#

As PEP-Delegate, I’m very happy to accept PEP 676 (PEP Infrastructure Process).

https://www.python.org/dev/peps/pep-0676/

https://discuss.python.org/t/request-for-comment-making-pep-rendering-self-contained/10774/98

Congratulations to Adam Turner and everyone who participated in the discussions. This will make reading and authoring PEPs a much nicer experience.

Cheers,
-Barry

naive kindleBOT
#

There are no easy releases these days! :sweat: After a week of delay due to
several release blockers, buildbot problems and pandemic-related
difficulties here is 3.11.0a6 for you to test.

https://www.python.org/downloads/release/python-3110a6/

This is an early developer preview of Python 3.11

Major new features of the 3.11 series, compared to 3.10

Python 3.11 is still in development. This release, 3.11.0a6 is the sixth
of seven planned alpha releases.

Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.

During the alpha phase, features may be added up until the start of the
beta phase (2022-05-06) and, if necessary, may be modified or deleted up
until the release candidate phase (2022-08-01). Please keep in mind that
this is a preview release and its use is not recommended for production
environments.

Many new features for Python 3.11 are still being planned and wr... continue reading

#

There are no easy releases these days! :sweat: After a week of delay due to
several release blockers, buildbot problems and pandemic-related
difficulties here is 3.11.0a6 for you to test.

https://www.python.org/downloads/release/python-3110a6/

This is an early developer preview of Python 3.11

Major new features of the 3.11 series, compared to 3.10

Python 3.11 is still in development. This release, 3.11.0a6 is the sixth
of seven planned alpha releases.

Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.

During the alpha phase, features may be added up until the start of the
beta phase (2022-05-06) and, if necessary, may be modified or deleted up
until the release candidate phase (2022-08-01). Please keep in mind that
this is a preview release and its use is not recommended for production
environments.

Many new features for Python 3.11 are still being planned and written.
Among the new m... continue reading

naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.22.3. NumPy 1.22.3 is a maintenance release that fixes bugs discovered
after the 1.22.2 release. The most noticeable fixes may be those for
DLPack. One that may cause some problems is disallowing strings as inputs
to logical ufuncs. It is still undecided how strings should be treated in
those functions and it was thought best to simply disallow them until a
decision was reached. That should not cause problems with older code.

The Python versions supported in this release are 3.8-3.10. Wheels can be
downloaded from PyPI https://pypi.org/project/numpy/1.22.3; source
archives, release notes, and wheel hashes are available on Github
https://github.com/numpy/numpy/releases/tag/v1.22.3. Note that the Mac
wheels are now based on OS X 10.14 rather than 10.9 that was used in
previous NumPy release cycles. 10.14 is the oldest release supported by
Apple. Linux users will need pip >= 0.19.3 i... continue reading

naive kindleBOT
#

I often wish to perform the action of subprocess.check_output, i.e. print STDOUT live, and check the return code is 0 on exit. However if there is an error, I would like the STDERR to be printed. When looking at log files and just seeing the return code is often not very beneficial.

E.g.:

subprocess.check_call(['ping', '-c', '1', 'github.com2'])

Will generate this error:

subprocess.CalledProcessError: Command '['ping', '-c', '1', 'github.com2']' returned non-zero exit status 2.

Here we are left wondering why it failed, on real world examples it becomes critical to be able to see what the actual error is. So I find I always have to wrap such calls in something like this to be able to see STDERR:

import subprocess
cmds = ['ping', '-c', '1', 'github.com2']
result = subprocess.run(cmds, stderr=subprocess.PIPE)
if result.returncode != 0:
    msg = result.stderr.decode().strip()
    raise subprocess.CalledProcessError(f"CALLED SUBPROCESS ERROR: Command: {' '.joi... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/7PVHSJGKFUIV4ZJFWG7EU3DR6XAGAKQW/)
#

I'd really appreciate feedback on this new PEP about making the GIL
per-interpreter.

The PEP targets 3.11, but we'll see if that is too close. I don't
mind waiting one more
release, though I'd prefer 3.11 (obviously). Regardless, I have no
intention of rushing
this through at the expense of cutting corners. Hence, we'll see how it goes.

The PEP text is included inline below. Thanks!

-eric

===================================================

PEP: 684
Title: A Per-Interpreter GIL
Author: Eric Snow ericsnowcurrently@gmail.com
Discussions-To: python-dev@python.org
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 08-Mar-2022
Python-Version: 3.11
Post-History: 08-Mar-2022
Resolution:

Abstract

Since Python 1.5 (1997), CPython users can run multiple interpreters
in the same process. However, interpreters in the same process
have always shared a significant
amount of global state. This is a source of bugs, with a growing
impact as more and more people... continue reading

naive kindleBOT
#

Add a "replace" method to tuples that returns a new tuple with the element at a given index replaced with a given value. Example implementation:

def replace(self, index, value):
return self[:index] + (value,) + self[index + 1:]

See https://stackoverflow.com/questions/11458239/how-to-change-values-in-a-tuple for more context.

Currently, tuples have 2 public methods: index and count. replace would be similarly easy to implement and similarly useful.

Furthermore, it would be a natural counterpart to nametuple's _replace method.

naive kindleBOT
#

Dear Python Community,

Greetings! I am Jonathan, a volunteer of PyCon APAC 2022
https://www.python.org/events/python-events/1216/. PyCon APAC 2022 will
be held fully remotely on September 3-4 by the PyCon Taiwan organizing team
https://pycontw.blogspot.com/2022/02/pycon-apac-2022-will-be-hosted-by-pycon.html
and the other communities in the APAC region.

PyCon APAC 2022 CfP
https://pycontw.blogspot.com/2022/03/pycon-apac-2022-cfp-is-open.html is
open now. Visit our website https://tw.pycon.org/2022/ or blog
https://pycontw.blogspot.com/ for important dates and more details. We
are looking forward to seeing you!

Best Regards,

  • Jonathan

PyCon Taiwan Organizing Team

naive kindleBOT
#

We're excited to announce that the signups for Python Language Summit at
PyCon 2022 are now open.

Full details at: https://us.pycon.org/2022/events/language-summit/

After two years of virtual/online summit, we will be returning to in-person
format. We will be following the health and safety guidelines at PyCon US:
https://us.pycon.org/2022/attend/health-safety-guidelines/

TL;DR

When: Wednesday, April 27, 2022
Where: Salt Palace Convention Center, room TBD

Sign up to attend: https://forms.gle/CS8B6wJdcaN3rtWV8
https://forms.gle/CS8B6wJdcaN3rtWV8 (closes March 25 th, 2022 AoE)
Sign up to discuss a topic: https://forms.gle/LAFE6TTYi15jL5RaA (closes
March 25th, 2022 AoE)

Who can attend

We welcome Python core developers and triage team members, active core
contributors to Python and alternative Python implementations, and anyone
else who has a topic to discuss with core developers.

Who can propose a discussion topic

If you have discussion items; seeking consensus; awaiting... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-03-04 - 2022-03-11)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7233 ( +9)
closed 51481 (+56)
total 58714 (+65)

Open issues with patches: 2940

Issues opened (43)

#45138: [sqlite3] expand bound values in traced statements when possib
https://bugs.python.org/issue45138 reopened by erlendaasland

#46924: make install hangs when installing zoneinfo/_zoneinfo.py
https://bugs.python.org/issue46924 opened by AmericanEnglish

#46925: Document dict behavior when setting equal but not identical ke
https://bugs.python.org/issue46925 opened by malthe

#46926: runpy.run_path didn't set __package__ to None as describe in d
https://bugs.python.org/issue46926 opened by yanhao.charles

#46930: Iterating over cls.__dict__ in classmethod causes RuntimeError
https://bugs.python.org/issue46930 opene... continue reading

naive kindleBOT
#

Hi,

When attempting to build and run doctests for cpython on FreeBSD, I got
a vague error from the default BSD make. gmake, of course, ran fine. Is
GNU make the only supported make implementation? If so, did I miss that
in the devguide, or should that be in there somewhere?

--
Lincoln Auster
They/Them

naive kindleBOT
#

pytest-7.1.0

The pytest team is proud to announce the 7.1.0 release!

This release contains new features, improvements, and bug fixes,
the full list of changes is available in the changelog:

https://docs.pytest.org/en/stable/changelog.html

For complete documentation, please visit:

https://docs.pytest.org/en/stable/

As usual, you can upgrade from PyPI via:

pip install -U pytest

Thanks to all of the contributors to this release:

  • Akuli
  • Andrew Svetlov
  • Anthony Sottile
  • Brett Holman
  • Bruno Oliveira
  • Chris NeJame
  • Dan Alvizu
  • Elijah DeLee
  • Emmanuel Arias
  • Fabian Egli
  • Florian Bruhin
  • Gabor Szabo
  • Hasan Ramezani
  • Hugo van Kemenade
  • Kian Meng, Ang
  • Kojo Idrissa
  • Masaru Tsuchiyama
  • Olga Matoula
  • P. L. Lim
  • Ran Benita
  • Tobias Deiminger
  • Yuval Shimon
  • eduardo naufel schettino
  • Éric

Happy testing,
The pytest Development Team

naive kindleBOT
#

Currently:
l = [] # new empty list
t = () # new empty tuple
s = set() # new empty set (no clean and consistent way of initializing regarding the others) <<<
d = {} # new empty dictionary

Possible solution:
s = {} # new empty set
d = {:} # new empty dictionary (the ":" is a reference to key-value pairs)

Current workaround at least for consistency:
l = list() # new empty list
t = tuple() # new empty tuple
s = set() # new empty set
d = dict() # new empty dictionary

However, it doesn't feel right to not be able to initialize an empty set as cleanly and consistently as lists, tuples and dictionaries in both forms.

naive kindleBOT
#

Hi,

Oh, the Steering Council accepted PEP 594 "Removing dead batteries
from the standard library"! I just saw the announcement on Discourse.
Congratulations Christian and Brett! This PEP, first proposed in 2019,
wasn't an easy one.

https://peps.python.org/pep-0594/

Gregory P. Smith's message on Discourse:

"""
On behalf of the Python Steering Council,

We are accepting PEP-594 32 Removing dead batteries from the standard library.

It removes a non-controversial set of very old unmaintained or
obsolete libraries from the Python standard library. We expect this
PEP to be a one time event, and for future deprecations to be handled
differently.

One thing we’d like to see happen while implementing it: Document the
status of the modules being deprecated and removed and backport those
deprecation updates to older CPython branch documentation (at least
back to 3.9). That gets the notices in front of more people who may
use the docs for their specific Python version.

Particular care should... continue reading

naive kindleBOT
#

This is basically an email asking for inputs on https://discuss.python.org/t/14210. It's not clear to me whether the expectation is that people post in two places or just one; so I'm going to avoid duplicating the contents here.

TLDR from that proposal: PEP 8015 had proposed an SC + Core Developers + Teams model. Python's current governance model has the first two, while the third is something that we've informally organised into. Let's formalise the organisational structures we already have, change the names of various groups to "teams" and benefit from the clearer formal organisation + naming scheme.

naive kindleBOT
#

竜 TatSu is a tool that takes grammars in a variation of EBNF as input, and
outputs memoizing (Packrat) PEG parsers in Python.

竜 TatSu can compile a grammar stored in a string into a
tatsu.grammars.Grammar object that can be used to parse any given input,
much like the re module does with regular expressions, or it can generate a
Python module that implements the parser.

竜 TatSu supports left-recursive rules in PEG grammars using the algorithm
by Laurent and Mens. The generated AST has the expected left associativity.

This release adds optimizations and solves obscure bugs and
backwards-compatibility issues.

See the changelog at:

https://github.com/neogeny/TatSu/releases/tag/v5.8.0

--
Juancarlo Añez
mailto:apalala@gmail.com

naive kindleBOT
naive kindleBOT
#

I created
https://discuss.python.org/t/finding-edge-cases-for-peps-484-463-and-649-type-annotations/14314
on behalf of the SC to help gather edge cases where the various approaches
that PEPs have proposed will fail. Our hope is to get an overall picture of
the trade-offs the various PEPs ask us to make.

PLEASE DO NOT REPLY HERE! I'm reaching out to the typing SIG and Pydantic
(at least) and it's much easier for others to log into discuss.python.org
with a GitHub account than it is to sign up for this mailing list just to
participate in this discussion.

naive kindleBOT
#

PyCA cryptography 36.0.2 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.

Changelog (https://cryptography.io/en/latest/changelog/#v36-0-2):

  • Updated Windows, macOS, and Linux wheels to be compiled with OpenSSL 1.1.1n.

-Paul Kehrer (reaperhulk)

naive kindleBOT
#

Hi all,

I recently noticed that stdlib functions often don't have type hints. Is there a technical reason why typing isn't more widespread in the cpython implementation? As a developer, it'd be great if I didn't have to wrap many of my stdlib calls in casts to make mypy happy. Please let me know if there's a more appropriate channel for this discussion. I tried looking through the mailing list archives and github issues, but I couldn't find the answer to this.

Best,
Jared

naive kindleBOT
#

Welcome again to the exciting world of releasing new Python versions!

Last time around I was complaining about cursed releases https://discuss.python.org/t/python-3-10-2-3-9-10-and-3-11-0a4-are-now-available/13146. This time around I could complain about security content galore and how one of them https://mta.openssl.org/pipermail/openssl-announce/2022-March/000216.html ruined my ingenious idea to release Python on Pi Day and call it Py Day https://discuss.python.org/t/py-day-is-coming-a-joint-security-release-spree-for-python-3-7-3-8-3-9-and-3-10-on-march-14th/14109. Well, you can’t have everything in life. Or at least not everything at once.

And yet it seems this time around we’ve got a lot of security fixes all at once. Just look at this list:

15 (sic!) CVEs: libexpat upgraded from 2.4.1 to 2.4.7 (BPO-46794 https://bugs.python.org/issue46794, BPO-46932 https://bugs.python.org/issue46932, BPO-46811 https://bugs.python.org/issue46811, BPO-46784 <https://bugs.python.org/... continue reading

#

Welcome again to the exciting world of releasing new Python versions!

Last time around I was complaining about cursed releases https://discuss.python.org/t/python-3-10-2-3-9-10-and-3-11-0a4-are-now-available/13146. This time around I could complain about security content galore and how one of them https://mta.openssl.org/pipermail/openssl-announce/2022-March/000216.html ruined my ingenious idea to release Python on Pi Day and call it Py Day https://discuss.python.org/t/py-day-is-coming-a-joint-security-release-spree-for-python-3-7-3-8-3-9-and-3-10-on-march-14th/14109. Well, you can’t have everything in life. Or at least not everything at once.

And yet it seems this time around we’ve got a lot of security fixes all at once. Just look at this list:

15 (sic!) CVEs: libexpat upgraded from 2.4.1 to 2.4.7 (BPO-46794 https://bugs.python.org/issue46794, BPO-46932 https://bugs.python.org/issue46932, BPO-46811 https://bugs.python.org/issue46811, BPO-46784 <https://bugs.python.org/... continue reading

naive kindleBOT
#

Hi there

I hope you will indulge me while I request some feedback on a couple
of open PRs that I would like to be considered for 3.11.

https://github.com/python/cpython/pull/31150

https://github.com/python/cpython/pull/31142

The first one should be pretty easy to review as it simply makes use
of the new co_qualname attribute of code objects to enrich the
traceback output with qualified names. Provided it gets accepted,
similar changes could also be introduced in other areas, like
profiling, debugging, IDLE etc...

The second one might not be as easy to review. As pointed out in the
attached bpo, a similar issue was already considered back in 2012, but
the proposed solution there has been "opposed" because of
backwards-compatibility concerns. The change I am proposing would
expose thread names via the ABI (albeit still in the form of a Python
object) in a backwards-compatible way. However, I am not very
satisfied with the way I have implemented this for now, nor can I
think of a be... continue reading

naive kindleBOT
naive kindleBOT
#

Currently __slots__ can be either string or an iterable of strings.

  1. If it is a string, it is a name of a single slot. Third-party code
    which iterates __slots__ will be confused.

  2. If it is an iterable, it should emit names of slots. Note that
    non-reiterable iterators are accepted too, but it causes weird bugs if
    __slots__ is iterated more than once. For example it breaks default
    pickling and copying.

I propose to restrict the type of __slots__. Require it always been a
tuple of strings. Most __slots__ in real code are tuples. It is rarely
we need only single slot and set __slots__ as a string.

It will break some code (there are 2 occurrences in the stdlib an 1 in
scripts), but that code can be easily fixed.

naive kindleBOT
#

Howdy python gang,

First time posting here ~ I've recently encountered that python does not have an OOTB operator for modulo that is consistent with Euclidean division. Although it should be easy for anyone who wants this to create it themselves, it struck me as odd that it was not an already included feature. I was even more shocked to see a list indicating that most languages don't include one consister with Euclidean division (disheartening to realise that the number theory way of doing things is not the default). I was so shocked at it's lack from python that it motivated me to post this, I suppose!

I guess I'm posting to check how open anyone would be to the idea? I'm not sure if '%%' is defined anywhere, but it seemed like an intuitive suggestion if not already used as an operator, parallel to the syntax of the '**' operator.

Keen to know how open y'all're to it!

naive kindleBOT
#

ACTIVITY SUMMARY (2022-03-11 - 2022-03-18)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7165 (-68)
closed 51620 (+139)
total 58785 (+71)

Open issues with patches: 2903

Issues opened (50)

#22628: Idle: Tree lines are spaced too close together.
https://bugs.python.org/issue22628 reopened by exarkun

#43253: asyncio open_connection fails when a socket is explicitly clos
https://bugs.python.org/issue43253 reopened by asvetlov

#45405: configure fails on macOS with non-Apple clang version 13 which
https://bugs.python.org/issue45405 reopened by ned.deily

#46948: [CVE-2022-26488] Escalation of privilege via Windows Installer
https://bugs.python.org/issue46948 reopened by steve.dower

#46989: signal.signal, et al, doesn't support [SIGRTMIN,SIGRTMAX] on F
https://bugs.python.org/issue46989 opened by ngie

#46990: Surpr... continue reading

naive kindleBOT
#

On behalf of the Python Steering Council, we are accepting PEP 675 -
Arbitrary Literal String Type https://peps.python.org/pep-0675/.

TL;DR - PEP 675 allows type checkers to help prevent bugs allowing
attacker-controlled data to be passed to APIs that declare themselves as
requiring literal, in-code strings.

This is a very thorough PEP with a compelling and highly relevant set of
use cases. If I tried to call out all the things we like about it, it’d
turn into a table of contents. It is long, but everything has a reason to
be there. :)

Once implemented, we expect it to be a challenge to tighten widely used
existing APIs that accept str today to be LiteralString for practical
reasons of what existing code calling unrestricted APIs naturally does. The
community would benefit from anyone who attempts to move a widely used
existing str API to LiteralString sharing their experiences, successful or
not.

-gps for the steering council

naive kindleBOT
#

On behalf of the Python Steering Council, we are pleased to accept PEP 655

Thanks for considering the potential for confusion with Optional during the
design and recommending best practices in the “how to teach” section.

A couple SC members have tried using TypedDict and found it painful, this
PEP helps.

-gps for the steering council

naive kindleBOT
#

Hello!

Just in case you are still thinking about it - a small reminder that we are
still looking for speakers for Tallinn's PyCon 2022 conference! The call
will be available until the 1st of April.

We are looking for talks on various topics. The theme this year is
"Connect. Collab. Contribute" and we want the focus of the conference to be
around the Python ecosystem. However, we are also welcoming talks on other
relevant topics - Python challenges, outstanding packages, security,
automation, AI/ML, web development, IoT, mental health for developers,
conducive work environment for coding, etc.

We are waiting for the proposals here:
https://pyconestonia.typeform.com/to/HSWhN8YW

If you have any questions please do not hesitate to reach out to me.
Looking forward to having you with us at PyCon on 25th of August, 2022.

All the best,
Grete Kungla
+372 5628 0032
Project Manager
PyCon Conference 2022
https://pycon.ee/

naive kindleBOT
#

Hi all!

I'm happy to announce the release of PoorWSGI 2.5.0, available to
download via pip and GitHub. Poor WSGI for Python is light WSGI
connector with uri routing between WSGI server and your application.

The official documentation is available at:
http://poorhttp.zeropage.cz/poorwsgi/
The sources, discussions and bug tracker:
https://github.com/PoorHttp/PoorWSGI

Changes for 2.5.0
* fix file callback on files smaller than 1000B
* add FileObjResponse class
* add BaseResponse class
* unicode support in url path
* call file_callback only for files entries (with filename)
* fix openapi wrapper mime type
* Session use JSON for secority issue
* Bad JSON request generate HTTP Bad Request response
* All error handlers has error named argument
* new examples
* large_file.py - own file_callback for uploading large data
* websocket.py - websocket simple chat example
* new TextResponse class
* CachedInput for faster upload
*... continue reading

naive kindleBOT
#

Hi

As you may have seen, AMD has recently announced CPUs that have much larger
L3 caches. Does anyone know of any work that's been done to research or
make critical Python code and data smaller so that more of it fits in the
CPU cache? I'm particularly interested in measured benefits.

This search
https://www.google.com/search?q=python+performance+CPU+cache+size
provides two relevant links

https://www.oreilly.com/library/view/high-performance-python/9781449361747/ch01.html

https://www.dlr.de/sc/Portaldata/15/Resources/dokumente/pyhpc2016/slides/PyHPC\_2016\_talk\_14.pdf
but not much else I found relevant.

AnandTech writes about the chips with triple the L3 cache:

https://www.anandtech.com/show/17323/amd-releases-milan-x-cpus-with-3d-vcache-epyc-7003
"As with other chips that incorporate larger caches, the greatest benefits
are going to be found in workloads that spill out of contemporary-sized
caches, but will neatly fit into the larger cache."

And also:

https://www.anandtech.... continue reading

naive kindleBOT
#

Hi,

I proposed two PRs to move the private C API (Include/cpython/) of PEP
523 "Adding a frame evaluation API to CPython" to the internal C API
(Include/internals/):

API:

  • _PyFrameEvalFunction type
  • _PyInterpreterState_GetEvalFrameFunc()
  • _PyInterpreterState_SetEvalFrameFunc()
  • (undocumented) _PyEval_EvalFrameDefault()

The private API to get/set the eval function is documented at:
https://docs.python.org/dev/c-api/init.html#c.\_PyInterpreterState\_GetEvalFrameFunc

I added the Get/Set functions so debuggers don't have to access
directly to the PyInterpreterState structure which has been moved to
the internal C API in Python 3.8.

This API causes me multiple issues:

  • It's a private API and I'm trying to remove the private API from the
    public C API header files.
  • The _PyFrameEvalFunction type is not stable: it got a new "tstate"
    parameter in Python 3.9 and the type of the s... continue reading
naive kindleBOT
#

Hello, everyone!

I believe our documentation about types needs another overhaul.

We now have lots of generic types in the standard library, but their
formal type parameters are poorly documented—or not documented at
all—in the standard library documentation.

More importantly: the documentation we have about specific
covariant/contravariant types is now in entries in the typing module
that are all deprecated since PEP 585 was implemented in Python 3.9.

Below I present two of many examples where the documentation of a
generic type is not great.

However, if people agree this is a problem, we need to discuss where
and how to put the documentation in a way that is not too disruptive
to users of Python who don't know or don't care about type hints, for
many reasons that we should not judge.

For example, where do we document the fact that dict accepts two
invariant formal type parameters, and that frozenset accepts one
contravariant type parameter?

What do you think?

Cheers,

Lu... continue reading

naive kindleBOT
#

Did anybody say cursed releases https://discuss.python.org/t/python-3-10-3-3-9-11-3-8-13-and-3-7-13-are-now-available-with-security-content/14353? Well, it turns out that 3.10.3 and 3.9.11 both shipped a regression which caused those versions not to build on Red Hat Enterprise Linux 6. While this 11-year-old version is now out of maintenance support https://access.redhat.com/support/policy/updates/errata, it’s still used in production workloads. Some of those rely on Python 3.9 and/or 3.10. In particular, our own manylinux2010 https://github.com/pypa/manylinux/tree/manylinux2010\_x86\_64\_centos6\_no\_vsyscall image used to build widely compatible Linux wheels is based on CentOS 6. (Don’t worry, we do have newer manylinux* variants, see PEP 599 https://peps.python.org/pep-0599/ and PEP 600 https://peps.python.org/pep-0600/ for details.)

Due to the out-of-schedule release, the respective versions released today contain a very limited set of changes. Python 3.9.12 only contain... continue reading

#

Did anybody say cursed releases https://discuss.python.org/t/python-3-10-3-3-9-11-3-8-13-and-3-7-13-are-now-available-with-security-content/14353? Well, it turns out that 3.10.3 and 3.9.11 both shipped a regression which caused those versions not to build on Red Hat Enterprise Linux 6. While this 11-year-old version is now out of maintenance support https://access.redhat.com/support/policy/updates/errata, it’s still used in production workloads. Some of those rely on Python 3.9 and/or 3.10. In particular, our own manylinux2010 https://github.com/pypa/manylinux/tree/manylinux2010\_x86\_64\_centos6\_no\_vsyscall image used to build widely compatible Linux wheels is based on CentOS 6. (Don’t worry, we do have newer manylinux* variants, see PEP 599 https://peps.python.org/pep-0599/ and PEP 600 https://peps.python.org/pep-0600/ for details.)

Due to the out-of-schedule release, the respective versions released today contain a very limited set of changes. Python 3.9.12 only contain... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-03-18 - 2022-03-25)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7145 (-20)
closed 51702 (+82)
total 58847 (+62)

Open issues with patches: 2903

Issues opened (53)

#45618: Documentation builds fail with Sphinx 3.2.1
https://bugs.python.org/issue45618 reopened by Maciej Olko

#46429: Merge all deepfrozen files into one
https://bugs.python.org/issue46429 reopened by kumaraditya303

#46864: Deprecate ob_shash in BytesObject
https://bugs.python.org/issue46864 reopened by christian.heimes

#46975: clang: error: linker command failed with exit code 1 (use -v t
https://bugs.python.org/issue46975 reopened by jaraco

#47060: importlib.metadata.version can return None
https://bugs.python.org/issue47060 opened by David Robertson

#47061: Deprecate modules listed in PEP 594
https://bugs.python.org/iss... continue reading

naive kindleBOT
#

Hi,

Before anything, i made a github repository about this topic here : https://github.com/malmiteria/super-alternative-to-super

The core of what i wanna discuss here is that i don't think mro and super (mainly because it relies on mro) are very pythonic. Mainly that some behaviors of the mro are too implicit, and are silencing what really should be errors.

Let me explain :
in case of multiple inheritence, resolving a child method from it's parent isn't an obvious task, and mro comes as a solution to that. However, i don't understand why we don't let the programmer solve it. I think this is similar to a merge conflict, and not letting the programmer resolve the conflict feels like silencing an error. This is especially infuriating when you realise that mro doesn't solve all possible scenarios, and then, simply refuses the opportunity to solve it to the programmer.
Then, super relying on mro gives off some weird behaviors, mainly, it's possible for a child definition to affect what... continue reading

naive kindleBOT
#

When running unittest with the -v flag, if a test has errors, and has a docstring, the test name is shown on one line, and the docstring is shown on the next line with the ERROR word.
For example:

./python.exe -m unittest -v Lib.test_verbose_error.randomTest
test_one (Lib.test_verbose_error.randomTest)
this is a doc string with helpful info ... ERROR

======================================================================
ERROR: test_one (Lib.test_verbose_error.randomTest)
this is a doc string with helpful info

Traceback (most recent call last):
File "/workspaces/cpython/Lib/test_verbose_error.py", line 11, in test_one
assert l[1]
~^^^
IndexError: list index out of range


Ran 1 test in 0.004s

This cause for some confusion and we would like to fix it, the possible options are:

  1. print the name and docstring, and ERR... continue reading
naive kindleBOT
#

If you have a __future__ import in a script, and you import * from it in another script, the object for this future appears in the dir() of the other script, even though the __future__ import has no effect there.
% cat x.py
from __future__ import annotations
% cat y.py
from x import *

print(dir())

class D:
def f(self, a: D):
return 42

% ./python.exe y.py
['__annotations__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'annotations']
Traceback (most recent call last):
File "/Users/iritkatriel/src/cpython-654/y.py", line 5, in <module>
class D:
^^^^^^^^
File "/Users/iritkatriel/src/cpython-654/y.py", line 6, in D
def f(self, a: D):
^
NameError: name 'D' is not defined
I think we should change import * to exclude the __future__ import objects, and perhaps also to not show them in dir(x).   Any objections?

This came up ... continue reading

naive kindleBOT
#

A gentoo developer reported a symlink loop problem in reportlab's setup.py where we search for specific headers.

The 'fixed' function looks like this

def findFile(root, wanted, followlinks=True):
visited = set()
for p, D, F in os.walk(root,followlinks=followlinks):
#scan directories to check for prior visits
#use dev/inode to make unique key
SD = [].append
for d in D:
dk = os.stat(pjoin(p,d))
dk = dk.st_dev, dk.st_ino
if dk not in visited:
visited.add(dk)
SD(d)
D[:] = SD.__self__ #set the dirs to be scanned
for fn in F:
if fn==wanted:
return abspath(pjoin(p,fn))

the fix is reported to have worked, but the developer is querying the lifting of SD.append using the construct

SD = [].append
loop involving
appends to the list
.....
D[:] = SD.__self__

his objection was that using __self__ might be impleme... continue reading

naive kindleBOT
#

I'd like to be able to deconstruct complex objects into their real and
imaginary components using a match statement, like:

match 1-4j:
        case complex(a, b):
            print(f"{a=} {b=}")

This would just require setting

complex.__match_args__ = ("real", "imag")

The other builtin type I think should be able to do this is slice:

match slice(1, -1, None):
        case slice(start, stop, step):
            print(f"{start=} {stop=} {step=}")

which would require

slice.__match_args__ = ("start", "stop", "step")

This would be useful, for example, in custom __getattr__ methods which
need to handle slices.

def __getattr__(self, arg):
        match arg:
            case slice(start, stop, end):
                ...  # handle slice
            case n if isinstance(n, int):
                ...  # handle single index
            case _:
                raise TypeError

There are various other builtin types which could conc... continue reading

#

(I originally wrote this in bpo47147, but apparently because it has to
go through python-ideas first?)

I would like to be able to use a yield from expression in a return
statement without parentheses, as a small quality of life tweak, i.e.:

return yield from gen

instead of

return (yield from gen)

I think this makes sense, since yield from can be used on the
right-hand-side of an assignment, which accepts any expression, and so
should return.

Here is a medium-sized real-world example of where I'm using this, where
it would be nice to allow return yield from:https://gist.github.com/pxeger/48f97484364bf0b43dee974a8f0f4265

Patrick

#

Hello everyone,

When I am coding in Python I often encounter situations where I have a
string like this one.

sample="""
fruit:apple
tree:[Apple tree]
quantity:{5}
quantity:{3}
"""

And I want to grab some kind of value from it.

So let me introduce you to the grab function. This is the definition:

def grab(start, end, list_out=False):

Now, if you want to get the fruit from the sample string you can just
"grab" it as follows:

sample.grab(start="fruit:", end="\n")

'apple'

You can also "grab" values enclosed in brackets or in any kind of character
and It works as you would expect.

sample.grab(start="tree:[", end="]")

'Apple tree'

The optional argument "list_out" makes the function return a list of
values, for cases where there are several of them to grab.

sample.grab(start="quantity:{", end="}", list_out=True)

[5, 3]

The "grab" function will return only the first occurrence if "list_out" is
omitted or passed as False.

sample.grab(start="quantity:{", end="}")

5

... continue reading

naive kindleBOT
#

In the following bit of code:

 while s := input.read(MAXBINSIZE):
     while len(s) < MAXBINSIZE and ns := input.read(MAXBINSIZE-len(s)):
         s += ns
     line = binascii.b2a\_base64(s)
     output.write(line)

I'm getting this error on the second line:

 cannot use assignment expressions with expression

Can somebody explain why that isn't working?

Many thanks.

--
~Ethan~

naive kindleBOT
#

We've used a lot of boolean environment variables in a recent project I've
been working on, this led us to create a wrapper to os.getenv that
essentially converts the result to a boolean using distutils.util.strtobool
if an optional kwarg to our wrapper is set to True.

Would it be far-fetched to have os.getenv incorporate this functionality?
We already have the building blocks (strtobool and getenv), and the
signature change would be minimal and backwards-compatible:

def getenv(key, default=None, to_bool=False):
...

The implementation would be trivial too.

Let me know what you think, thanks!
Adrian

naive kindleBOT
#

I am pleased to announce the release of SfePy 2022.1.

Description

SfePy (simple finite elements in Python) is a software for solving systems of
coupled partial differential equations by finite element methods. It is
distributed under the new BSD license.

Home page: https://sfepy.org
Mailing list: https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
Git (source) repository, issue tracker: https://github.com/sfepy/sfepy

Highlights of this release

  • new handling of state variables data and State class removal
  • many new sensitivity analysis terms based on multi-linear term implementation

For full release notes see [1].

Cheers,
Robert Cimrman

[1] http://docs.sfepy.org/doc/release\_notes.html#id1


Contributors to this release in alphabetical order:

Robert Cimrman
Robert T. McGibbon
Vladimir Lukes

naive kindleBOT
#

Leo http://leoeditor.com 6.6 final is now available on GitHub
https://github.com/leo-editor/leo-editor/releases and pypi
https://pypi.org/project/leo/6.6/.

Leo is an IDE, outliner and PIM http://leoeditor.com/preface.html.

The highlights of Leo 6.6

  • Replaced @raw and @end_raw with @section-delims.
  • Leo recognizes section references only when they appear on an
    otherwise blank line.
  • Many improvements to the python-to-typescript command.
  • Improved python importer.
  • Added plugins/picture_viewer.py, a stand-alone app that displays
    images.
  • Added plugins/remove_duplicate_pictures.py, an app that finds
    duplicate pictures.
  • The user may choose other commands after starting
    repeat-complex-command.
  • Improved leoserver.py to support leointeg.
  • Many bug fixes.

6.6 Links

naive kindleBOT
#

Wing 8.3 improves remote development by allowing it to work without an
SSH agent or command line OpenSSH or PuTTY configuration. This release
also supports forwarding of the SSH agent to the remote host, allows
blocking access to any SSH agent, improves analysis of match/case
statements, avoids reporting spurious exceptions in async def
coroutines, and makes a number of other improvements to refactoring,
code reformatting, debugging, and other features.

Details: https://wingware.com/news/2022-03-30
Downloads: https://wingware.com/downloads

== About Wing ==

Wing is a full-featured but light-weight Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing's deep code analysis provides
auto-completion, auto-editing, code navigation, early error detection,
and refactoring that speed up development. Its top notch debugger works
with any Python code, locally or on a remote host, container, or
cluster. Wing al... continue reading

naive kindleBOT
naive kindleBOT
#

("Re: C API: Move PEP 523 "Adding a frame evaluation API to CPython"
private C API to the internal C API")

On Fri, Apr 1, 2022 at 11:01 AM Chris Angelico rosuav@gmail.com wrote:

On Fri, 1 Apr 2022 at 19:51, Victor Stinner vstinner@python.org wrote:

In Python, sadly the types.CodeType type also has a public constructor
and many projects break at each Python release because the API
changes. Hopefully, it seems like the new CodeType.replace() method
added to Python 3.8 mitigated the issue. IMO CodeType.replace() is a
better abstraction and closer to what developers need in practice.

It certainly has been for me. When I want to do bytecode hackery, I
usually start by creating a function with def/lambda, then construct a
modified function using f.__code__.replace(). It's the easiest way to
ensure that all the little details are correct.

Python 3.11 added the concept of "exception table"
(code.co_exceptiontable). You have to build this table, othe... continue reading

naive kindleBOT
#

Hi,

HAMT is a very useful immutable mapping type. Currently CPython use it internally to implement contextvar. Considering immutable data structure is very useful I hope we can make it available to python script(maybe via collections module).

Immutable data structures are fundamental parts of our project. Currently we use a full-featured python immutable data library called pyrsistent. Pyrsistent is very powerful, however the map type in it is implemented in python script not in C. It becomes slow when the data set is relatively large.

On the other hand, CPython now already has an immutable mapping type in it. I think maybe it’s a good idea to make it public? Many projects can benefit from it I believe.

Here is a talk given by the author of javascript immutable-js library explain why immutable data structures are powerful: https://www.youtube.com/watch?v=I7IdS-PbEgI

Pyristent: https://github.com/tobgu/pyrsistent

What do you think?

Cheers,
Kai

naive kindleBOT
#

One way that I like to create templates for config files is to write the config file in a way that can be used with str.format if I read in the entire config file as a string before re-saving it or sending it somewhere.* The config file contains a half dozen or dozen variables. Another several dozen variables are pretty much permanent. This approach works for me in the sense that batch submits over several combinations of variables is just a few lines of code, and when I revisit a job after quite some time, the curly braces in the config file template remind me what settings (might) require my attention. The problem lies in what to do about defaults. Including a formatted variable in the template file requires that the variable be included in my call to format otherwise I'll get a KeyError. For my part, I can work around this by including a companion '.py' file that includes a dict of default values. What I pine for is the ability to discard this extra '.py' file, and its WYSIN... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-03-25 - 2022-04-01)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7153 ( +8)
closed 51763 (+61)
total 58916 (+69)

Open issues with patches: 2902

Issues opened (49)

#46907: Update Windows and MacOS installer to SQLite 3.38.2
https://bugs.python.org/issue46907 reopened by ned.deily

#47122: Fix the table of methods in the collections.abc documentation
https://bugs.python.org/issue47122 opened by maggyero

#47123: ZipFile.writestr should respect SOURCE_DATE_EPOCH
https://bugs.python.org/issue47123 opened by ghost43

#47124: explore hashlib use of the Apple CryptoKit macOS
https://bugs.python.org/issue47124 opened by gregory.p.smith

#47125: Explore hashlib use of the Windows Crypto API NG
https://bugs.python.org/issue47125 opened by gregory.p.smith

#47131: Speedup test_unparse
https://bugs... continue reading

naive kindleBOT
#

Dear Pythonistas and solar power enthusiasts,

On behalf of the maintainers, we're happy to announce a new release of
pvlib python:
software for simulating performance of photovoltaic solar energy systems.

See what's new for v0.9.1:

Releases are available from PyPI and the conda-forge channel:

Read the Documentation:

Report issues & contribute:

Highlights:
** *Beautifully updated documentation theme that is easier to browse and
navigate. Please share your feedback!

naive kindleBOT
#

For the edification of all involved, this post summarizes a somewhat surprising behavior in unittest around docstrings.

In bpo-46126https://bugs.python.org/issue46126, I reported an issue where I’d observed that CPython developers were avoiding the use of docstrings in unittests due to what was perceived as a masking of crucial information.

On further investigation, it turns out that with the “descriptions” setting of the TextTestRunner is set to True (the default), unittest will emit the first line of a test’s docstring (if present) in addition to the location of the test. As a result, for tests that have docstrings, the output varies depending on this setting. Verbose output with docstrings and descriptions enabled:

test_entry_points_unique_packages (test.test_importlib.test_metadata_api.APITests)
Entry points should only be exposed for the first package ... ERROR

Without docstrings or with descriptions disabled:

test_entry_points_unique_packages (test.... continue reading

naive kindleBOT
#

On 4/3/22 11:52, Brian McCall wrote:

If you had asked me twenty years ago if I thought units should be a native part of any
programming language, I would have said absolutely - because in my youthful ignorance
I had no idea what it would take to make such a thing work. Five years later, I would
have said "not worth it". Now I'm back where I started. The lack of native language
support for SI units is a problem for an entire segment of programmers. Programming
languages took a big step forward in deciding that EVERYTHING is a pointer/reference,
and EVERYTHING is an object. They need to take another step forward to say that EVERY
number has a unit, including "unitless". Not having this language feature is becoming
(or already is) a problem. The question is, is it Python's problem?

On 4/3/22 14:20, Ricky Teachey wrote:

The libraries out there- pint is probably the biggest one- have filled those gap as much as they can, but there are so
many shortfalls..... continue reading

naive kindleBOT
#

Dear Python community,

it's now 20 years since Greg Ewing posted his first announcement of Pyrex,
the tool that is now known and used under the name Cython.

https://mail.python.org/pipermail/python-list/2002-April/126661.html

It was a long way, and I've written up some of it in a blog post:

http://blog.behnel.de/posts/cython-is-20/

Today, if you're working on any kind of larger application in Python,
you're likely to have some piece of code downloaded into your venv that was
built with Cython. Or many of them.

I'm proud of what we have achieved. And I'm happy to see and talk to the
many, many users out there whom we could help to help their users get their
work done.

Happy anniversary, Cython!

Stefan

PS: The list of Cython implemented packages on PyPI is certainly
incomplete, so please add the classifier to yours if it's missing. With
almost 3000 dependent packages on Github (and almost 100,000 related
repos), I'm sure we can crack the number of 1000 Cython built pac... continue reading

naive kindleBOT
#

________________________________________________________________________

ANNOUNCING

                eGenix Antispam Bot for Telegram

                        Version 0.2.0

           A simple, yet effective bot implementation
                to address Telegram signup spam.

This announcement is also available on our web-site for online reading:
https://www.egenix.com/company/news/eGenix-Antispam-Bot-for-Telegram-0.2.0-GA.html

________________________________________________________________________

INTRODUCTION

eGenix has long been running a local user group meeting in Düsseldorf
called Python Meeting Düsseldorf and we are using a Telegram group for
most of our communication.

In the early days, the group worked well and we only had few spammers
joining it, which we could well handle manually.

More recently, this has chan... continue reading

naive kindleBOT
#

Extensions in the standard library will be converted to multi-phase initialization (PEP 489) and where possible, all state will be stored on module objects rather than in process-global variables.

naive kindleBOT
#

Broken off from the "Custom literals, a la C++" thread:

Greg Ewing wrote:

Personally I think giving Decimal a global context was a mistake, [...]
so arguing that "it's no worse than Decimal" isn't going to do much
to convince me. :-)

I'd be curious to know what alternatives you see. When a user writes x + y with both x and y instances of decimal.Decimal, the decimal module needs to know what precision to compute the result to (as well as what rounding mode to use, etc.). Absent a thread-local context or task-local context, where would that precision information come from?

naive kindleBOT
#

Brrrrr..... do you feel that? That's the chill of beta freeze coming
closer. Meanwhile, your friendly CPython release team doesn’t
rest and we have prepared a shiny new release for you: Python 3.11.0a7.


Dear fellow core developer:
This alpha is the last release before feature freeze (Friday, 2022-05-06),
so make sure that all new features and PEPs are landed in the master branch
before we
release the first beta. Please, be specially mindfully to check the CI and
the buildbots, maybe even using the test-with-buildbots label in GitHub
before
merging so the release team don’t need to fix a bunch of reference leaks or
platform-specific problems on the first beta release.
******************************************************************************************************************************************************... continue reading

#

Brrrrr..... do you feel that? That's the chill of beta freeze coming
closer. Meanwhile, your friendly CPython release team doesn’t
rest and we have prepared a shiny new release for you: Python 3.11.0a7.


Dear fellow core developer:
This alpha is the last release before feature freeze (Friday, 2022-05-06),
so make sure that all new features and PEPs are landed in the master branch
before we
release the first beta. Please, be specially mindfully to check the CI and
the buildbots, maybe even using the test-with-buildbots label in GitHub
before
merging so the release team don’t need to fix a bunch of reference leaks or
platform-specific problems on the first beta release.


*Go g... continue reading

naive kindleBOT
#

Hi everyone,

We have approximately one month until feature freeze and for 3.11.0b1 to be
released. I wanted to take this time to share some planning
and considerations with you. Please, read carefully these points as they
are important.

  • 3.11.0b1 is scheduled for Friday, 2022-05-06, which is after the PyCon US
    sprints. As the sprints normally end with a considerable
    amount of PRs getting merged and the buildbots having a hard time, I may
    need to move the release before or after to accommodate
    for this and to prevent the release from going haywire. I will share
    updates with you as they become available.

  • The latest alpha releases have been quite challenging. We had a
    considerable number of release blockers and issues that were raised
    just a couple of days before the release. Please, check the release
    blockers on bpo/Github as much as you can and make sure these are resolved
    before the release date. Any release blockers for 3.11 will block feature
    freeze. If this happens, the main b... continue reading

naive kindleBOT
#

Hi,

Would it be possible to announce new PEPs on python-dev please?

I don't go often to Discourse, like once a month. I don't get any
notification by email. I expected new PEPs to be announced on
python-dev, but they are not announced here anymore. Is it possible to
get Discourse notifications by email, but only for new PEPs? Using
mailing lists, it's easy: just select the mailing list that you would
like to subscribe to.

So I went to Discourse, I click on "New Topics" and I don't see any new PEP...

... But if I go manually to the PEP category, there are 2 new PEPs
proposed (PEP 678, PEP 687). In this category, if I click on the bell:
it says "You will be notified if someone mentions your @name or
replies to you". I can change this parameter to "You will be notified
of new topics in this category but not replies to the topics." I don't
recall if I changed this parameter manually, but it seems like the
choice to only be notified of new topics is a new (i don't think that
it existed ... continue reading

naive kindleBOT
naive kindleBOT
#

This is an idea which has been brought up before, sometimes introduced
as "heresy". But an interesting twist has surfaced now which is
typing.

But firstly, let me present the idea. It is very simple, that Python
should have declarative imports, usable anywhere using a simple
syntax, @<dotted-name>.

For example, some_regex = @re.compile(...).

What happens then is that before anything else in that module, that
symbol is imported:

from re import compile as \_mangled\_re\_compile

It must be the very first thing (hoisting) because when else would it
happen? It's been suggested before to have a shorthand syntax which
does a dynamic import at the time of using it but this brings me to
the twist:

We want typing to pick up these imports. And this twist has a second
leg which is that we often need to import symbols simply in order to
type some argument type or return type. This leads to a great many
more imports to type.

(Nevermind that if you want to take typing further, abstract
i... continue reading

naive kindleBOT
#

Hello,
Now that tomllib is in the stdlib, I'd like to convert the stable ABI
manifest (Misc/stable_abi.txt) to TOML to make it easier to work with.
To get proper highlighting in editors, I'd like to rename it from .txt
to .toml.

So, when the command that uses it stops working for you, change .txt
to .toml.
(See
https://devguide.python.org/c-api/#adding-a-new-definition-to-the-limited-api
-- if you're using make, nothing should change for you.)

As always, the file is only intended as input to the stable_abi script.
The format/contents can change unexpectedly. If you use it for something
else, let me know and let's create a proper data source for your use case.

bpo link: https://bugs.python.org/issue47168

naive kindleBOT
#

In about 1 hour from now, bugs.python.org will become read-only, and
the migration to GitHub Issues will begin.

Throughout the migration it will not be possible to report new issues
or comment on existing ones. Once all the issues have been migrated
from bpo to GitHub, you will be able to comment using GitHub Issues.
bpo will remain available in read-only mode.

For live updates, see
https://discuss.python.org/t/github-issues-migration-status-update/14573

Best Regards,
Ezio Melotti

naive kindleBOT
#

ACTIVITY SUMMARY (2022-04-01 - 2022-04-08)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7146 ( -7)
closed 51841 (+78)
total 58987 (+71)

Open issues with patches: 2890

Issues opened (49)

#47104: Rewrite asyncio.to_thread tests to use IsolatedAsyncioTestCase
https://bugs.python.org/issue47104 reopened by kj

#47136: The variable __module__ in the class body getting an undesirab
https://bugs.python.org/issue47136 reopened by ethan.furman

#47191: inspect - getasyncgeneratorstate, getasyncgeneratorlocals
https://bugs.python.org/issue47191 opened by animatea.programming

#47192: sys._getframe audit event has frame as argument in 3.8-3.10
https://bugs.python.org/issue47192 opened by Dutcho

#47193: Use zlib-ng rather than zlib in binary releases
https://bugs.python.org/issue47193 opened by gregory.p.smith

#4719... continue reading

naive kindleBOT
#

Hello,

I came across what seems like either a bug in the import system or a gap in its documentation, so I'd like to run it by folks here to see if I should submit a bug report. If there's somewhere else more appropriate to discuss this, please let me know.

If you import A.B, then remove A from sys.modules and import A.B again, the newly-loaded version of A will not contain an attribute referring to B. Using "collections.abc" as an example submodule from the standard library:

import sys
import collections.abc
del sys.modules['collections']
import collections.abc
collections.abc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'collections' has no attribute 'abc'

This behavior seems quite counter-intuitive to me: why should the fact that B is already loaded prevent adding a reference to it to A? It also goes against the general principle that "import FOO" makes the expression "FOO" well-defined; for example PLR 5.7 s... continue reading

naive kindleBOT
#

Hello all,

It fills me with joy to announce that nptyping 2.0.0 is released!

nptyping allows type hinting NumPy arrays with support for dynamic type
checking.

The most notable changes are:

  • Complete rewrite, extending numpy.typing and to be MyPy-friendly;
  • "Shape Expressions" that allow for a rich notation of NumPy array shapes;
  • Dropped support for Python 3.5 and 3.6.

For the full history:

https://github.com/ramonhagenaars/nptyping/blob/master/HISTORY.md

Links

Source is on Github:

https://github.com/ramonhagenaars/nptyping

Available on PyPI:

https://pypi.org/project/nptyping/

Documentation:

https://github.com/ramonhagenaars/nptyping/blob/master/USERDOCS.md

License (MIT):

https://github.com/ramonhagenaars/nptyping/blob/master/LICENSE

--
Ramon Hagenaars

naive kindleBOT
naive kindleBOT
#

Hello,
Please provide any feedback you might have on PEP 687 – Isolating
modules in the standard library: https://peps.python.org/pep-0687/

From recent discussions around “what should have a PEP”, it’s clear
that this should have been a PEP long ago. Better late than never, I guess!

We submit this PEP to explain the changes, seek consensus on whether
they are good, propose the remaining changes, and set best practices for
new modules.

There's a discussion thread on Discourse:
https://discuss.python.org/t/pep-687-isolating-modules-in-the-standard-library/14824

naive kindleBOT
#

Hi everyone,

Can PR gh-13143 be reopened and reviewed/merged when possible? It was closed in favor of the new asyncio streams API (gh-13251). Later, the API was cleanly removed (gh-16482) so the proposed PR became relevant again.

The added method allows to turn encryption on on demand (and off, as the author expressed his readiness). It's required for a CPython test suit, to port test.test_ftplib.DummyFTPServer from asyncore/asynchat before their removal according to PEP 594 (Removing dead batteries from the standard library).

Thank you in advance.

naive kindleBOT
#

PEP 681https://www.python.org/dev/peps/pep-0681/ improves type checker support for libraries with dataclass-like behaviors by introducing a way to map the behaviors of decorators and classes in those libraries to the behaviors of stdlib dataclass.

The PEP will not affect CPython directly except for the addition of the dataclass_transform decorator in typing.py. The decorator is currently in typing_extensions.

The canonical discussion thread is on Typing SIGhttps://mail.python.org/archives/list/typing-sig@python.org/thread/EAALIHA3XEDFDNG2NRXTI3ERFPAD65Z4/. Please send any comments there.

Any feedback would be appreciated!

Thanks,
Erik

naive kindleBOT
naive kindleBOT
#

Hi All,

On behalf of the NumPy team I am pleased to announce the release of NumPy
1.21.6. NumPy 1.21.6 is a very small release that achieves two things:

  • Backs out the mistaken backport of C++ code into 1.21.5.
  • Provides a 32 bit Windows wheel for Python 3.10.

The provision of the 32 bit wheel is intended to make life easier for
oldest-supported-numpy.

The Python versions supported in this release are 3.7-3.10. If you want to
compile your own version using gcc-11 you will need to use gcc-11.2+ to
avoid problems. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.21.6/; source archives, release notes,
and wheel hashes are available on Github
https://github.com/numpy/numpy/releases/tag/v1.21.6. Linux users will
need pip >= 0.19.3 in order to install manylinux2010 and manylinux2014
wheels. A recent version of pip is needed to install the universal2
macos wheels.

Cheers,

Charles Harris

naive kindleBOT
#

Many times when using the heapq lib I had to convert my array to negative values so that it could behave like a max heap. Maybe we should pass in a parameter in the functions to specify if we want a max heap behaviour or a min heap behaviour.

naive kindleBOT
#

A CVE has been opened against mailcap (see
https://github.com/python/cpython/issues/68966 for details). I'm not aware
of anyone trying to maintain the module and Victor did a search online and
didn't find any use of the module in the top 5000 projects on PyPI (see the
issue). The module is also under 300 lines of Python code that only (
https://github.com/python/cpython/blob/main/Lib/mailcap.py), so vendoring
wouldn't be burdensome.

As such, I'm proposing we deprecate mailcap in 3.11 and remove it in 3.13.
Any explicit objections?

naive kindleBOT
#

Hi everyone,

I'm looking to improve the output of the interpreter's LLTRACE feature to make it more understandable. This "feature" is undocumented, but it prints out the opcode and oparg of every bytecode instruction executed, along with some info about stack operations, whenever you've built with Py_DEBUG and the name __ltrace__ is defined in the module.

I've found this useful for debugging bits of the compiler and bytecode interpreter. For example, if I make some tweak that instroduces an off-by-one error, by default I get a segfault or a rather unhelpful assertion failure at assert(EMPTY()) or assert(STACK_LEVEL() <= frame->f_code->co_stacksize) or similar, at best, with no inducation as to where or why that assertion is failing. But if I enable __ltrace__ by either setting __ltrace__=1 in some module or by manually setting lltrace=1; in the c code, I can follow what was happening in the interpreter just before the crash.

I'd like the output in that scenario to be a ... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-04-08 - 2022-04-15)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7146 ( +0)
closed 51841 ( +0)
total 58987 ( +0)

Open issues with patches: 2890

Most recent 15 issues with no replies (15)

#47258: Python 3.10 hang at exit in drop_gil() (due to resource warnin
https://bugs.python.org/issue47258

#47256: re: limit the maximum capturing group to 1,073,741,823, reduce
https://bugs.python.org/issue47256

#47253: LOAD_GLOBAL instruction with wrong source position
https://bugs.python.org/issue47253

#47252: socket.makefile documentation is missing data regarding the 'b
https://bugs.python.org/issue47252

#47251: Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE
https://bugs.python.org/issue47251

#47244: email.utils.formataddr does not respect double spaces
https... continue reading

naive kindleBOT
#

The problem of assigning init arguments as attributes has appeared several
times in the past (
https://mail.python.org/archives/list/python-ideas@python.org/message/VLI3DOFA5VWMGJMJGRDC7JZTRKEPPZNU/
was the most recent we could find) and is already handled in dataclasses.

Lately, discussing this topic with a friend, we thought that using a
specific token could be a possible approach, so you could do:

class MyClass:

def \_\_init\_\_(self, @a, @b, c):

    pass

and it would be analogous to doing:

class MyClass:

def \_\_init\_\_(self, a, b, c):

    self.a = a

    self.b = b

Then, you would instantiate the class as usual, and the variables tagged
with @ would be bound to the object:

objekt = MyClass(2, 3, 4)

print(objekt.b)

3

print(objekt.c)

AttributeError: 'MyClass' object has no attribute 'c'

We have a working implementation here if anyone wants to take a look at:
https://github.com/pabloalcain/cpython/tree/feature/auto\_attribute. Keep i... continue reading

naive kindleBOT
#

Hi,

We are currently debating in gh-88116 (
https://github.com/python/cpython/issues/88116)
what's the best way forward to update the APIs in the inspect module to
include the new position information.

These APIs are inspect.getframeinfo, inspect.getouterframes,
inspect.getinnerframes, inspect.stack and inspect.trace.

The problem is that these APIs return a named tuple that now needs to
include several new attributes (or one 4 tuple for
the positions). Being named tuples, if we add a new attribute, existing
unpackings of the tuple will now fail because there
are more elements or the elements are in different positions. Also, it will
be quite weird to add the new attributes at the
end but leave the line number at the beginning.

What's the best way to proceed here? The suggested way is to create a
namedtuple subclass that adds the extra attributes
but doesn't allow indexed access to it (there is a precedent to this in how
we handled updating os.stat_result). I personally
find this q... continue reading

naive kindleBOT
naive kindleBOT
#

Turn your Jupyter notebook, Python script, Julia script, R script or Bash
script into a web-based tool or runnable report by writing a configuration
file. We are happy to announce the latest release of our CrossCompute
Analytics Automation Framework.

  • crosscompute 0.9.2.3 is our development server that turns notebooks and
    scripts into web-based tools and runnable reports.
  • crosscompute-views-map 0.1.2.1 adds interactive maps to your reports.
  • crosscompute-printers-pdf 0.3.2 adds batch PDF print functionality.
  • jupyterlab-crosscompute 0.2.2 lets you prototype automated reports
    without leaving the JupyterLab environment.

Please see
https://github.com/crosscompute/crosscompute/blob/develop/crosscompute/templates/configuration.yml
for available configuration options.

pip install crosscompute crosscompute-views-map
git clone https://github.com/crosscompute/crosscompute-examples
cd crosscompute-examples/widgets/paint-letters
bash setup.sh
crosscompute

pip instal... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-04-15 - 2022-04-22)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7146 ( +0)
closed 51841 ( +0)
total 58987 ( +0)

Open issues with patches: 2890

Most recent 15 issues with no replies (15)

#47258: Python 3.10 hang at exit in drop_gil() (due to resource warnin
https://bugs.python.org/issue47258

#47256: re: limit the maximum capturing group to 1,073,741,823, reduce
https://bugs.python.org/issue47256

#47253: LOAD_GLOBAL instruction with wrong source position
https://bugs.python.org/issue47253

#47252: socket.makefile documentation is missing data regarding the 'b
https://bugs.python.org/issue47252

#47251: Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE
https://bugs.python.org/issue47251

#47244: email.utils.formataddr does not respect double spaces
https... continue reading

naive kindleBOT
#

This document is a loose proto-PEP for a new "forward class" / "continue
class" syntax.  Keep in mind, the formatting is a mess. If I wind up
submitting it as a real PEP I'll be sure to clean it up first.

/arry


PEP XXXX: Forward declaration of classes

Overview

Python currently has one statement to define a class, the class statement:

     class X():
         # class body goes here
         def __init__(self, key):
             self.key = key

This single statement declares the class, including its bases and metaclass,
and also defines the contents of the class in the "class body".

This PEP proposes an additional syntax for declaring a class which splits
this work across two statements:

  • The first statement is forward class, which declares the class and binds
      the class object.
  • The second statement is continue class, which defines the contents
      of the class in the "class body".

To be clear: `forward... continue reading

#

Here's one alternate idea for how to implement the "forward class" syntax.

The entire point of the "forward class" statement is that it creates
the real actual class object.  But what if it wasn't actually the
"real" class object?  What if it was only a proxy for the real object?

In this scenario, the syntax of "forward object" remains the same.
You define the class's bases and metaclass.  But all "forward class"
does is create a simple, lightweight class proxy object.  This object
has a few built-in dunder values, __name__ etc.  It also allows you
to set attributes, so let's assume (for now) it calls
metaclass.__prepare__ and uses the returned "dict-like object" as
the class proxy object __dict__.

"continue class" internally performs all the rest of the
class-creation machinery.  (Everything except __prepare__, as we
already called that.)  The first step is metaclass.__new__, which
returns the real class object.  "continue class" takes that
object and calls a m... continue reading

naive kindleBOT
#

Just a quick note from me on the proto-PEP and the two proposed
implementations.  When I started exploring this approach, I didn't
suspect it'd require such sweeping changes to be feasible. Specifically,
I didn't think I was going to propose changing the fundamental mechanism
used to create class objects.  That's an enormous change, and it makes
me uncomfortable; I suspect I won't be alone in having that reaction.

The alternate implementation with proxy objects was borne of my
reaction, but it's worrisome too.  It's a hack--though whether it's a
"big" hack or a "small" hack is debatable.  Anyway, I'm specifically
worried about the underlying class object escaping the proxy and
becoming visible inside Python somehow.  If that happened, we'd have two
objects representing the same "type" at runtime, a situation that could
quickly become confusing.

Also, as I hopefully made clear in the "alternate implementation"
approach using a class proxy object, I'm not 100% certain tha... continue reading

naive kindleBOT
#

Hello,
As an initial implementation that will be improved in the future, the
specification in PEP 681 is fine. Feel free to add the decorator to
Python 3.11 at your convenience.

However, the PEP includes several worrying recommendations like:

  • we recommend that the maintainers of attrs move away from the legacy
    semantics and adopt auto_attribs behaviors by default.
  • We chose not to support this feature and recommend that attrs users
    avoid converters.
  • Attrs users should use the dataclass-standard eq and order parameter
    names instead.

These are probably meant as recommendations from typing-sig, but an
accepted PEP represents consensus of the entire Python community. A
typing PEP is not an appropriate place to make recommendations like
this, especially without reaching out to the maintainer of attrs.
As far as I know,the attrs and pydantic libraries are using the
reference implementation, but their authors weren't consulted on the PEP
itself.

Could you either change the... continue reading

naive kindleBOT
#

On behalf of the Nikola team, I am pleased to announce the immediate
availability of Nikola v8.2.1. This is a minor release with a couple
new features, as well as fixes for compatibility with the latest
version of doit.

What is Nikola?

Nikola is a static site and blog generator, written in Python.
It can use Mako and Jinja2 templates, and input in many popular markup
formats, such as reStructuredText and Markdown — and can even turn
Jupyter Notebooks into blog posts! It also supports image galleries,
and is multilingual. Nikola is flexible, and page builds are extremely
fast, courtesy of doit (which is rebuilding only what has been changed).

Find out more at the website: https://getnikola.com/

Downloads

Install using pip install Nikola.

Changes

Features

  • Add emphasize\_lines directive to code blocks (Issue #3607)
  • Gallery index pages support the status flag (Issue #3598)
  • Add start\_at opt... continue reading
#

pytest 7.1.2 has just been released to PyPI.

This is a bug-fix release, being a drop-in replacement. To upgrade::

pip install --upgrade pytest

The full changelog is available at
https://docs.pytest.org/en/stable/changelog.html.

Thanks to all of the contributors to this release:

  • Anthony Sottile
  • Bruno Oliveira
  • Hugo van Kemenade
  • Kian Eliasi
  • Ran Benita
  • Zac Hatfield-Dodds

Happy testing,
The pytest Development Team

naive kindleBOT
#

I'm happy to announce the release of Pygments 2.12. Pygments is a
generic syntax highlighter written in Python.

Pygments 2.12 provides several new lexers and various improvements to
existing lexers. Please have a look at the changelog
https://pygments.org/docs/changelog/. This release drops support for
Python versions earlier than Python 3.6.

Report bugs and feature requests in the issue tracker:
https://github.com/pygments/pygments/issues. Thanks go to all the
contributors of these lexers, and to all those who reported bugs and
waited very patiently for this release.

Download it from https://pypi.org/project/Pygments/, or look at
the demonstration at https://pygments.org/demo/.

Enjoy,
Matthäus

naive kindleBOT
naive kindleBOT
#

________________________________________________________________________

ANNOUNCING

                eGenix Antispam Bot for Telegram

                       Version 0.3.0

           A simple, yet effective bot implementation
                to address Telegram signup spam.

This announcement is also available on our web-site for online reading:
https://www.egenix.com/company/news/eGenix-Antispam-Bot-for-Telegram-0.3.0-GA.html

________________________________________________________________________

INTRODUCTION

eGenix has long been running a local user group meeting in Düsseldorf
called Python Meeting Düsseldorf and we are using a Telegram group for
most of our communication.

In the early days, the group worked well and we only had few spammers
joining it, which we could well handle manually.

More recently, this has chang... continue reading

naive kindleBOT
#

This is useful in the context of reducing the available methods and operator overloading, when subclassing a type.
Typically, when subclassing a NamedTuple type, you often don't want the <, >, <=, >=, + or * operators to work, so in that case you would want for the related methods to return NotImplemented.
This can be done with (and I hope triple-backquotes markdown works here) :

def NotImplementedMethod(self, other):
    return NotImplemented

class ...:
    ...
    __le__ = __lt__ = __ge__ = __gt__ = __mul__ = __rmul__ = __add__ = __radd__ = NotImplementedMethod

This is very handy, and I think it should be added to the builtins.

A simple way to implement this could be to have NotImplemented(a, b) return NotImplemented for any value of a and b, so that NotImplemented can be used instead of NotImplementedMethod in the above example.
A caveat for that version, and the reason I would not recommand it, is that it makes NotImplemented a callable when it doesn't need to be, and... continue reading

naive kindleBOT
#

Sorry, folks, but I've been busy the last few days--the Language Summit
is Wednesday, and I had to pack and get myself to SLC for PyCon, &c. 
I'll circle back and read the messages on the existing threads
tomorrow.  But for now I wanted to post "the wonderful third option" for
forward class definitions we've been batting around for a couple of days.

The fundamental tension in the proposal: we want to /allocate/ the
object at "forward class" time so that everyone can take a reference to
it, but we don't want to /initialize/ the class (e.g. run the class
body) until "continue class" time.  However, the class might have a
metaclass with a custom __new__, which would be responsible for
allocating the object, and that isn't run until after the "class body". 
How do we allocate the class object early while still supporting custom
metaclass.__new__ calls?

So here's the wonderful third idea.  I'm going to change the syntax and
semantics a little, again because we were ba... continue reading

naive kindleBOT
#

Hi,

There are 4 main ways to run Python:

(1) python -m module [...]
(2) python script.py [...]
(3) python -c code [...]
(4) python [...]

(1) and (2) insert the directory of the module/script at sys.path[0].
(3) and (4) insert an empty string at sys.path[0].

This behavior is convenient and is maybe part of Python usability
success: importing a module in the current directory is as easy as
"import other_module" (load other_module.py). But it's also a threat
to security: an attacker can override a stdlib module by creating a
Python script with the same name than a stdlib module, like os.py or
shutil.py.

People learning Python commonly create a file with the same name than
a stdlib module (ex: random.py) and then are clueless in face of an
ImportError exception.

Changing the default behavior was discussed multiple times. No
consensus was reached, maybe because most users like the current
default behavior and are not affected by corner cases (see below).

I propose adding a -P optio... continue reading

naive kindleBOT
#

PyCA cryptography 37.0.0 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.

Changelog (https://cryptography.io/en/latest/changelog/#v37-0-0):

  • Updated Windows, macOS, and Linux wheels to be compiled with OpenSSL 3.0.2.
  • BACKWARDS INCOMPATIBLE: Dropped support for LibreSSL 2.9.x and
    3.0.x. The new minimum LibreSSL version is 3.1+.
  • BACKWARDS INCOMPATIBLE: Removed signer and verifier methods from the
    public key and private key classes. These methods were originally
    deprecated in version 2.0, but had an extended deprecation timeline
    due to usage. Any remaining users should transition to sign and
    verify.
  • Deprecated OpenSSL 1.1.0 support. OpenSSL 1.1.0 is no longer
    supported by the OpenSSL project. The next release of cryptography
    will be the last to support... continue reading
#

I often want a side_effect of "if called with foo, return bar" functionality. This is really useful when the order of calls to your mock is indeterminate, so you can't just use an iterable. What I end up doing is writing a little function:

def f(x):
data = {
'foo': 'bar',
'baz': 'blah',
}
return data[x]

my_mock.side_effect = f

sometimes I wrap that up in a lambda, but either way it's fidgety boilerplate which obfuscates the intent. It would be nice if side_effect could accept a dict and provide the above functionality for free:

my_mock.side_effect = {
'foo': 'bar',
'baz': 'blah',
}

If could handle DEFAULT just like side_effect does now. And it could throw something more useful than KeyError if the key isn't found.

I could see the argument that "but dicts are themselves iterable, so this could break some existing mocks which depend on side_effect iterating over the dicts keys. That would be bizarre, but possible. The fix for that would be invent a new attri... continue reading

naive kindleBOT
#

EnumMeta implements its own __getitem__ function which doesn't respect
__class_getitem__. Now that __class_getitem__ exists, this behavior feels
unintuitive. For instance

class Directions(enum.Enum):
  LEFT = "LEFT"
  RIGHT = "RIGHT"

  def __class_getitem__(cls, name):
    return super().__class_getitem__(name.upper())

# fails with KeyError -- __class_getitem__ never called
assert Directions["left"] == Directions["LEFT"] == Directions.LEFT

doesn't work, and the only way to implement this behavior is something like

class MyEnumMeta(enum.EnumMeta):
  def __getitem__(cls, name):
    return cls.__class_getitem__(name)

class MyEnum(enum.Enum, metaclass=MyEnumMeta):
  def __class_getitem__(cls, name):
    return cls._member_map_[name]

class Directions(MyEnum): ...

there might be some compatibility issues with code written between 3.4 and
3.11, but not supporting __class_getitem__ feels like it violates the
principle of least surprise with the more r... continue reading

naive kindleBOT
#

Hello,
Victor and others are organizing the C-API to make it clearer what's
public and what's private (see Victor's file-based stats:
https://pythoncapi.readthedocs.io/stats.html)

It became clear that we need a tier between public and private C-API.
PEP 689 proposes such API, with an opt-in macro and transition period.

Please discuss.
And if you can think of a better name, that would be great :)

The PEP is at: https://peps.python.org/pep-0689/
Thread where this started:
https://mail.python.org/archives/list/python-dev@python.org/thread/MA4FQ7G6F35NG3TUN6RQPXRGXTYMFMDY/#MA4FQ7G6F35NG3TUN6RQPXRGXTYMFMDY
Implementation notes: https://github.com/python/cpython/issues/91744

Here's the current version for easy quoting:


PEP: 689
Title: Semi-stable C API tier
Author: Petr Viktorin encukou@gmail.com
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Requires: 523
Created: 22-Apr-2022
Python-Version: 3.11

Abstract

Some functions and types of the C-A... continue reading

naive kindleBOT
#

Hi,

If you got issues with using the Python C API <Python.h> in C++,
please speak up! I'm looking for feedback :-)

Extending Python by writing C++ code is now easy with the pybind11 project:
https://pybind11.readthedocs.io/

It seems like over the last years, building C++ extensions with the
Python C API started to emit more C++ compiler warnings. One
explanation may be that converting macros to static inline functions
(PEP 670) introduce new warnings, even if the old and the new code is
exactly the same. I just discover this issue recently. C and C++
compilers treat static inline functions differently. Macros are
treated at legacy code which cannot be fixed, like system headers or
old C header files, and so many warnings are made quiet. Static inline
functions (defined in header files) are treated as regular code and
compilers are more eager to emit warnings.

I just modified the Python C API to use C++ static_cast<type>(expr)
and reinterpret_cast<type>(expr) if it's used with C++... continue reading

naive kindleBOT
#

PyCA cryptography 37.0.0 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.

Changelog (https://cryptography.io/en/latest/changelog/#v37-0-1):

  • Fixed an issue where parsing an encrypted private key with the
    public loader functions would hang waiting for console input on
    OpenSSL 3.0.x rather than raising an error.
  • Restored some legacy symbols for older pyOpenSSL users. These will
    be removed again in the future, so pyOpenSSL users should still
    upgrade to the latest version of that package when they upgrade
    cryptography.

-Paul Kehrer (reaperhulk)

naive kindleBOT
#

Leo http://leoeditor.com 6.6.1 is now available on GitHub
https://github.com/leo-editor/leo-editor/releases and pypi
https://pypi.org/project/leo/6.6.1/.

Leo is an IDE, outliner and PIM http://leoeditor.com/preface.html.

The highlights of Leo 6.6.1

  • Improve support for Python 3.10 and PyQt6.
  • Simplify the TokenOrderGenerator class in leoAst.py.
  • Improve argument handling when running leo.core.leoAst externally.
    Run python -m leo.core.leoAst -h for details.
  • Control-clicking on a file name searches for the corresponding @<file>
    node.</file>
  • Create clickable links when copying text into the log pane.
  • Leo's mypy command runs without blocking Leo.
  • Improve the add-mypy-annotations command.
  • Clean all files with reindent.
  • The usual minor bug fixes.

6.6.1 Links

naive kindleBOT
#

Background
It is frequently desirable to delete a dictionary entry if the key exists. It is necessary to check that the key exists or, alternatively, handle a KeyError: for, where d is a dict, and k is a valid hashable key, del d[k] raises KeyError if k does not exist.

Example:

if k in d:
    del d[k]

Idea
Use the -= operator with the key as the right operand to delete a dictionary if the key exists.

Demonstration-of-Concept

class DemoDict(dict):
    def __init__(self, obj):
        super().__init__(obj)

    def __isub__(self, other):
        if other in self:
            del self[other]
            return self


if __name__ == '__main__':
    given = {'a': 1, 'b': 2, 'c': 3, 'd': 4}
    demo = DemoDict(given)
    demo -= 'c'
    assert(demo == {'a': 1, 'b': 2, 'd': 4})
naive kindleBOT
#

Consider this example code:

def test():
a = A()

test()

Currently, the locals (i.e. a) are cleared only after the function
has returned:

If we attach a finalizer to a immediately after the declaration then
the frame stack available via sys._getframe() inside the finalizer
function does not include the frame used to evaluate the function
(i.e. with the code object of the test function).

The nearest frame is that of the top-level module (where we make the
call to the function).

This is in practical terms no different than:

def test():
return A()

test()

There's no way to distinguish between the two cases even though in the
second example, the object is dropped only after the frame (used to
evaluate the function) has been cleared.

The effect I am trying to achieve is:

def test():
a = A()
del a

Here's a use-case to motivate this need:

In Airflow, we're considering introducing some "magic" to help users write:

with DAG(...):
# some code here

That is,... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-04-22 - 2022-04-29)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7146 ( +0)
closed 51841 ( +0)
total 58987 ( +0)

Open issues with patches: 2890

Most recent 15 issues with no replies (15)

#47258: Python 3.10 hang at exit in drop_gil() (due to resource warnin
https://bugs.python.org/issue47258

#47256: re: limit the maximum capturing group to 1,073,741,823, reduce
https://bugs.python.org/issue47256

#47253: LOAD_GLOBAL instruction with wrong source position
https://bugs.python.org/issue47253

#47252: socket.makefile documentation is missing data regarding the 'b
https://bugs.python.org/issue47252

#47251: Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE
https://bugs.python.org/issue47251

#47244: email.utils.formataddr does not respect double spaces
https... continue reading

naive kindleBOT
#

There is a special handling of __hash__ set to None in the interpreter
core. This is because every class inherited the __hash__ attribute
from "object", and setting __hash__ = None is a simple way to make it
unhashable. It makes hash() raising the correct type of exception
(TypeError), but with unhelpful error message "'NoneType' object is not
callable". The special case was added to make the error message more
relevant: "unhashable type: '{typename}'".

There is similar situation with other special methods defined in
"object" or other common classes. Sometimes we want to cancel the
default inherited behavior.

>>> dir(object)
['\_\_class\_\_', '\_\_delattr\_\_', '\_\_dir\_\_', '\_\_doc\_\_', '\_\_eq\_\_', 

'__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__',
'__hash__', '__init__', '__init_subclass__', '__le__', '__lt__',
'__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__'... continue reading

naive kindleBOT
#

PyCA bcrypt 3.2.1 has been released to PyPI. Bcrypt provides
modern(-ish) password hashing using, unsurprisingly, the bcrypt
algorithm.

Changelog:

  • Added support for compilation on z/OS
  • The next release of bcrypt will be 4.0 and it will require Rust at
    compile time, for users building from source. There will be no
    additional requirement for users who are installing from wheels. Users
    on most platforms will be able to obtain a wheel by making sure they
    have an up to date pip. The minimum supported Rust version will be
    1.56.0.
  • This will be the final release for which we ship manylinux2010
    wheels. Going forward the minimum supported manylinux ABI for our
    wheels will be manylinux2014. The vast majority of users will continue
    to receive manylinux wheels provided they have an up to date pip.

-Paul Kehrer (reaperhulk)

naive kindleBOT
#

On behalf of the Nikola team, I am pleased to announce the immediate
availability of Nikola v8.2.2. This is a bugfix release, whose only
change is support for the latest version of Pygments.

What is Nikola?

Nikola is a static site and blog generator, written in Python.
It can use Mako and Jinja2 templates, and input in many popular markup
formats, such as reStructuredText and Markdown — and can even turn
Jupyter Notebooks into blog posts! It also supports image galleries,
and is multilingual. Nikola is flexible, and page builds are extremely
fast, courtesy of doit (which is rebuilding only what has been changed).

Find out more at the website: https://getnikola.com/

Downloads

Install using pip install Nikola.

Changes

  • Compatibility with Pygments 2.12.0 (Issue #3617, #3618)

--
Chris Warrick https://chriswarrick.com
PGP: 5EAAEA16

naive kindleBOT
#

Previously discussed here 1 [2], it was raised that the input function could take file objects to display prompts in places other than sys.stdout and receive input from places other than sys.stdin. Locally, the patch I have produces the following help text:

Help on built-in function input in module builtins:

input(prompt=None, /, infile=None, outfile=None)
    Read a string from a stream, or from standard input by default.  The trailing newline is stripped.
    
    The output file is standard output by default.
    
    The prompt string, if given, is printed to the output file without a
    trailing newline before reading input.
    
    If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.
    On *nix systems, readline is used if available.

The idea of an errfile parameter was also raised.

What do people think about this?

[2]: https://mail.python.org/pipermail/python-... continue reading

#

Previously raised here [1], contextlib.redirect_stdio would be a utility function to help redirect standard input, output and error. The idea of a function called "stdio" that does the same thing was also raised. The function would combine the functionality of contextlib.redirect_stdout and contextlib.redirect_stderr which work as described in the documentation [2].

It would also add "contextlib.redirect_stdin" functionality which currently appears to be missing.

The usage described in the original python-ideas post looks like this:

There's already contextlib.redirect_stdout() and
contextlib.redirect_stderr(). Adding contextlib.redirect_stdin() would
be logical, but I think a more flexible

contextlib.redirect\_stdio(stdin=None, stdout=None, stderr=None)

would be better - where None (the default) means "leave this alone".

I'm interested to hear what people think about this.

Kind regards,
Sam Ezeh

[1]: https://mail.python.org/pipermail/python-ideas/2017-Se... continue reading

naive kindleBOT
#

We’re happy to announce version 0.9.0 of blue, the somewhat less uncompromising code formatter than black. blue changes a few defaults, such as preferring single quotes instead of double quotes. Here is a brief list of differences from black:

  • blue defaults to single-quoted strings for everything except docstrings and triple quoted strings.
  • blue defaults to line lengths of 79 characters.
  • blue preserves the whitespace before the hash mark for right hanging comments.
  • blue supports multiple config files: pyproject.toml, setup.cfg, tox.ini, and .blue.

Changes since 0.8.0:

  • Fix test suite failures due to a confluence of problems (GH#74)
  • Upgrade dependency on Black to 22.1.0 to support Python 3.10 (GH#67)
  • Add link to demo site at https://iblueit.dev (GH#69)

Notice that last bullet item - you can play with blue online!

For details see https://blue.readthedocs.io/en/latest/

Enjoy!
-Barry (on behalf of the blue developers)

naive kindleBOT
#

Hello,

PEP 690 https://peps.python.org/pep-0690/ is now live! It proposes an
exciting new feature to transparently defer the execution of imported
modules until the moment when an imported object is used. Since Python
programs commonly import many more modules than a single invocation of the
program is likely to use in practice, lazy imports can greatly reduce the
overall number of modules loaded, improving startup time and memory usage.

At Meta, we have implemented this feature in Cinder
https://github.com/facebookincubator/cinder, and has already demonstrated
https://github.com/facebookincubator/cinder/blob/cinder/3.8/CinderDoc/lazy\_imports.rst
startup time improvements up to 70% and memory-use reductions up to 40% on
real-world Python CLIs, while also eliminating the risk for most import
cycles.

Please, don't reply to this message. Feel free to comment or share thoughts
and feedback in Python Discourse
https://discuss.python.org/t/pep-690-lazy-imports at
https://discuss.... continue reading

naive kindleBOT
#

PyCA cryptography 37.0.2 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.

Changelog (https://cryptography.io/en/latest/changelog/#v37-0-2):

  • Updated Windows, macOS, and Linux wheels to be compiled with OpenSSL 3.0.3.
  • Added a constant needed for an upcoming pyOpenSSL release.

-Paul Kehrer (reaperhulk)

naive kindleBOT
#

This proposal is about adding a builtin function or a package to the standard library to access an element in an object hierarchy with default behavior i.e. if at any level the attribute/key/index does not exist in the path the function returns a default value.
Motivation: mapping an object tree to a tuple or a flat object cannot be achieved compactly with proper error handling.
Need: I have found a half dozen of packages implementing this functionality on github and there is a high number of loosely related libraries.
Here is a motivating example:
animal = {
'name': 'Wombat',
'avg_properties': {
'height': {'value': 66, 'unit': 'cm'},
'length':{'value': 108, 'unit': 'cm'},
'weight': {'value': 27, 'unit': 'kg'}
}
}
assert getpath(animal, ('avg_properties', 'length', 'value'), default='-') == 108
assert getpath(animal, ('min_properties', 'length', 'value'), default='-') == '-'
assert getpaths(animal, 'avg_properties.length.value', default='-') == 108
a... continue reading

naive kindleBOT
#

I subscribe to the python/cpython stuff on GitHub. I find it basically
impossible to follow because of the volume. I realize there are
probably plenty of extra changes going in based on the recent language
summit (and maybe some sprints at PyCon?) as well as the proximity to
the beta 1 freeze. Still, does anyone actually try to follow
everything that comes out of that firehose? I've received updates to
about 125 new GMail conversations (more total messages than that) in
the last 24 hours, and that's after using filters to delete
Miss-Islington-type messages altogether. As far as I can quickly
ascertain, all the messages are from real people, not bots.

How (if at all) do people deal with this firehose of email? Am I the
only person dumb enough to have tried? I used to scan for
csv-module-related messages, but don't even try to do that now. My
only real reason for continuing to subscribe is that it feeds into a
process that updates a dictionary of "common" words used by my
XKCD-936-deri... continue reading

naive kindleBOT
#

Hi everyone,

Today we need to start the release of Python 3.11 beta 1. Currently, we
have the following blockers:

Please, if you are involved in the above issues check if they are resolved
or if they are not released blockers (notice any semantic change, API
change,
public data structure change or grammar change must be done before beta 1
is released). I will look at the buildbots later today but if you have some
time to investigate, that would help a lot!

I am blocking the main branch so only the release team can merge changes
until these problems are addressed and we can continue with the release.

Please, add me as a reviewer to any PR that nee... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-04-29 - 2022-05-06)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7146 ( +0)
closed 51841 ( +0)
total 58987 ( +0)

Open issues with patches: 2890

Most recent 15 issues with no replies (15)

#47258: Python 3.10 hang at exit in drop_gil() (due to resource warnin
https://bugs.python.org/issue47258

#47256: re: limit the maximum capturing group to 1,073,741,823, reduce
https://bugs.python.org/issue47256

#47253: LOAD_GLOBAL instruction with wrong source position
https://bugs.python.org/issue47253

#47252: socket.makefile documentation is missing data regarding the 'b
https://bugs.python.org/issue47252

#47251: Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE
https://bugs.python.org/issue47251

#47244: email.utils.formataddr does not respect double spaces
https... continue reading

naive kindleBOT
#

In its current implementation, the list type does not provide a simple and straightforward way to retrieve one of its elements that fits a certain criteria.

If you had to get the user where user['id'] == 2 from this list of users, for example, how would you do it?

users = [
{'id': 1,'name': 'john'},
{'id': 2, 'name': 'anna'},
{'id': 3, 'name': 'bruce'},
]

way too verbose and not pythonic

ids = [user['id'] for user in users]
index = ids.index(2)
user_2 = users[index]

short, but it feels a bit janky

user_2 = next((user for user in users if user['id'] == 2), None)

this is okay-ish, i guess

users_dict = {user['id']: user for user in users}
user_2 = users_dict.get(2)

In my opinion, the list type could have something along these lines:

class MyList(list):
def find(self, func, default=None):
for i in self:
if func(i):
return i
return default

my_list = MyList(users)
user_2 = my_list.find(lambda user: user['id'] ... continue reading

naive kindleBOT
#

We did it, team!! After quite a bumpy release process and a bunch of
last-time fixes, we have reached beta 1 and feature freeze. What a
ride eh? You can get the shiny new release artefacts from here:

https://www.python.org/downloads/release/python-3110b1/

This is a beta preview of Python 3.11

Python 3.11 is still in development. 3.11.0b1 is the first of four planned
beta release previews. 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.11 during the beta phase and report issues found to the
Python bug tracker
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 (... continue reading

naive kindleBOT
#

We did it, team!! After quite a bumpy release process and a bunch of
last-time fixes, we have reached beta 1 and feature freeze. What a
ride eh? You can get the shiny new release artefacts from here:

https://www.python.org/downloads/release/python-3110b1/

This is a beta preview of Python 3.11

Python 3.11 is still in development. 3.11.0b1 is the first of four planned
beta release previews. 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.11 during the beta phase and report issues found to the
Python bug tracker
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... continue reading

naive kindleBOT
#

I don't have an opinion one way or the other, but there is a discussion
on Discourse about the walrus operator:

https://discuss.python.org/t/walrus-fails-with/15606/1

Just a quick straw poll, how would people feel about relaxing the
restriction on the walrus operator so that iterable unpacking is
allowed?

# Currently a syntax error.
results = (1, 2, (a, b) := (3, 4), 5)

which would create the following bindings:

results = (1, 2, (3, 4), 5)
a = 3
b = 4

A more complex example:

expression = "uvwxyz"
results = (1, 2, ([a, *b, c] := expression), 5)

giving:

results = (1, 2, "uvwxyz", 5)
a = "u"
b = ("v", "w", "x", "y")
c = "z"

Thoughts?

--
Steve

naive kindleBOT
#

Hi all,

We just released Sphinx-5.0.0b1.
It has many changes including incompatible ones.
Please confirm it working fine on your documents.

In detail, please see CHANGES:
https://github.com/sphinx-doc/sphinx/blob/5.0.x/CHANGES

You can use it with: pip install --pre Sphinx

Since this is a beta release, we expect that you may encounter bugs.
If you find a bug, please file an issue on Github issues:
https://github.com/sphinx-doc/sphinx/issues

Thanks,
Takeshi KOMIYA

naive kindleBOT
#

I've been unable to find a discussion on the following subject.

I think structural pattern matching could sometimes be more useful to
be available to form an expression than to form a statement. To be
specific, given the definition of a function of the form

def f():
    match <expression>:
        case <pattern 1> if <condition 1>: return <expression 1>
        case <pattern 2> if <condition 2>: return <expression 2>
        case ...
    ......

I imagine something like

(<expression 1>) if <condition 1> case <pattern 1>\
    else <expression 2> if <condition 2> case <pattern 2>\
    else ...
    ......
    else <expression last> case _ match (<expression>)

as an expression such that it preceded by "lambda : " would specify an
equivalent function. This of course doesn't fully characterize the
expression, which could be evaluated not just in the scope of the
function. To in terms of the two functions, they could be equivalent
including how the local namespace is mo... continue reading

naive kindleBOT
#

An importlib.resources.as_file equivalent but for whole directories.

To access a directory of files in a package and load them (for example, a skybox with 6 faces), one would need to use as_file 6 times with 6 context managers. Moreover, if the API required a path to a folder that contained the 6 images, this would require manual extraction.

naive kindleBOT
#

Hi,

I added the -P command line option and the PYTHONSAFEPATH=1
environment variable to Python 3.11 beta 1 to not prepend an "unsafe
path" to sys.path such as the script's directory or the current
directory:

https://docs.python.org/dev/using/cmdline.html#cmdoption-P

Example:

$ echo 'Nope!' >random.py # broken module
$ echo 'import random; print(random.randint(1, 6))' >dice.py

$ python3.11 dice.py # default behavior
(...) File "/home/vstinner/random.py", line 1 (...)
SyntaxError: invalid syntax

$ python3.11 -P dice.py # ignore local random.py
4

Please test Python 3.11 beta1 with the PYTHONSAFEPATH=1 environment
variable set, or at least run python with the -P option. I'm curious
which use cases are not affected and which use cases are affected.

The PYTHONSAFEPATH=1 environment variable is inherited and so affect
child processes. It can break applications relying on Python 3.10
sys.path behavior. I proposed adding -p option which does the opposite
of the -... continue reading

naive kindleBOT
naive kindleBOT
#

A proposal for a new tool to be implemented  -

It is often the case that developer write Code in Python and then
convert to a C extension module for performance regions.

A C extension module has a lot of boiler plate code - for instance the
Structures required for each class, the functions for Module
initialization etc.

My Idea is a simple tool that uses introspection tools to take a Python
module and to generate the relevant boiler plate for the module -
including blank functions for the module classes and for methods. This
tool would use type annotations (if given) to make sensible choices for
parameter and attribute types, including using int and float directly
rather than Internal objects (depending on tool options).

The idea is that the C extension module would present the same 'API' as
the original Python module.

The tool would not attempt to write the C code within the functions/methods.

I am aware of the challenges writing this tool, but I think a tool could
mak... continue reading

#

Hi,

Two years ago, PEP 632 "Deprecate distutils module" was accepted: the
distutils package was deprecated in Python 3.10 and scheduled for
removal in Python 3.12. Questions.

  • Is the Python ecosystem ready for the distutils removal? How many
    projects are expected to be broken by this removal?

  • Is setuptools a drop-in replacement of distutils for most cases? Are
    there tools and documentation explaining how to replace distutils with
    setuptools?

  • Is there a tool to migrate from setup.py (distutils) to
    pyproject.toml (setuptools)? The dephell project can convert a
    setup.py script to pyproject.toml using poetry as the build system.

  • Can we simply suggest installing setuptools to users who still use
    "import distutils"? setuptools now provides the a "distutils" package.

  • Should we keep distutils in Python stdlib a few more Python releases
    if the removal causes too many practical issues?

A code search in top 5000 PyPI projects (at 2022-01-26) using the
regex '(import|from) distut... continue reading

naive kindleBOT
#

Hello all.

It occurs to me that creating threads in Python is more awkward than it needs to be. Every time I want to start a new thread, I end up writing the same thing over and over again:

def target(*args, **kwds):
...
t = threading.Thread(target = target, args = <something>, kwargs= <something>)
t.start()

This becomes especially repetitive when calling a target function that only makes sense when run in a new thread, such as a timer.

In my own code, I’ve taken to decorating functions that always run in new threads. Then I can call the function using the usual function call syntax, and have the new thread returned to me. With the decorator, the code reads instead:

@threaded
def target(*args, **kwds):

t = target(*args, **kwds)

This has a couple of advantages. I don’t have to import the threading module all over my code. I can use the neater syntax of function calls. The function’s definition makes it clear it’s returning a new thread since it’s decorated. It gets the p... continue reading

naive kindleBOT
#

I'm excited to announce the initial release of PyOxy: a single executable
file (C)Python distribution and alternative Python runner that gives you
more flexibility and control over how Python interpreters are run.

More details at
https://gregoryszorc.com/blog/2022/05/10/announcing-the-pyoxy-python-runner/
and https://pyoxidizer.readthedocs.io/en/latest/pyoxy.html.

naive kindleBOT
#

The blog posts about presentations and discussions from Python Language
Summit 2022 are now up for your enjoyment.

Main article:
https://pyfound.blogspot.com/2022/05/the-2022-python-language-summit\_01678898482.html

naive kindleBOT
#

Hi all,

It fills us with astronomical joy to announce the release of poliastro
0.16.3! 🚀

poliastro is an open source (MIT) pure Python library for interactive
Astrodynamics and Orbital Mechanics, with a focus on ease of use, speed,
and quick visualization. It provides a simple and intuitive API, and
handles physical quantities with units. It is used in academia and the
industry by people from all around the world.

You can install it using pip or conda:

pip install poliastro
conda install poliastro --channel conda-forge

This small release fixes some problems with latest Astropy on Python
3.10, and help us prepare for the upcoming SciPy 2022 conference in
Austin, Texas, USA. You can read the full release notes here:

https://docs.poliastro.space/en/v0.16.3/changelog.html#poliastro-0-16-3-
2022-05-09

If you want to learn more about poliastro, don't miss my talk on the
Open Source Cubesat Workshop held at the European Space Operations
Centre in 2017:

https://youtu.be/KnoYzqAw\_vM?t=... continue reading

naive kindleBOT
#

I would like to propose a new type of pattern for structural pattern
matching. A motivation will be described later below.

The pattern may be written in a form like

{<literal or variable>}

(with braces), where <literal or variable> is either a literal pattern
or an identifier (or "NAME" in the structural pattern matching
terminology in the language reference, meaning whatever the name of a
variable can be). At matching against a value, it should be evaluated
to the series of characters held as the string
format(<literal or variable>) returned (if computed successfully) by
the built-in function format. If those series of characters
is a valid pattern of another type, then the pattern should be matched
as the obtained pattern. Otherwise, an exception must be raised.

Here are simple examples to clarify the idea.

subject = "x"

pattern = "a"
print(format(pattern)) # --> a

match subject:
    case {pattern}: # interpreted as 'case a', so binds the subject
        # value ... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/2AFPEYEOCOC6AF6MIGYU5Y72M3XPXYP2/)
naive kindleBOT
#

ACTIVITY SUMMARY (2022-05-06 - 2022-05-13)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7146 ( +0)
closed 51841 ( +0)
total 58987 ( +0)

Open issues with patches: 2890

Most recent 15 issues with no replies (15)

#47258: Python 3.10 hang at exit in drop_gil() (due to resource warnin
https://bugs.python.org/issue47258

#47256: re: limit the maximum capturing group to 1,073,741,823, reduce
https://bugs.python.org/issue47256

#47253: LOAD_GLOBAL instruction with wrong source position
https://bugs.python.org/issue47253

#47252: socket.makefile documentation is missing data regarding the 'b
https://bugs.python.org/issue47252

#47251: Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE
https://bugs.python.org/issue47251

#47244: email.utils.formataddr does not respect double spaces
https... continue reading

naive kindleBOT
#

Hello,
Link to the github issue page is here https://github.com/python/cpython/issues/92359

This bug has been lurking in waiting for roughly 7 years or possibly longer. The root issue is that the "Edit with IDLE" context menu executes idle with python.exe -m idlelib which puts the current working directory in sys.path but inside idlelib it has a from code import ... statement. A kind of ugly hack is sitting in my fork of cpython here https://github.com/devdave/cpython/blob/issue\_92359/Lib/idlelib/\_\_main\_\_.py . All I did was put the Lib directory at the front of sys.path.
Perhaps this is the best solution? I don't know.

Would appreciate any ideas for an alternative fix (ex perhaps changing how "Edit with IDLE" works?) or like I said, perhaps my fix is the best option because of how simple it is?

Thanks,
DevDave

naive kindleBOT
naive kindleBOT
#

Hello.

I've been thinking it would be nice to be able to use await to suspend
execution until a condition is met (as represented by a function or lambda
which returns a boolean.

Currently, as far as I can tell, the way to accomplish this is with a while
loop which frequently checks the condition, suspending execution in between
checks. My use case is in robotics, so I'll use that. Here's a minimal
version of my current approach.

start_moving_to(dest)
while distance_to(dest) > tolerance:
await asyncio.sleep(1 / 60)

This requires choosing a somewhat arbitrary frequency with which to check
the condition. But if the frequency is too high, the function may not be
suspended often enough for other tasks to run and if it's too low, there's
a significant delay before the condition's satisfaction can be noticed.

So here's my proposal for syntax that I think is quite a bit cleaner:

start_moving_to(dest)
await lambda: distance_to(dest) <= tolerance

This eliminates the need to choo... continue reading

naive kindleBOT
#

Hi,

I propose adding a new C API to "build an Unicode string". What do you
think? Would it be efficient with any possible Unicode string storage
and any Python implementation?

PyPy has an UnicodeBuilder type in Python, but here I only propose C
API. Later, if needed, it would be easy to add a Python API for it.
PyPy has UnicodeBuilder to replace "str += str" pattern which is
inefficient in PyPy: CPython has a micro-optimization (in ceval.c) to
keep this pattern performance interesting. Adding a Python API was
discussed in 2020, see the LWN article:
https://lwn.net/Articles/816415/

Example without error handling, naive implementation which doesn't use
known length of key and value strings (calling Preallocate may be more
efficient):

// Format "key=value"
PyObject *format\_with\_builder(PyObject *key, PyObject *value)
{
    assert(PyUnicode\_Check(key));
    assert(PyUnicode\_Check(value));

    // Allocated on the stack
    PyUn... [continue reading](https://mail.python.org/archives/list/python-dev@python.org/thread/6SDAWEE3UERXRJ7S7GWDR3SDSMMDDLJK/)
naive kindleBOT
#

This is the thirteenth maintenance release of Python 3.9. Get it here:
Python 3.9.13 https://www.python.org/downloads/release/python-3913/
According to the release calendar specified in PEP 596 https://www.python.org/dev/peps/pep-0596/, Python 3.9.13 is the final regular maintenance release. Starting now, the 3.9 branch will only accept security fixes and releases of those will be made in source-only form until October 2025.

This is a milestone moment for me as it means that now both of my release series are security-only. My work as release manager enters its final stage. I’m not crying, you’re crying! 🥲

Compared to the 3.8 series, this last regular bugfix release is still pretty active at 166 commits since 3.9.12. In comparison, version 3.8.10, the final regular bugfix release of Python 3.8, included only 92 commits. However, it’s likely that it was 3.8 that was special here with the governance changes occupying core developers’ minds. For reference, version 3.7.8, the final re... continue reading

naive kindleBOT
#

This is the thirteenth maintenance release of Python 3.9. Get it here:
Python 3.9.13 https://www.python.org/downloads/release/python-3913/
According to the release calendar specified in PEP 596 https://www.python.org/dev/peps/pep-0596/, Python 3.9.13 is the final regular maintenance release. Starting now, the 3.9 branch will only accept security fixes and releases of those will be made in source-only form until October 2025.

This is a milestone moment for me as it means that now both of my release series are security-only. My work as release manager enters its final stage. I’m not crying, you’re crying! 🥲

Compared to the 3.8 series, this last regular bugfix release is still pretty active at 166 commits since 3.9.12. In comparison, version 3.8.10, the final regular bugfix release of Python 3.8, included only 92 commits. However, it’s likely that it was 3.8 that was special here with the governance changes occupying core developers’ minds. For reference, version 3.7.8, the final re... continue reading

naive kindleBOT
#

Hello,

I was thinking of a way to expand the current try-expect block to support
condinitial expect block. I was imagining the new syntax as

try:
expression block
expect Exception if condition
expression block

where the expect expression block would only run if the condition is met
else it would raise the exception, for example the following code

try:
config = get_config()
except Exception:
if use_default:
config = default
else:
raise

would be converted to

try:
config = get_config()
except Exception if use_default:
config = default

I find it very useful and also I found the same pattern in the following
packages that were installed on my system.

more_itertools/more.py:227
cloudinit/net/__init__.py:364
matplotlib/__init__.py:330
google/protobuf/internal/containers.py:126
networkx/algorithms/connectivity/edge_augmentation.py:296
twisted/internet/pollreactor.py:160
pyqtgraph/opengl/shaders.py:257
setuptools/_vendor/pypars... continue reading

naive kindleBOT
#

Hi all,

On behalf of the SciPy development team, I'm pleased to announce the
release of SciPy 1.8.1, which is a bug fix release that restores
Pythran usage on Windows.

Sources and binary wheels can be found at:
https://pypi.org/project/scipy/ and at:
https://github.com/scipy/scipy/releases/tag/v1.8.1

One of a few ways to install this release with pip:
pip install scipy==1.8.1

=====================
SciPy 1.8.1 Release Notes

SciPy 1.8.1 is a bug-fix release with no new features
compared to 1.8.0. Notably, usage of Pythran has been
restored for Windows builds/binaries.

Authors

  • Henry Schreiner
  • Maximilian Nöthe
  • Sebastian Berg (1)
  • Sameer Deshmukh (1) +
  • Niels Doucet (1) +
  • DWesl (4)
  • Isuru Fernando (1)
  • Ralf Gommers (4)
  • Matt Haberland (1)
  • Andrew Nelson (1)
  • Dimitri Papadopoulos Orfanos (1) +
  • Tirth Patel (3)
  • Tyler Reddy (46)
  • Pamphile Roy (7)
  • Niyas Sait (1) +
  • H. Vetinari (2)
  • Warren Weckesse... continue reading
naive kindleBOT
#

Vulture - Find dead code

Vulture finds unused code in Python programs. This is useful for
cleaning up and finding errors in large code bases. If you run Vulture
on both your library and test suite you can find untested code.

Due to Python's dynamic nature, static code analyzers like Vulture are
likely to miss some dead code. Also, code that is only called
implicitly may be reported as unused. Nonetheless, Vulture can be a
very helpful tool for higher code quality.

Download

https://github.com/jendrikseipp/vulture
http://pypi.python.org/pypi/vulture

Features

  • fast: uses static code analysis
  • tested: tests itself and has complete test coverage
  • complements pyflakes and has the same output syntax
  • sorts unused classes and functions by size with --sort-by-size
  • supports Python 3.6+

News

  • Print absolute filepaths as relative again (as in version 2.1 and before)
      if they are below the current directory (The-Compiler, #246).
    *... continue reading
naive kindleBOT
#

What Changed?

This is an enhancement and bug-fix release, and all users are encouraged to
upgrade.

Brief summary:

  • Fixed #161: Added a status attribute to the returned object from gen_key() which
      is set to 'ok' if a key was successfully created, or 'key not created' if that
      was reported by gpg, or None in any other case.

  • Fixed #164: Provided the ability to add subkeys. Thanks to Daniel Kilimnik for the
      feature request and patch.

  • Fixed #166: Added keygrip values to the information collected when keys are listed.
      Thanks to Daniel Kilimnik for the feature request and patch.

  • Fixed #173: Added extra_args to send_keys(), recv_keys() and search_keys() to allow
      passing options relating to key servers.

This release [2] has been signed with my code signing key:

Vinay Sajip (CODE SIGNING KEY) <vinay_sajip at yahoo.co.uk>
Fingerprint: CA74 9061 914E AC13 8E66 EADB 9147 B477 339A 9B86

Recent changes to PyPI don't show the GPG sig... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-05-13 - 2022-05-20)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7146 ( +0)
closed 51841 ( +0)
total 58987 ( +0)

Open issues with patches: 2890

Most recent 15 issues with no replies (15)

#47258: Python 3.10 hang at exit in drop_gil() (due to resource warnin
https://bugs.python.org/issue47258

#47256: re: limit the maximum capturing group to 1,073,741,823, reduce
https://bugs.python.org/issue47256

#47253: LOAD_GLOBAL instruction with wrong source position
https://bugs.python.org/issue47253

#47252: socket.makefile documentation is missing data regarding the 'b
https://bugs.python.org/issue47252

#47251: Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE
https://bugs.python.org/issue47251

#47244: email.utils.formataddr does not respect double spaces
https... continue reading

naive kindleBOT
#

Hello all,
I'm glad to announce the release of psutil 5.9.1:
https://github.com/giampaolo/psutil

About

psutil (process and system utilities) is a cross-platform library for
retrieving information on running processes and system utilization (CPU,
memory, disks, network) in Python. It is useful mainly for system
monitoring, profiling and limiting process resources and management of
running processes. It implements many functionalities offered by command
line tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free,
nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It
currently supports Linux, Windows, macOS, Sun Solaris, FreeBSD, OpenBSD,
NetBSD and AIX, both 32-bit and 64-bit architectures. Supported Python
versions are 2.7 and 3.4+. PyPy is also known to work.

What's new

2022-05-20

Enhancements

  • #1053: drop Python 2.6 support. (patches by Matthieu Darbois and Hugo van
    Kemenade)
  • #2050, [Linux]: increa... continue reading
naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.22.4. NumPy 1.22.4 is a maintenance release that fixes bugs discovered
after the 1.22.3 release. In addition, the wheels for this release are
built using the recently released Cython 0.29.30, which should fix the
reported problems with debugging
https://github.com/numpy/numpy/issues/21008.

The Python versions supported in this release are 3.8-3.10. Wheels can be
downloaded from PyPI https://pypi.org/project/numpy/1.22.4; source
archives, release notes, and wheel hashes are available on Github
https://github.com/numpy/numpy/releases/tag/v1.22.4. Note that the Mac
wheels are based on OS X 10.15 rather than 10.9 that was used in previous
NumPy release cycles.

Contributors

A total of 12 people contributed to this release. People with a "+" by
their
names contributed a patch for the first time.

naive kindleBOT
#

seek() and tell() works with opaque values, called cookies.
This is close to low level details, but it is not pythonic.
(Non-pythonic and non-portable behaviour)
Currently feeding seek() with wrong values could lead to unexpected behaviour.
There should be a safer abstraction to these two basic functions.

More details in the issue:
https://github.com/python/cpython/issues/93101#issue-1244996658

naive kindleBOT
naive kindleBOT
naive kindleBOT
#

Chatting in a Spanish python podcast about how convenient would be for
abstract classes to raise exceptions intermediately instead of at
instantiation time (how could you create an abstract class in that
case?), somebody produced this code:

import abc

class a(abc.ABC):
@classmethod
@property
@abc.abstractmethod
def x(cls):
print("Hello world")

class b(a):
def x(*args):
pass

(NOTHING happens, the abstract method/property is overriden)

class c(a):
pass

"HELLO WORLD" is printed, creating the class (not instanciating an
object of that type but creating the class itself), because the abstract
method/property is not overriden.

Note that the method is called at class creation time.

if you replace the body of "x" method with a "raise NotImplementedError"
you can produce that exception at import time, if some class remains
abstract.

This is an interesting interaction between decorators trying to be
clever supporting ... continue reading

naive kindleBOT
#

What is python-oracledb?

python-oracledb is a Python extension module that enables access to Oracle
Database for Python and conforms to the Python database API 2.0
specifications with a number of enhancements. This release is intended as a
new major version of cx_Oracle (and to eventually replace it).

Where do I get it?

https://pypi.org/project/oracledb/1.0.0/

The easiest method to install/upgrade python-oracledb is via pip as in

python -m pip install oracledb --upgrade

What's new?

The biggest enhancement is the introduction of a "thin" mode that does not
require any Oracle Client libraries! Prebuilt binaries for macOS are now
included (and Windows and Linux binaries are also available).

See the full release notes for all of the details:
https://python-oracledb.readthedocs.io/en/latest/release\_notes.html#releasenotes

Chris Jones also has a blog that provides more details:
https://cjones-oracle.medium.com/open-source-python-thin-driver-for-oracle-... continue reading

naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.23.0rc1. The NumPy 1.23.0 release continues the ongoing work to improve
the handling and promotion of dtypes, increase the execution speed, clarify
the documentation, and expire old deprecations. The highlights are:

  • Implementation of loadtxt in C, greatly improving its performance.
  • Exposing DLPack at the Python level for easy data exchange.
  • Changes to the promotion and comparisons of structured dtypes.
  • Improvements to f2py.

The Python versions supported in this release are 3.8-3.10, 3.11 will be
supported when it comes out. Note that 32 bit wheels are only provided for
Windows, all other wheels are 64 bits on account of Ubuntu, Fedora, and
other Linux distributions dropping 32 bit support. All 64 bit wheels are
also linked with 64 bit OpenBLAS. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.23.0rc1/; source archives, release
notes, an... continue reading

naive kindleBOT
#

Hello,
I can build cPython with PCbuild/build.bat and also in WSL/Debian make works fine but if I try to use the WSL toolchain/build configuration I get g++: fatal error: no input files. Clion is better geared for cmake projects and there is the https://github.com/python-cmake-buildsystem/python-cmake-buildsystem project.

Has anyone made a tutorial/recipe for getting cLion and cpython to play nice?

If I can't get cLion to work directly with cpython, I am curious what other Window's centric people use:  Visual Studio or just the PCbuild.bat script?

Thanks,
DevDave/David

naive kindleBOT
#

ACTIVITY SUMMARY (2022-05-20 - 2022-05-27)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7146 ( +0)
closed 51841 ( +0)
total 58987 ( +0)

Open issues with patches: 2890

Most recent 15 issues with no replies (15)

#47258: Python 3.10 hang at exit in drop_gil() (due to resource warnin
https://bugs.python.org/issue47258

#47256: re: limit the maximum capturing group to 1,073,741,823, reduce
https://bugs.python.org/issue47256

#47253: LOAD_GLOBAL instruction with wrong source position
https://bugs.python.org/issue47253

#47252: socket.makefile documentation is missing data regarding the 'b
https://bugs.python.org/issue47252

#47251: Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE
https://bugs.python.org/issue47251

#47244: email.utils.formataddr does not respect double spaces
https... continue reading

naive kindleBOT
naive kindleBOT
#

Hi all,

I'm delighted to announce the release of Sphinx 5.0.0 final, now available on
the Python package index at https://pypi.org/project/Sphinx/.

It includes many changes including incompatible ones.
Please confirm it working fine on your documents.

In detail, please see CHANGES:
https://github.com/sphinx-doc/sphinx/blob/5.0.x/CHANGES

Thanks to all collaborators and contributors!

What is it?

Sphinx is a tool that makes it easy to create intelligent and beautiful
documentation for Python projects (or other documents consisting of
multiple reStructuredText source files).

Website: http://sphinx-doc.org/

Enjoy!

naive kindleBOT
#

Hi, I'm just getting into the CPython codebase just for fun, and I've
just started messing around with the tokenizer and the grammar. I was
wondering, is there a way to just print out the results of the tokenizer
(as in just the stream of tokens it generates) in a human readable
format? It would be really helpful for debugging. Hope the question's
not too basic.

Cheers.

naive kindleBOT
#

The desire for this came up for me in relation to a set of dataclasses used to define a tree structure where each item has a reference to its parent. Including the complete expansion of the parent (with its children and its parent with its children, etc.) is WAY too much information, but at the same time, I do want to at least identify the parent. Currently, the only way to get what I'm looking for is to write a custom __repr__ from scratch.

It would be great if there was at least 1 way to take advantage of the automatic repr and still customize its handling for specific fields.

The first thing I thought of in that regard for my example was to add a parent_name property using @property and specify repr=False for parent. The auto-generated repr is not aware of properties defined that way though. Maybe that could be solved by adding an argument named something like descriptor=<True|False>tofield()where aTrue` value means that getting and setting happens through a sep... continue reading

naive kindleBOT
naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.23.0rc2. The NumPy 1.23.0 release continues the ongoing work to improve
the handling and promotion of dtypes, increase the execution speed, clarify
the documentation, and expire old deprecations. The highlights are:

  • Implementation of loadtxt in C, greatly improving its performance.
  • Exposing DLPack at the Python level for easy data exchange.
  • Changes to the promotion and comparisons of structured dtypes.
  • Improvements to f2py.

The Python versions supported in this release are 3.8-3.10, 3.11 will be
supported when it comes out. Note that 32 bit wheels are only provided for
Windows, all other wheels are 64 bits on account of Ubuntu, Fedora, and
other Linux distributions dropping 32 bit support. All 64 bit wheels are
also linked with 64 bit OpenBLAS. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.23.0rc2/; source archives, release
notes, an... continue reading

naive kindleBOT
#

Does anyone want bug fixes? Because we have 164 new commits fixing
different things, from code to documentation. If you have reported some
issue after 3.11.0b1, you should check if is fixed and if not, make sure
you tell us so we can take a look. We still have two more betas to go so
help us to make sure we don't miss anything so everything is ready for the
final release!!

https://www.python.org/downloads/release/python-3110b2/

This is a beta preview of Python 3.11

Python 3.11 is still in development. 3.11.0b2 is the second of four planned
beta release previews. 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.11 during the beta phase and report issues found to the
Python bug tracker
as soon as
possible. While the rele... continue reading

naive kindleBOT
#

Does anyone want bug fixes? Because we have 164 new commits fixing
different things, from code to documentation. If you have reported some
issue after 3.11.0b1, you should check if is fixed and if not, make sure
you tell us so we can take a look. We still have two more betas to go so
help us to make sure we don't miss anything so everything is ready for the
final release!!

https://www.python.org/downloads/release/python-3110b2/

This is a beta preview of Python 3.11

Python 3.11 is still in development. 3.11.0b2 is the second of four planned
beta release previews. 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.11 during the beta phase and report issues found to the
Python bug tracker
as soon as
possib... continue reading

naive kindleBOT
#

Hi everyone,

Due to a known incompatibility with pytest and the previous beta release
(Python 3.11.0b2) and after
some deliberation, me and the rest of the release team have decided to do
an expedited release of
Python 3.11.0b3 so the community can continue testing their packages with
pytest and therefore
testing the betas as expected.

Where can I get the new release?

https://www.python.org/downloads/release/python-3110b3/

What happened?

Pytest by default rewrites the AST nodes in the testing code to provide
better diagnostics when something
fails in the test. For doing this, it creates new AST nodes that are then
compiled. In Python 3.11, after some
changes in the compiler and AST nodes, these new AST nodes that pytest was
creating were invalid. This causes
CPython to crash in debug mode because we have several assert statements in
the compiler, but in release mode
this doesn't cause always a crash, but it creates potential corrupted
structures in the compiler silently.

In 3... continue reading

naive kindleBOT
#

Hi everyone,

Due to a known incompatibility with pytest and the previous beta release
(Python 3.11.0b2) and after
some deliberation, me and the rest of the release team have decided to do
an expedited release of
Python 3.11.0b3 so the community can continue testing their packages with
pytest and therefore
testing the betas as expected.

Where can I get the new release?

https://www.python.org/downloads/release/python-3110b3/

What happened?

Pytest by default rewrites the AST nodes in the testing code to provide
better diagnostics when something
fails in the test. For doing this, it creates new AST nodes that are then
compiled. In Python 3.11, after some
changes in the compiler and AST nodes, these new AST nodes that pytest was
creating were invalid. This causes
CPython to crash in debug mode because we have several assert statements in
the compiler, but in release mode
this doesn't cause always a crash, but it creates potential corrupted
structures in the... continue reading

naive kindleBOT
#

More than once, I've had bugs that were hard to track down because I was accidentally using an implicit namespace without realizing it.

The last time this happened, it was a typo, and my init file was named _init__.py instead of __init__.py. The init file imported from sub-modules, including 1 with a class that was supposed be be registered via an __init_subclass__ callback that was not happening.

I'm sure that implicit namespace packages are here to stay, and I imagine I will actually want to use them on purpose at some point, but it would be nice if we could come up with a straightforward way to avoid the accidental usages.

One idea that comes to mind is to add a new built-in context manager within which the importing of a purely implicit namespace raises an exception.

naive kindleBOT
#

Leo http://leoeditor.com 6.6.2 is now available on GitHub
https://github.com/leo-editor/leo-editor/releases and pypi
https://pypi.org/project/leo/.

Leo is an IDE, outliner and PIM http://leoeditor.com/preface.html.

The highlights of Leo 6.6.2

  • Add "File Only" option in Leo's Find Pane.
  • Remove pylint-leo.py, pyflakes-leo.py and related code.
  • Add mypy annotations for Leo's most important files.
  • Fixed 9 minor bugs.

6.6.2 Links

naive kindleBOT
#

unicode is a simple python command line utility that displays
properties for a given unicode character, or searches
unicode database for a given name.

It was written with Linux in mind, but should work almost everywhere
(including MS Windows and MacOSX), UTF-8 console is recommended.

˙pɹɐpuɐʇs əpoɔı̣uՈ əɥʇ ɟo əsn pəɔuɐʌpɐ
puɐ səldı̣ɔuı̣ɹd əɥʇ ɓuı̣ʇɐɹʇsuoɯəp looʇ ɔı̣ʇɔɐpı̣p ʇuəlləɔxə uɐ sı̣ ʇI
˙sʇuı̣odəpoɔ ʇuəɹəɟɟı̣p ʎləʇəldɯoɔ ɓuı̣sn əlı̣ɥʍ 'sɥdʎlɓ ɟo ɯɐəɹʇs ɹɐlı̣ɯı̣s
ʎllɐnsı̣ʌ oʇuı̣ ʇxəʇ əɥʇ ʇɹəʌuoɔ oʇ pɹɐpuɐʇs əpoɔı̣uՈ əɥʇ ɟo ɹəʍod llnɟ
əɥʇ sʇı̣oldxə ʇɐɥʇ 'ʎʇı̣lı̣ʇn ,əpoɔɐɹɐd, oslɐ suı̣ɐʇuoɔ əɓɐʞɔɐd əɥ⊥

Changes since previous versions:

  • better handling of changes in data files

URL: http://kassiopeia.juls.savba.sk/~garabik/software/unicode.html

License: GPL v3

Installation: pip install unicode

--

| Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__ garabik @ kassiopeia.juls.sa... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-05-27 - 2022-06-03)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7146 ( +0)
closed 51841 ( +0)
total 58987 ( +0)

Open issues with patches: 2890

Most recent 15 issues with no replies (15)

#47258: Python 3.10 hang at exit in drop_gil() (due to resource warnin
https://bugs.python.org/issue47258

#47256: re: limit the maximum capturing group to 1,073,741,823, reduce
https://bugs.python.org/issue47256

#47253: LOAD_GLOBAL instruction with wrong source position
https://bugs.python.org/issue47253

#47252: socket.makefile documentation is missing data regarding the 'b
https://bugs.python.org/issue47252

#47251: Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE
https://bugs.python.org/issue47251

#47244: email.utils.formataddr does not respect double spaces
https... continue reading

naive kindleBOT
#

A contrived use case:

with open('document.txt', 'r') as io:
    (line1, line2, *) = io

It is possible to kind of achieve the same result using *_ except that would actually read all the lines from the file, even if we only want the first 2.

…so I am suggesting that we use the bare * here to mean that we don't care whether there are additional items in the sequence, _and_ we want to stop iterating.

naive kindleBOT
#

I’d like to propose a simple addition to the 'fnmatch' module. Specificity a function that returns a list of names that match a pattern AND a list of those that don't.

In a recent project I found that I wished to split a list of files and move those that matched a pattern to one folder and those that didn't to another folder. I was using fnmatch.filter to select the first set of files and then a list comprehension to generate the second set.

For a small number of files (~ 10) this was perfectly adequate. However as I needed to process many files (>>10000) the execution time was very significant. Profiling the code showed that the time was spent in generating the second set. I tried a number of solutions including designing a negative filter, walking the file system to find those files that had not been moved and using more and more convoluted ways to improve the second selection. Eventually I gave in and hacked a local copy of fnmatch.py as below:

def split(names, pat):
"""Retu... continue reading

naive kindleBOT
#

I think these are an extremely common needs that are worth having standard methods for. If adding instance methods seems like a bad idea, then maybe add functions to the standard library that perform the same operations.

m = {'a': 123, 'b': 456, 'c': 789}
m.except(('a', 'c')) # {'b': 456}
m.only(('b', 'c')) # {'b': 456, 'c': 789}
m.values_at(('a', 'b')) # [123, 456]

…or…

from mappings import except, only, values_at

m = {'a': 123, 'b': 456, 'c': 789}
except(m, ('a', 'c')) # {'b': 456}
only(m, ('b', 'c')) # {'b': 456, 'c': 789}
values_at(m, ('a', 'b')) # [123, 456]

naive kindleBOT
#

Hi,

On buildbots, it's common that we get at least one multiprocessing
test failure per week. While I just reported a new one, I wanted to
add a "expert-multiprocessing" label, but it didn't exist. I just
created the label :-)

https://github.com/python/cpython/labels/expert-multiprocessing

I added the label manually to 240 issues! Oh, they are many open
issues about multiprocessing and concurrent.futures modules.
Documentation issues, feature requests, but also a long list of real
bugs ("hang" is a common term in these reports).

Handling multiple processes is hard to get it right, especially when
supporting multiple operating systems matter. In Python 3.8,
multiprocessing got shared memory support which opened another can of
worms :-)

Sadly, current multiprocessing maintainers are no longer available and
the number of open issues and open pull requests is increasing.

I'm not an expert in multiprocessing, but I'm volunteer to mentor
someone who is expert and is interested to go... continue reading

naive kindleBOT
#

Hi there

I hope you don't mind me sharing my experience with testing the
austinp variant of Austin with Python >=2.7,<3.11.

The austinp variant is a variant of Austin
(https://github.com/P403n1x87/austin) for Linux that uses ptrace to
seize and interrupt/continue threads to capture native stack traces
using libunwind. During testing, I have discovered that there are good
chances of causing what looks like a deadlock in Python if the seizing
and interrupting of threads happen very early when spawning a Python
subprocess from austinp. This seems to coincide with the
initialisation of the interpreter when modules are being loaded. To
avoid interfering so destructively with Python, I have added a sleep
of about 0.5s on fork to prevent sampling during this initialisation
phase, which has helped significantly.

However, I think this poses one question: is this behaviour from
Python to be expected or is it perhaps an indication of a potential
bug? Whilst I find it conceivable that something... continue reading

naive kindleBOT
#

The latest bugfix drop for Python 3.10 is here: Python 3.10.5. This release
packs more than 230 bugfixes and docs changes, so you surely want to update
:) You can get it here:

https://www.python.org/downloads/release/python-3105/

This is the fourth maintenance release of Python 3.10

Python 3.10.5 is the newest major release of the Python programming
language, and it contains many new features and optimizations.

Major new features of the 3.10 series, compared to 3.9

Among the new major new features and changes so far:

naive kindleBOT
#

The latest bugfix drop for Python 3.10 is here: Python 3.10.5. This release
packs more than 230 bugfixes and docs changes, so you surely want to update
:) You can get it here:

https://www.python.org/downloads/release/python-3105/

This is the fourth maintenance release of Python 3.10

Python 3.10.5 is the newest major release of the Python programming
language, and it contains many new features and optimizations.

Major new features of the 3.10 series, compared to 3.9

Among the new major new features and changes so far:

  • PEP 623 -- Deprecate and
    prepare for the removal of the wstr member in PyUnicodeObject.
  • PEP 604 -- Allow writing
    union types as X | Y
  • PEP 612 -- Parameter
    Specification Variables
  • PEP 626 -- Precise line
    numbers for debugging and other tools.
  • [PEP 618 ]... continue reading
naive kindleBOT
naive kindleBOT
#

Hi,

regarding this issue93122, I am wondering what is the normal behavior of asyncio.gather when one of the submitted tasks raises a KeyboardInterrupt exception ? -- regardless of the value of the return_exception parameter.
It seems that this primitive does not behave the same way with KeyboardInterrupt and ZeroDivisionError exceptions. But may be it is normal ?
I have searched in the documentation here but I did not find anything.
Thanks for your help.

Yves

naive kindleBOT
#

During some sophisticated pickling I noticed that method __func__
objects are unpicklable, because they share the name with the bound
method object itself.

from pickle import dumps

class A:
     @classmethod
     def b(cls):
         pass

print(A.b) # <bound method A.b of <class '__main__.A'>>
print(A.b.__func__) # <function A.b at 0x7f5574570bf8>

dumps(A.b) # works
dumps(A.b.__func__) # breaks
# >Traceback (most recent call last):
# >  File "<stdin>", line 1, in <module>
# >_pickle.PicklingError: Can't pickle <function A.b at 0x7fd1d50d8bf8>: 
# >it's not the same object as __main__.A.b

The last call compains that global symbol "A.b" is not the same object
as A.b.__func__.

Everything would work if the __func__ objects had the suffix
".__func__" in their qualname.

Actually setting the qualname of the __func__ object makes it
picklable, but then the bound method object is unpicklable, as it
inherits the name from the __func__. It would be good if t... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-06-03 - 2022-06-10)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7146 ( +0)
closed 51841 ( +0)
total 58987 ( +0)

Open issues with patches: 2890

Most recent 15 issues with no replies (15)

#47258: Python 3.10 hang at exit in drop_gil() (due to resource warnin
https://bugs.python.org/issue47258

#47256: re: limit the maximum capturing group to 1,073,741,823, reduce
https://bugs.python.org/issue47256

#47253: LOAD_GLOBAL instruction with wrong source position
https://bugs.python.org/issue47253

#47252: socket.makefile documentation is missing data regarding the 'b
https://bugs.python.org/issue47252

#47251: Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE
https://bugs.python.org/issue47251

#47244: email.utils.formataddr does not respect double spaces
https... continue reading

naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.23.0rc2. The NumPy 1.23.0 release continues the ongoing work to improve
the handling and promotion of dtypes, increase the execution speed, clarify
the documentation, and expire old deprecations. The highlights are:

  • Implementation of loadtxt in C, greatly improving its performance.
  • Exposing DLPack at the Python level for easy data exchange.
  • Changes to the promotion and comparisons of structured dtypes.
  • Improvements to f2py.

The Python versions supported in this release are 3.8-3.10, 3.11 will be
supported when it comes out. Note that 32 bit wheels are only provided for
Windows, all other wheels are 64 bits on account of Ubuntu, Fedora, and
other Linux distributions dropping 32 bit support. All 64 bit wheels are
also linked with 64 bit OpenBLAS. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.23.0rc3/; source archives, release
notes, an... continue reading

naive kindleBOT
#

Hello all,

I am trying the TaskGroup class in the python 3.11 beta version. And I like it a lot. It makes asynchronous programming intuitive enough even for the less experienced like myself. I can see myself teaching this to my colleges when they run linux parallel subprocesses. I will try to convince our IT department to download 3.11 when it’s officially out mostly because of new improved asyncio support. The speed gain will be another good justification.

However, excuse my ignorance, I have a question...

Why can’t I use TaskGroup.create_task method (or asyncio.create_task function) with a Future object (eg. output of loop.run_in_executor function) since it’s an awaitable (i.e., I can do “await future”)? In other words, why can’t create_task accept all awaitable objects?

I can wrap the loop.run_in_executor in an async function and call that function inside create_task with no issues.

It would be nice to do the following:

async def func(num: int) -> int:
await asy... continue reading

naive kindleBOT
#

What is python-oracledb?

python-oracledb is a Python extension module that enables access to Oracle
Database for Python and conforms to the Python database API 2.0
specifications with a number of enhancements. This module is intended to
eventually replace cx_Oracle.

Where do I get it?

https://pypi.org/project/oracledb/1.0.1/

The easiest method to install/upgrade python-oracledb is via pip as in

python -m pip install oracledb --upgrade

What's new?

This release addresses a number of issues reported after the release of
1.0.0.

See the full release notes for all of the details:
https://python-oracledb.readthedocs.io/en/latest/release\_notes.html#oracledb-1-0-1-june-2022

Please provide any feedback via GitHub issues: https://github.com/oracle/
python-oracledb/issues or discussions: https://github.com/oracle/python-
oracledb/discussions

naive kindleBOT
#

Hi everyone,

Today we are supposed to release Python3.11.0b4 but unfortunately, we have
a bunch of release blockers:

https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+label%3Arelease-blocker+label%3A3.11+

Please, if you are involved in the above issues check if they are resolved
or if they are not released blockers. If they are
not release blockers or you think we should defer them, please comment on
why on the issue. Also, please, notice that
the final decision to defer or not a blocker is made by the release
management team.

If you have some time to investigate, that will help a lot!

Please, add me as a reviewer to any PR that needs to be merged to address
these issues.

Thanks for your help!

Regards from sunny London,
Pablo Galindo Salgado

naive kindleBOT
#

For this code:

class C:
def f(self, x):
match x:
case D(__something=y):
return y

It appears that the name "__something" isn't mangled. Under most other circumstances I'd expect this to be mangled to "_C__something". Is this:

  • intentional,
  • accidental, but how that it's done it's the defined behaviour,
  • or a defect?

It doesn't seem like it's explicitly tested for in test_patma.py either way.

Thanks
David

naive kindleBOT
#

Hi all,

CodraFT is a new open-source generic signal and image processing software, based on Python, Qt, NumPy, SciPy and others:
https://codra-ingenierie-informatique.github.io/CodraFT/

I am pleased to announce that CodraFT v2.0.2 has been released.
This is the first public release of version 2, compatible with Python 3.7+.

CodraFT provides signal/image processing and visualisation features, and is available either as a stand-alone application or may be embedded in your own Python-Qt application thanks to advanced automation capabilities. CodraFT also has many I/O features, supporting a lot of images format as well as HDF5 (for saving/loading CodraFT workspace or importing any other data file).

Enjoy!

--
Always a pleasure to share with Python community, since 2008.
Pierre Raybaut

naive kindleBOT
#

friendly_idle is a modified version of IDLE that incorporates friendly/friendly-traceback to give more helpful tracebacks. You can see some screenshot in a recent blog post: https://aroberge.blogspot.com/2022/06/friendly-idle.html

Since that blog post was written, the only remaining issue that was mentioned has been solved.

You can install it using "python -m pip install friendly_idle". Then launch it from a terminal using "friendly_idle". If you are not familiar with friendly/friendly-traceback, you might want to consult https://friendly-traceback.github.io/docs/index.html.

friendly_idle's version is currently listed as "0.3.2" - however, it already does everything I had planned for and could have called it "version 1.0".

friendly_idle assumes that IDLE is already installed and "monkeypatches" it as it launches.
It requires a version of IDLE that support excepthook():
Python 3.8.10 or greater
Python 3.9.5 or greater
Python 3.10.x

It has not been tested with Python 3.11 as ... continue reading

naive kindleBOT
#

Restarting this with an improved title "Bare" vs "Raw", and I will try not to digress so much in the new thread.

My suggestion is to allow a bare asterisk at the end of a desctructuring expression to indicate that additional elements are to be ignored if present and not iterated over if the rhs is being evaluated by iterating.

(first, second, *) = items

This provides a way of using destructuring from something that will be processed by iterating and for which the number of items might be very large and/or accessing of successive items is expensive.

As Paul Moore pointed out in the original thread, itertools.islice can be used to limit the number of items iterated over. That's a nice solution, but it required knowing or thinking of the solution, an additional import, and repetition of the count of items to be destrucured at the outermost nesting level on the lhs.

What are people's impressions of this idea. Is it valuable enough to pursue writing a PEP?

If so, then what should ... continue reading

naive kindleBOT
#

Look at the following example:

def some_function(f1: int):
    assert isinstance(f1, int)

def other_function(f0: str, **kwargs):
    assert isinstance(f0, str)
    some_function(**kwargs)

other_function(f0='a', f1='b')

I would expect a static type checker to warn that f1='b' is wrong because the type should be int. There shouldn't be a need to add a type to **kwargs since what is accepted can be deduced from how it is used. Note that some_function could be defined in another module and be used in multiple places, thus the "don't repeat yourself" and "separation of concerns" principles apply. Better to have the type for f1 be only in the definition of some_function and not in the **kwargs.

I created a github issue in pyright (https://github.com/microsoft/pyright/issues/3583) and the response was that PEP 484 forbids this. I have seen that there are discussions about TypedDict for more precise typing of **kwargs. However, requiring to use TypedDict for the cases in which i... continue reading

naive kindleBOT
#

Hello,

it's with great pleasure that I announce the release of
django-compat-patcher v0.11

This release extends compatibility fixers so that you can painlessly
upgrade your project to Django 4.0, without breaking your existing
pluggable-apps ecosystem.

--

DCP is a companion package which adds backwards/forwards compatibility
patches to Django, so that your dependencies don't get broken by trivial
changes made to the core of the framework.

It injects compatibility shims like function/attribute aliases, restores
data structures which were replaced by stdlib ones, extends the
behaviour of callables (eg. referring to a view by object, by name, or
by dotted path), and can even preserve deprecated modules as “import
aliases”.

This allows to you upgrade your dependencies one at a time, to
fork/patch them when you have a proper opportunity, and most importantly
to not get stuck, when deadlines are tight.

Technically, DCP manages a set of “fixers”,... continue reading

naive kindleBOT
#

ACTIVITY SUMMARY (2022-06-10 - 2022-06-17)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
open 7146 ( +0)
closed 51841 ( +0)
total 58987 ( +0)

Open issues with patches: 2890

Most recent 15 issues with no replies (15)

#47258: Python 3.10 hang at exit in drop_gil() (due to resource warnin
https://bugs.python.org/issue47258

#47256: re: limit the maximum capturing group to 1,073,741,823, reduce
https://bugs.python.org/issue47256

#47253: LOAD_GLOBAL instruction with wrong source position
https://bugs.python.org/issue47253

#47252: socket.makefile documentation is missing data regarding the 'b
https://bugs.python.org/issue47252

#47251: Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE
https://bugs.python.org/issue47251

#47244: email.utils.formataddr does not respect double spaces
https... continue reading

naive kindleBOT
#

Hi everyone,

Today was the 3rd time I came across a situation where it was needed to
retrieve all the positions of the line endings (or beginnings) in a very
long python string as efficiently as possible. First time, it was needed in
prompt_toolkit, where I spent a crazy amount of time looking for the most
performant solution. Second time was in a commercial project where
performance was very critical too. Third time is for the Rich/Textual
project from Will McGugan. (See:
https://twitter.com/willmcgugan/status/1537782771137011715 )

The problem is that the str type doesn't expose any API to efficiently
find all \n positions. Every Python implementation is either calling
.index() in a loop and collecting the results or running a regex over the
string and collecting all positions.

For long strings, depending on the implementation, this results in a lot of
overhead due to either:

  • calling Python functions (or any other Python instruction) for every \n
    character in the input. The ... continue reading
naive kindleBOT
#

Since "today" depends on the time zone, it should be an optional argument
to date.today(). The interface should be the same as datetime.now(tz=None),
with date.today() returning the date in the system time zone.

Rationale: It is common for processes to run in different timezones than
the relevant end user. The most common case is probably a server running in
UTC, which needs to do date calculations in timezones elsewhere. As a
contrived example, you might do something like:

tomorrow = date.today() + timedelta(days=1)
return render\_template(..., ship\_by\_date=tomorrow)

But then if fulfillment is operating e.g. in US/Pacific time, the ship by
date suddenly shows two days hence after 5 or 6pm when UTC midnight happens.

In my particular use case, we get some collection of business rules about
when a particular record is considered "stale" or prioritized, and naively
using date.today() can lead to off-by-one errors.

The way to "fix" the code above is to reference "now":

... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/OJI3GBPNNGVZL22EAD723TYIFNF6OWAH/)
naive kindleBOT
#

I've been working on a bug in django where if you configure a logging.handlers.SocketHandler in the django logging config, it gets a TypeError because it tries to log a HttpRequest object, which can't be pickled. I'm slowly coming to the conclusion that this isn't a django bug, and the right fix is to make SocketHandler (and DatagramHandler) be able to deal with this internally.

QueueHandler already does this, or at least the documentation says it does:

prepare(record) ... removes unpickleable items from the record in-place.

It seems like SocketHandler should do the same thing. Thoughts?

naive kindleBOT
#

Wing 8.3.2 fixes several code intelligence issues for f-string
expressions, avoids problems when using ~ or a non-default Base
Directory with remote hosts, allows running a pytest parameterized test
with a float value, adds the option Use Fixed Width Font for Output to
the Testing tool's right-click context menu, scrolls correctly to the
current line in version control blame/praise output, fixes intermittent
PyQt & PySide autocompletion problems, and makes a number of other
usability improvements.

Details: https://wingware.com/news/2022-06-17
Downloads: https://wingware.com/downloads

== About Wing ==

Wing is a full-featured but light-weight Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing's deep code analysis provides
auto-completion, auto-editing, code navigation, early error detection,
and refactoring that speed up development. Its top notch debugger works
with any Python c... continue reading

naive kindleBOT
#

Here is a very rough draft of an idea I've floated often, but not with much
specification. Take this as "ideas" with little firm commitment to details
from me. PRs, or issues, or whatever, can go to
https://github.com/DavidMertz/peps/blob/master/pep-9999.rst as well as
mentioning them in this thread.

PEP: 9999
Title: Generalized deferred computation
Author: David Mertz dmertz@gnosis.cx
Discussions-To:
https://mail.python.org/archives/list/python-ideas@python.org/thread/
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 21-Jun-2022
Python-Version: 3.12
Post-History:

Abstract

This PEP proposes introducing the soft keyword later to express the
concept
of deferred computation. When an expression is preceded by the keyword, the
expression is not evaluated but rather creates a "thunk" or "deferred
object."
Reference to the deferred object later in program flow causes the
expression to
be executed at that point, and for both the value and type of the ob... continue reading

naive kindleBOT
#

Yesterday, PyCA cryptography 37.0.3 was released to PyPI. Today, we
yanked the release from PyPI due to a regression in OpenSSL that was
producing heap corruption for users.

cryptography includes both high level recipes and low level interfaces
to common cryptographic algorithms such as symmetric ciphers,
asymmetric algorithms, message digests, X509, key derivation
functions, and much more. We support Python 3.6+, and PyPy3.

Changelog (https://cryptography.io/en/latest/changelog/#v37-0-3)

  • Updated Windows, macOS, and Linux wheels to be compiled with OpenSSL 3.0.4.

Alex

All that is necessary for evil to succeed is for good people to do nothing.

naive kindleBOT
#

This is based on previous discussions of possible ways of matching all remaining items during destructuring but without iterating of remaining final items. This is not exactly a direct replacement for that idea though, and skipping iteration of final items might or might not be part of the goal.

In this proposal, the ellipsis (...) can be used in the expression on the left side of the equals sign in destructuring anywhere that *<varname> can appear and has approximately the same meaning. The difference is that when the ellipsis is used, the matched items are not stored in variables. This can be useful when the matched data might be very large.

..., last_one = <expression>
a, ..., z = <expression>
first_one, ... = <expression>

Additionally, when the ellipsis comes last and the data is being retrieved by iterating, stop retrieving items since that might be expensive and we know that we will not use them.

Alternative A:

Still iterate over items when the ellipsis comes last (for ... continue reading

naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.23.0. The NumPy 1.23.0 release continues the ongoing work to improve the
handling and promotion of dtypes, increase the execution speed, clarify the
documentation, and expire old deprecations. The highlights are:

  • Implementation of loadtxt in C, greatly improving its performance.
  • Exposing DLPack at the Python level for easy data exchange.
  • Changes to the promotion and comparisons of structured dtypes.
  • Improvements to f2py.

The Python versions supported in this release are 3.8-3.10, 3.11 will be
supported when it comes out. Note that 32 bit wheels are only provided for
Windows, all other wheels are 64 bits on account of Ubuntu, Fedora, and
other Linux distributions dropping 32 bit support. All 64 bit wheels are
also linked with 64 bit OpenBLAS. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.23.0/; source archives, release notes,
and whee... continue reading

naive kindleBOT
#

Hi everyone,

A small update since the last communication from the release team regarding
the status of Python 3.11.0b4.

Unfortunately, even if we have fixed most of the original release blockers
and 4 more that appear during this week, we still have a bunch of release
blockers to deal with. One of them has been reported today.

I would like to release the next beta next week if everything looks good,
but there are also some items that need discussion:.

https://github.com/python/cpython/issues/93910

https://github.com/python/cpython/issues/93516

Ideally we should reach consensus as a team on how to proceed in these
issues. In particular, we should decide collectively what is an acceptable
slowdown, specially looking to the release candidate.

If releasing the next betas is further delayed, I will consider delaying
the full release schedule to accommodate for the delay so users have the
appropriate time to test and validate every release.

Please do not hesitate in reaching out if y... continue reading

naive kindleBOT
#

I was reading some of Kevlin Henney's views on naming conventions
https://kevlinhenney.medium.com/exceptional-naming-6e3c8f5bffac, and I
realized that, of the 65 classes that make up Python's built-in exceptions
https://docs.python.org/3/library/exceptions.html#exception-hierarchy,
only 8 (by my count) satisfy Henney's pretty basic concept of a good
Exception name:

The name should represent whatever the problem is, and should do so
directly and specifically. To add Exception to the end is either redundant
— so remove it — or an indication of a poor name — so rename it.

Those are:
SystemExit, KeyboardInterrupt, GeneratorExit, Exception, StopIteration, StopAsyncIteration,
Warning, and BaseException (though Henney also discourages the use of
"Base" in a base-class's name)

I'm sure there are others throughout the standard library too.

I always caution novice programmers to err on the side of pragmatism over
dogmatic adherence to "sacred truths". To that end:

  1. I reali... continue reading
naive kindleBOT
#

Hi everyone,

Please find here another maintenance release of NumExpr. Support for Python
3.6
has been dropped to enable support for NumPy 1.23 (and by extension Python
3.11
when it is released). Wheels for ARM64 multilinux should be available again
after
troubles with GitHub Actions and Apple Silicon wheels are also now
available on
PyPi for download.

Project documentation is available at:

http://numexpr.readthedocs.io/

Changes from 2.8.1 to 2.8.2

  • Support for Python 3.6 has been dropped due to the need to substitute the
    flag
    NPY_ARRAY_WRITEBACKIFCOPY for NPY_ARRAY_UPDATEIFCOPY. This flag
    change was
    initiated in NumPy 1.14 and finalized in 1.23. The only changes were made
    to
    cases where an unaligned constant was passed in with a pre-allocated
    output
    variable:
    x = np.empty(5, dtype=np.uint8)[1:].view(np.int32)
    ne.evaluate('3', out=x)

We think the risk of issues is very low, but if you a... continue reading

naive kindleBOT
#

Dear pythoneers,

I'm pleased to announce version 3.0 of RSFile I/O Library, which adds
support for python 3.8, 3.9, and 3.10, drops support for Python<=3.5,
and strengthens testing on OSX.

RSFile provides cross-platform drop-in replacements for the classes of
the io module, and for the open() builtin.

Its goal is to provide a cross-platform, reliable, and comprehensive
synchronous file I/O API, with advanced features like fine-grained
opening modes, shared/exclusive file record locking, thread-safety, disk
cache synchronization, file descriptor inheritability, and handy stat
getters (size, inode, times…).

Locking is performed using actual file record locking capabilities of
the OS, not by using separate files/directories as locking markers, or
other fragile gimmicks. Unix users might particularly be interested by
the workaround that this library provides, concerning the weird semantic
of fcntl() locks (when any descriptor to a disk file is closed, the
process loses ALL ... continue reading

naive kindleBOT
#

PyConZA 2022 will take place on the 13th & 14th of October, 2022. This
year, PyConZA will be a hybrid conference (with in-person and online
access) hosted at the Premier Splendid Inn in Umhlanga, Durban.

We are looking for the following presentations:

  • Keynotes (45 minute long talks on a subject of general interest)
  • Talks (30 minute long talks on more specific topics)

We are accepting submissions for tutorials, which will run on the 12th
of October. Tutorials can either be half-day (4 hours) or full-day (8
hours).

Currently, we are only accepting talks to be delivered in person at the venue.

If you would like to give a presentation, please register at
https://za.pycon.org/ and submit your proposal, following the
instructions at https://za.pycon.org/talks/submit-talk/ . We have a
number of tracks available, including: Data Science, Teaching and
Learning with Python, Web, Scientific Computing, Testing and Other
(which includes all talks that don't fall under the mentioned trac... continue reading

naive kindleBOT
#

Hi

Currently we can upload signed packages on pypi.

Shouldn't pip have a keyring of thrusted projects or developers and enforce
whitelisting of untrusted packages, either through a requirement flag or
through an interactive question in CLI?

I think this would help with user security if we want to keep pypi open for
upload to all on the long term.

Thanks for your feedback

naive kindleBOT
#

I am pleased to announce the release of SfePy 2022.2.

Description

SfePy (simple finite elements in Python) is a software for solving systems of
coupled partial differential equations by finite element methods. It is
distributed under the new BSD license.

Home page: https://sfepy.org
Mailing list: https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
Git (source) repository, issue tracker: https://github.com/sfepy/sfepy

Highlights of this release

  • custom testing code replaced by pytest
  • improved pyvista-based visualization script

For full release notes see [1].

Cheers,
Robert Cimrman

[1] http://docs.sfepy.org/doc/release\_notes.html#id1


Contributors to this release in alphabetical order:

Robert Cimrman
Jan Heczko
Vladimir Lukes

naive kindleBOT
#

(I apologize in advance if I've posted anything incorrectly before, I believe I might have sent this in python-dev instead but not sure as it's not appearing in the posts for my account).

I am aware this is clarified in the Python documentation for the typing module but I and others have thought the naming of Optional is still quite confusing by itself.

"Note that this is not the same concept as an optional argument, which is one that has a default. An optional argument with a default does not require the Optional qualifier on its type annotation just because it is optional." - typing.Optional docs

Google defines optional as this, "available to be chosen but not obligatory."

Pretend we have a function like this:
def test_func(param: Optional[str]) -> None:
...

The argument param is typed as Optional[str] meaning Union[str, None] or str | None. Optional here if we follow the definition above, basically means it can be str but not required or obligated to be that type. See th... continue reading

naive kindleBOT
#

I am aware this is clarified in the Python documentation for the typing module but I and others have thought the naming of Optional is still quite confusing by itself.

"Note that this is not the same concept as an optional argument, which is one that has a default. An optional argument with a default does not require the Optional qualifier on its type annotation just because it is optional." - typing.Optional docs

Google defines optional as this, "available to be chosen but not obligatory."

Pretend we have a function like this:
def test_func(param: Optional[str]) -> None:
...

The argument param is typed as Optional[str] meaning Union[str, None] or str | None. Optional here if we follow the definition above, basically means it can be str but not required or obligated to be that type. See the problem with the naming? This is a function where param can be None or str, not just it can be str but not obligated. Some interpretations may think optional means left to one's choice as... continue reading

naive kindleBOT
#

Vulture - Find dead code

Vulture finds unused code in Python programs. This is useful for
cleaning up and finding errors in large code bases. If you run Vulture
on both your library and test suite you can find untested code.

Due to Python's dynamic nature, static code analyzers like Vulture are
likely to miss some dead code. Also, code that is only called
implicitly may be reported as unused. Nonetheless, Vulture can be a
very helpful tool for higher code quality.

Download

https://github.com/jendrikseipp/vulture
http://pypi.python.org/pypi/vulture

Features

  • fast: uses static code analysis
  • tested: tests itself and has complete test coverage
  • complements pyflakes and has the same output syntax
  • sorts unused classes and functions by size with --sort-by-size
  • supports Python 3.6+

News

  • Mark imports in __all__ as used (kreathon, #172, #282).
  • Add whitelist for pint.UnitRegistry.default_formatter (Ben Elliston,
    #258).

... continue reading

naive kindleBOT
#

Hi everyone,

TLDR

We may be pushing the final release until December if the stability of
Python 3.11 doesn't improve.

Long Explanation

Unfortunately, we cannot still release the next Python 3.11 beta release
(3.11.0b4) because we still have a bunch
of pending release blockers. Unfortunately, this is still after several
preexisting release blockers have been fixed,
some of them being discovered after I sent my last update. These are the
current release blockers:

https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Arelease-blocker+label%3A3.11+

We also have some deferred blockers (some of them should actually be
release blockers):

https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Adeferred-blocker+label%3A3.11

Due to this and the fact that we are already 3 weeks delayed in the release
schedule, the current stability of Python 3.11 is not as good
as it is supposed to be at this stage of the release... continue reading

naive kindleBOT
#

Hi all,

I am the current maintainer of bytecode
(https://github.com/MatthieuDartiailh/bytecode) which is a library to
perform assembly and disassembly of Python bytecode. The library was
created by V. Stinner.

I started looking in Python 3.11 support in bytecode, I read
Objects/exception_handling_notes.txt and I have a couple of questions
regarding the exception table:

Currently bytecode exposes three level of abstractions:
  - the concrete level in which one deals with instruction offset for
jumps and explicit indexing into the known constants and names
  - the bytecode level which uses labels for jumps and allow non
integer argument to instructions
  - the cfg level which provides basic blocks delineation over the
bytecode level

So my first idea was to directly expose the unpacked exception table
(start, stop, target, stack_depth, last_i) at the concrete level and use
pseudo-instruction and labels at the bytecode level. At this point of my
reflections, I saw
ht... continue reading

naive kindleBOT
#

PyCA cryptography 37.0.4 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.

Changelog (https://cryptography.io/en/latest/changelog/#v37-0-4):

  • Updated Windows, macOS, and Linux wheels to be compiled with OpenSSL 3.0.5.

Alex

--
All that is necessary for evil to succeed is for good people to do nothing.

naive kindleBOT
#

Diátaxis Documentation Workshop

The Python documentation community
https://github.com/python/docs-community will be hosting a free two-part
workshop by Daniele Procida https://vurt.org/, the creator of the Diátaxis
framework https://diataxis.fr/.

Each session will be two hours; including an introduction,
discussion/questions, and practical exercises in small groups; and will be
hosted on Zoom. There’s an optional take-home exercise after the first
session, which we’ll review during the second.

The second session builds upon the first, so we strongly prefer that you
attend both sessions to fully benefit from it. However, we may be able to
accommodate a limited number of people that can only make it to one. They
will be hands-on, so to get the most out of your attendance, be ready to
participate and interact with Daniele and your fellow attendees!

While the primary focus of the workshop is on contributors to the Python
documentation, they are open to anyone in the open source... continue reading

naive kindleBOT
#

Perhaps, this has already been addressed in a newer release (?) but in Python 3.9, making @dataclass work with Enum is a bit awkward.

Currently, it order to make it work, I have to:

  1. Pass init=False to @dataclass and hand-write the __init__ method
  2. Pass repr=False to @dataclass and use Enum's representation or write a custom __repr__

Example:
In [72]: @dataclass(frozen=True, init=False, repr=False)
...: class Creature(Enum):
...: legs: int
...: size: str
...: Beetle = (6, 'small')
...: Dog = (4, 'medium')
...: def __init__(self, legs, size):
...: self.legs = legs
...: self.size = size
...:

In [73]: Creature.Dog
Out[73]: <Creature.Dog: (4, 'medium')>

naive kindleBOT
#

I'm writing up a PR for an issue I created and adding a test to test/test_email/test_message.py

In that file there is a variable named message_params that is initialized with about 15 different sets of test data, in class TestEmailMessageBase, but is never referenced again. I even grepped for the variable name in all test py files to confirm that it isn't somehow imported somewhere.

Is there something about the test framework that uses that automatically? I'm hesitant to add any testing code for my issue if I'm missing something so fundamental.

Thanks.

naive kindleBOT
#

Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.23.1. NumPy 1.23.1 is a maintenance release that fixes bugs discovered
after the 1.23.0 release. Notable fixes are:

  • Fix searchsorted for float16 NaNs
  • Fix compilation on Apple M1
  • Fix KeyError in crackfortran operator support (Slycot)

The Python versions supported for this release are 3.8-3.10. Wheels can be
downloaded from PyPI https://pypi.org/project/numpy/1.23.1; source
archives, release notes, and wheel hashes are available on Github
https://github.com/numpy/numpy/releases/tag/v1.23.1.

Contributors

A total of 7 people contributed to this release. People with a "+" by their
names contributed a patch for the first time.

  • Charles Harris
  • Matthias Koeppe +
  • Pranab Das +
  • Rohit Goswami
  • Sebastian Berg
  • Serge Guelton
  • Srimukh Sripada +

Pull requests merged

A total of 8 pull requests were merged for this release.

... continue reading

naive kindleBOT
#

I'm new to this forum, any advice for a newbie is welcome. I have found
datatrees particularly useful in generating hierarchical 3D models of
shape classes with a large number of parameters. Copious parameters
is evidently inevitable with 3D modelling. I've had a few people suggest
pulling it out as a separate library so hence the proposal. Note the
anchorscad.datatrees module is fully functional, it could use some
cleanups but I'd rather discuss the merits of such a proposal to augment
dataclasses and then maybe suggestions for next steps depending on
what people think.

Datatrees Proposal

Building complex hierarchical data objects using
dataclasses reduces
much of the needed boilerplate code. This obviously being the point of
dataclasses. While
using it to develop AnchorSCAD
I found it to be still a very verbose and repetit... continue reading

naive kindleBOT
#

Hi all,

It fills us with astronomical joy to announce the release of poliastro
0.17.0! 🚀

poliastro is an open source (MIT) pure Python library for interactive
astrodynamics and orbital mechanics, with a focus on ease of use, speed,
and quick visualization. It provides a simple and intuitive API, and
handles physical quantities with units. It is used in academia and the
industry by people from all around the world.

You can install poliastro using pip, conda, or mamba:

pip install "poliastro==0.17.0"
mamba install "poliastro=0.17.0" --channel conda-forge

This release brought a number of new features, most notably an
Orbit.to_ephem method for retrieving the propagation time history from
an osculating orbit, a GabbardPlotter class to plot Gabbard diagrams, a
new recursive series Kepler solver for elliptical orbits, and a new
Orbit.elevation method. In addition, we have refactored the propagation
code and deprecated or deleted several parts of the API, so existing
users are encouraged... continue reading

naive kindleBOT
naive kindleBOT
#

Hi all,

Use it if you're using Django Rest and need to log your endpoint requests
to a database. There is no need for migration, and sensitive data is hidden
while logging. You are free to log any specific request status code or
method.

pip install mongo-drf-endpoint-logger

Pypi : https://pypi.org/project/mongo-drf-endpoint-logger/
Github: https://github.com/inanpy/mongo\_drf\_endpoint\_logger

Thank you for support.

naive kindleBOT
#

Hi all,

Use it if you're using Django Rest and need to log your endpoint requests
to a database. There is no need for migration, and sensitive data is hidden
while logging. You are free to log any specific request status code or
method.

pip install mongo-drf-endpoint-logger

Pypi : https://pypi.org/project/mongo-drf-endpoint-logger/
Github: https://github.com/inanpy/mongo\_drf\_endpoint\_logger

Thank you for support.

naive kindleBOT
#

Hi all,

Use it if you're using Django Rest and need to log your endpoint requests
to a database. There is no need for migration, and sensitive data is hidden
while logging. You are free to log any specific request status code or
method.

pip install mongo-drf-endpoint-logger

Pypi : https://pypi.org/project/mongo-drf-endpoint-logger/
Github: https://github.com/inanpy/mongo\_drf\_endpoint\_logger

Thank you for support.

#

I cannot believe I am writing this, but Python 3.11.b4 is finally
available!! [image: :scream:] [image: :tada:] [image: :tada:] [image:
:tada:]

https://www.python.org/downloads/release/python-3110b4/

##[image: :warning:][image: :warning:][image: :warning:] PLEASE HELP US TO
TEST THIS RELEASE [image: :warning:][image: :warning:][image: :warning:]

Due to the modified release schedule and the stability concerns regarding
the past beta releases, please, please, please, please, help us to test
Python 3.11 by testing this beta releases.

  • if you maintain a library or a third-party package. Test the beta
    releases!
  • If you have code that you maintain at work/research
    centre/classroom/whatever. Test the beta releases!
  • If you are a multi-million corporation that uses Python. Test the beta
    releases!
  • If you are a single-person company that uses Python. Test the beta
    releases!
  • If you have a bunch of Python scripts. Test the beta releases!
  • If you use Python for work, research, teaching ... continue reading
naive kindleBOT
#

I cannot believe I am writing this, but Python 3.11.b4 is finally
available!! [image: :scream:] [image: :tada:] [image: :tada:] [image:
:tada:]

https://www.python.org/downloads/release/python-3110b4/

##[image: :warning:][image: :warning:][image: :warning:] PLEASE HELP US TO
TEST THIS RELEASE [image: :warning:][image: :warning:][image: :warning:]

Due to the modified release schedule and the stability concerns regarding
the past beta releases, please, please, please, please, help us to test
Python 3.11 by testing this beta releases.

  • if you maintain a library or a third-party package. Test the beta
    releases!
  • If you have code that you maintain at work/research
    centre/classroom/whatever. Test the beta releases!
  • If you are a multi-million corporation that uses Python. Test the beta
    releases!
  • If you are a single-person company that uses Python. Test the beta
    releases!
  • If you have a bunch of Python scripts. Test the beta releases!
  • If you use Python for wor... continue reading
naive kindleBOT
#

After several rounds of debate on typing-sig, I'd like to request feedback
on PEP 695: https://peps.python.org/pep-0695/

I am sponsoring this PEP, which was written by Eric Traut. The PEP attempts
to solve the problem that defining generic classes, functions and type
aliases currently is lacking dedicated syntax, instead using the cumbersome
T = TypeVar("T", ...) notation to create global variables that serve as
type variables.

As a personal historical note, I should mention that over 22 years ago I
already pondered type parameters. In an old document that I saved I found
the following code snippet:

def f<T> (a: T) -> T: ...

which is eerily close to the proposal in this PEP, except that the PEP uses
square brackets:

def f[T](a: T) -> T: ...

It's been a long and circuitous road!

I am not quoting the entire PEP here, please follow the link:
https://peps.python.org/pep-0695/

--
--Guido van Rossum (python.org/~guido)

naive kindleBOT
#

I've recently released version 0.3.5 of distlib on PyPI [1]. For newcomers,
distlib is a library of packaging functionality which is intended to be
usable as the basis for third-party packaging tools.

The main changes in this release are as follows:

  • Fixed #161: Updated test case.

  • Fixed #164: Improved support for reproducible builds by allowing a fixed
      date/time to be inserted into created .exe files. Thanks to Somber Night for the
      patch.

  • Fixed #169: Removed usage of deprecated imp module in favour of importlib.

  • Fixed #170: Corrected implementation of get\_required\_dists().

  • Fixed #172: Compute ABI correctly for Python < 3.8.

  • Changed the default locator configuration.

  • Made updates in support of PEP 643 / Metadata 2.2.

  • Updated launcher executables. Thanks to Michael Bikovitsky for his help with
      the launcher changes.

  • Updated to write archive path of RECORD to RECORD instead of staging path.
      Thanks to Pieter Pas for the patc... continue reading

naive kindleBOT
#

(Cross-posted from
https://discuss.python.org/t/new-python-organization-repository-policy/17376
– please perfer commenting there.)

Hello,

When asked about adding the typing_extensions repository to the Python
organization (https://github.com/python/steering-council/issues/126),
the Steering Council discussed a general policy for the organization, as
the current one
(https://devguide.python.org/devcycle/#organization-repository-policy)
seems outdated.

We decided on the guidelines below.

Note that existing repositories can stay under python. However, we will
ask that:
– PSF infrastructure be moved under the psf organization, and
– all repositories under python will need to require the CLA and have
two-factor authentication for all committers, otherwise move elsewhere
or be archived.

– Petr, on behalf of the Steering Council

New Organization Repository Policy

Within the GitHub Python organization, repositories are expected to
relate to the Python language, the CPytho... continue reading

#

Hello,
Currently development discussions are split between multiple
communication channels, for example:

  • python-dev and discuss.python.org for design discussions,
  • GitHub Issues and Pull Requests for specific changes,
  • IRC, Discord and private chats for real-time discussions,
  • Topic-specific channels like typing-sig.

While most of these serve different needs, there is too much overlap
between python-dev and discuss.python.org. It seems that for most
people, this situation is worse than sticking to either one platform –
even if we don't go with that person's favorite.

The discuss.python.org experiment has been going on for quite a while,
and while the platform is not without its issues, we consider it a
success. The Core Development category is busier than python-dev.
According to staff, discuss.python.org is much easier to moderate.. If
you're following python-dev but not discuss.python.org, you're missing out.

The Steering Council would like to switch from python-dev t... continue reading

naive kindleBOT
#

What is python-oracledb?

python-oracledb is a Python extension module that enables access to Oracle
Database for Python and conforms to the Python database API 2.0
specifications with a number of enhancements. This module is intended to
eventually replace cx_Oracle.

Where do I get it?

https://pypi.org/project/oracledb/1.0.2/

The easiest method to install/upgrade python-oracledb is via pip as in

python -m pip install oracledb --upgrade

What's new?

This release addresses a number of reported issues. It also adds Linux ARM
64-bit binaries for the first time.

See the full release notes for all of the details:
https://python-oracledb.readthedocs.io/en/latest/release\_notes.html#oracledb-1-0-2-july-2022

Please provide any feedback via GitHub issues: https://github.com/oracle/
python-oracledb/issues or discussions: https://github.com/oracle/python-
oracledb/discussions

naive kindleBOT
#

PEP 692 is posted. It proposes to use TypedDict for more precise **kwargs typing, so that **kwargs consisting of arguments of different types can be appropriately typed. It also proposes a grammar change and a new dunder.

Here is a link to the PEP: https://peps.python.org/pep-0692/
And a link to the discuss thread: https://discuss.python.org/t/pep-692-using-typeddict-for-more-precise-kwargs-typing/17314

naive kindleBOT
#

I have built this on systems at work, that are populated by CAD guys who have developed a good set of libraries to maintain in a linux distribution.  Went without a hitch.

I am trying to build this at home with an opensuse distribution.  I am not trying to do any modifications to python, now or in the future.  I am trying to build this as another software installation wants 3.7 or better and opensuse provided 3.6.

I am stuck with a early compile error after the make command.

I have downloaded, built and installed the openSSl.I have changed the ld.so.conf to include the newly built ssl in the list and re-ran ldconfig.  Even though I have added the newly built ssl to the conf file a dump of the ldconfig does not show the locally built ssl libs.  Does this process depend on LD_LIBRARY_PATH ?  Defining LD_LIBRARY_PATH made no discernable difference.

kevin@localhost:~/Sources/Python-3.10.5> sudo ldconfig -p | grep ssl
[sudo] password for root:  
       libssl3.so (libc6,x86-64) ... continue reading

naive kindleBOT
#

I’m happy to announce a new release of structlog!

With more than 4 million downloads per month, structlog is the most popular solution for structured logging in Python. It doesn’t just allow you to log key-value pairs in a structured manner, it also makes it EASIER and FASTER. Check out https://www.structlog.org/en/stable/why.html if you’re intrigued but not convinced!

My heartfelt thanks go to:

That's the support that made me maintain structlog for almost a decade with no end in sight! <3


(alternatively, see https://github.com/hynek/structlog/releases/tag/22.1.0 for a richer-formatted version of the following)

Highlights

This is a (too) big release, so it has many hi... continue reading

naive kindleBOT
#

Hi all,

CodraFT is an open-source generic signal and image processing software, based on Python, Qt, NumPy, SciPy and others:
https://codra-ingenierie-informatique.github.io/CodraFT/

I am pleased to announce that CodraFT v2.1.1 has been released.
This is the second public release of version 2, compatible with Python 3.7+.

CodraFT provides signal/image processing and visualisation features, and is available either as a stand-alone application or may be embedded in your own Python-Qt application thanks to advanced automation capabilities. CodraFT also has many I/O features, supporting a lot of images format as well as HDF5 (for saving/loading CodraFT workspace or importing any other data file).

Enjoy!

--
Always a pleasure to share with Python community, since 2008.
Pierre Raybaut

naive kindleBOT
#

The SC has been notified of at least one instance of someone subscribed to
this list harassing another subscriber privately. We wanted to remind folks
that we expect people to behave reasonably towards each other, else people
risk losing access to this mailing list and other places where Python is
developed per the Code of Conduct.

Poor behaviour, public or private, is not acceptable and will have
ramifications where we are trying to facilitate an open, considerate, and
respectful community that is under our control.

-Brett, on behalf of the Python steering council

naive kindleBOT
#

Using py in the three OS-es (unix-like, Mac and Win) has become very
similar in the last years, which is great. Making portable py code has
become very easy. However, there is one peculiarity in Win which I find
annoying: virtual environments insists on placing executables in the
Scripts directory, while the other platforms use bin. This forces
portable scripts and programs on the outside of py to be OS-aware in
order to interact with a venv on a Win-system vs other systems.

I would like to proposing the ability to configure virtual environments
to use bin directory for executable on Windows. Personally I think it
would be smart move if it were changed to bin as default, making all
py platform act consistently. However, I do understand that there might
be existing code out there that depend on using Scripts.

Best regards,
Svein