[issue45024] Cannot extend collections ABCs with protocol
Anup Parikh added the comment: Yeah, you got the gist of what I meant, though, I guess that was a confusing example since there are apparently protocols for Iterable. But not for many of the other collection ABCs such as Sequence, e.g., the following doesn't work: from typing import Sequence, Protocol class SequenceWithMethod(Sequence, Protocol): def method(self) -> None: pass In which case, anything that implements `method`, `__getitem__`, `__len__`, `__contains__`, `__iter__`, `__reversed__`, `index`, and `count` would be considered a subtype of `SequenceWithMethod` -- status: pending -> open ___ Python tracker <https://bugs.python.org/issue45024> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45024] Cannot extend collections ABCs with protocol
New submission from Anup Parikh : Since the container ABCs are normal classes, and Protocol cannot subclass normal classes, there's no way to create a protocol that extends the ABCs without explicitly listing out all the methods needed for the collection. e.g., can't do this: from typing import Iterable, Protocol class IterableWithMethod(Iterable, Protocol): def method(self) -> None: pass Since the ABCs don't provide any default implementations (I think?), maybe they should just be defined as runtime checkable protocols instead of ABCs? -- components: Library (Lib), Parser messages: 400387 nosy: anuppari, lys.nikolaou, pablogsal priority: normal severity: normal status: open title: Cannot extend collections ABCs with protocol type: behavior ___ Python tracker <https://bugs.python.org/issue45024> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43334] venv does not install libpython
Anup Parikh added the comment: I'm seeing this issue in a third-party package that uses CMake and Make based build systems rather then setuptools (it's a mostly C library which additionally provides some python wrappers). Those build systems can normally parse a python installation with the standard directory structure to find the library and headers, but fail on a venv. I can bring this up with the package developers, but I don't see any downsides to linking the headers/libraries in the venv to make it easy to use. Regarding the comment that venv's are primarily for runtime, I didn't see anything in PEP 405 that supports that statement. And in any case, even for runtime environments, installing a python package from a source distribution is valid, right? So shouldn't the venv support building extensions? Again, I agree that third party packages that provide python wrappers should probably use standard tools (i.e., setuptools) to build the python C extensions, but I fail to see the downsides to including links to the headers/libraries in the venv for ease of use. -- status: closed -> open ___ Python tracker <https://bugs.python.org/issue43334> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43334] venv does not install libpython
Anup Parikh added the comment: Also, at least on windows, the C-API header files are also missing from the venv -- ___ Python tracker <https://bugs.python.org/issue43334> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43334] venv does not install libpython
Anup Parikh added the comment: A typical python installation includes libpython libraries that C extensions can link to. Creating virtual environments with venv normally creates a replica of a python installation directory, including all the built in python modules. However, it doesn't seem to copy over the libpython libraries, so C extensions built with a venv activated can't seem to find the libpython (.so, .a, .dll) file to link against. For example, compare the installation directory of python with the venv directory. The libpython .so/.a/.dll files are missing in the venv -- ___ Python tracker <https://bugs.python.org/issue43334> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43334] venv does not install libpython
New submission from Anup Parikh : The libpython.a or libpython.so objects are not copied/linked in new virtual environments when created with venv. -- components: C API, Installation, Library (Lib) messages: 387752 nosy: anuppari priority: normal severity: normal status: open title: venv does not install libpython type: behavior ___ Python tracker <https://bugs.python.org/issue43334> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com