Open impredicative opened 2 years ago
I think you want to use https://github.com/rspeer/ordered-set which is actively developed.
Depends, this is much faster. If that's important, installing from source be the better option (for a while, at least).
It certainly builds and passes all tests on 3.9 (for me), though it may be that the generated Cython C files in the sdist won't build on 3.9.
But no, I haven't had time in my life to give this any attention at all.
python3.10:
from orderedset import OrderedSet
File "/usr/local/lib/python3.10/site-packages/orderedset/__init__.py", line 5, in <module> from ._orderedset import OrderedSet
ImportError: /usr/local/lib/python3.10/site-packages/orderedset/_orderedset.cpython-310-x86_64-linux-gnu.so: undefined symbol: _PyGen_Send
The package is definitely broken at python 3.11, FYI.
Building wheel for orderedset (setup.py): finished with status 'error'
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
running bdist_wheel
The [wheel] section is deprecated. Use [bdist_wheel] instead.
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-311
creating build/lib.linux-x86_64-cpython-311/orderedset
copying lib/orderedset/__init__.py -> build/lib.linux-x86_64-cpython-311/orderedset
running build_ext
building 'orderedset._orderedset' extension
creating build/temp.linux-x86_64-cpython-311
creating build/temp.linux-x86_64-cpython-311/lib
creating build/temp.linux-x86_64-cpython-311/lib/orderedset
x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/python3.11 -c lib/orderedset/_orderedset.c -o build/temp.linux-x86_64-cpython-311/lib/orderedset/_orderedset.o
lib/orderedset/_orderedset.c:209:12: fatal error: longintrepr.h: No such file or directory
209 | #include "longintrepr.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
On MacOS:
pip install orderedset
-
Python 3.10.7:
> pip install orderedset
Collecting orderedset
Using cached orderedset-2.0.3.tar.gz (101 kB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for orderedset, since package 'wheel' is not installed.
Installing collected packages: orderedset
Running setup.py install for orderedset ... error
error: subprocess-exited-with-error
× Running setup.py install for orderedset did not run successfully.
│ exit code: 1
╰─> [215 lines of output]
running install
/Users/idan.miara/.pyenv/versions/3.10.7/envs/py310/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.macosx-12.6-x86_64-cpython-310
creating build/lib.macosx-12.6-x86_64-cpython-310/orderedset
copying lib/orderedset/__init__.py -> build/lib.macosx-12.6-x86_64-cpython-310/orderedset
running build_ext
building 'orderedset._orderedset' extension
creating build/temp.macosx-12.6-x86_64-cpython-310
creating build/temp.macosx-12.6-x86_64-cpython-310/lib
creating build/temp.macosx-12.6-x86_64-cpython-310/lib/orderedset
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Users/idan.miara/.pyenv/versions/3.10.7/envs/py310/include -I/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10 -c lib/orderedset/_orderedset.c -o build/temp.macosx-12.6-x86_64-cpython-310/lib/orderedset/_orderedset.o
lib/orderedset/_orderedset.c:14269:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
PyUnicode_WSTR_LENGTH(op) : \
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14269:22: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14269:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
PyUnicode_WSTR_LENGTH(op)))
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14269:52: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
PyUnicode_WSTR_LENGTH(op) : \
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14269:52: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14269:52: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
PyUnicode_WSTR_LENGTH(op)))
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14285:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
PyUnicode_WSTR_LENGTH(op) : \
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14285:26: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14285:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
PyUnicode_WSTR_LENGTH(op)))
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14285:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
PyUnicode_WSTR_LENGTH(op) : \
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14285:59: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14285:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
PyUnicode_WSTR_LENGTH(op)))
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/idan.miara/.pyenv/versions/3.10.7/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
lib/orderedset/_orderedset.c:14784:21: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
CYTHON_FALLTHROUGH;
^
lib/orderedset/_orderedset.c:287:34: note: expanded from macro 'CYTHON_FALLTHROUGH'
#define CYTHON_FALLTHROUGH __attribute__((fallthrough))
^
lib/orderedset/_orderedset.c:14795:21: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
CYTHON_FALLTHROUGH;
^
lib/orderedset/_orderedset.c:287:34: note: expanded from macro 'CYTHON_FALLTHROUGH'
#define CYTHON_FALLTHROUGH __attribute__((fallthrough))
^
lib/orderedset/_orderedset.c:17344:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
^
lib/orderedset/_orderedset.c:17344:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/orderedset/_orderedset.c:17349:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
^
lib/orderedset/_orderedset.c:17349:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/orderedset/_orderedset.c:17433:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = _PyGen_Send((PyGenObject*)yf, NULL);
^
lib/orderedset/_orderedset.c:17433:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
ret = _PyGen_Send((PyGenObject*)yf, NULL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 warnings and 3 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> orderedset
Python 3.11.1:
> pip install orderedset
Collecting orderedset
Using cached orderedset-2.0.3.tar.gz (101 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: orderedset
Building wheel for orderedset (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
running bdist_wheel
The [wheel] section is deprecated. Use [bdist_wheel] instead.
running build
running build_py
creating build
creating build/lib.macosx-12.6-x86_64-cpython-311
creating build/lib.macosx-12.6-x86_64-cpython-311/orderedset
copying lib/orderedset/__init__.py -> build/lib.macosx-12.6-x86_64-cpython-311/orderedset
running build_ext
building 'orderedset._orderedset' extension
creating build/temp.macosx-12.6-x86_64-cpython-311
creating build/temp.macosx-12.6-x86_64-cpython-311/lib
creating build/temp.macosx-12.6-x86_64-cpython-311/lib/orderedset
clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Users/idan.miara/.pyenv/versions/py311/include -I/Users/idan.miara/.pyenv/versions/3.11.1/include/python3.11 -c lib/orderedset/_orderedset.c -o build/temp.macosx-12.6-x86_64-cpython-311/lib/orderedset/_orderedset.o
lib/orderedset/_orderedset.c:209:12: fatal error: 'longintrepr.h' file not found
#include "longintrepr.h"
^~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for orderedset
Running setup.py clean for orderedset
Failed to build orderedset
Installing collected packages: orderedset
Running setup.py install for orderedset ... error
error: subprocess-exited-with-error
× Running setup.py install for orderedset did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
running install
/Users/idan.miara/.pyenv/versions/py311/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.macosx-12.6-x86_64-cpython-311
creating build/lib.macosx-12.6-x86_64-cpython-311/orderedset
copying lib/orderedset/__init__.py -> build/lib.macosx-12.6-x86_64-cpython-311/orderedset
running build_ext
building 'orderedset._orderedset' extension
creating build/temp.macosx-12.6-x86_64-cpython-311
creating build/temp.macosx-12.6-x86_64-cpython-311/lib
creating build/temp.macosx-12.6-x86_64-cpython-311/lib/orderedset
clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Users/idan.miara/.pyenv/versions/py311/include -I/Users/idan.miara/.pyenv/versions/3.11.1/include/python3.11 -c lib/orderedset/_orderedset.c -o build/temp.macosx-12.6-x86_64-cpython-311/lib/orderedset/_orderedset.o
lib/orderedset/_orderedset.c:209:12: fatal error: 'longintrepr.h' file not found
#include "longintrepr.h"
^~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> orderedset
@simonpercivall Thanks for this nice implementation!
I've been doing some benchmarks and I can roughly confirm your statement about your implementation of OrderedSet
:
Is approximately 5 times faster than the pure Python implementation overall (and 5 times slower than set);
so speed-wise: set
> dict
> orderedset
> ordered-set
> sortedcollections
(I tested dict.keys
as a replacement for OrderedSet
only for the some operations)
👍 👍 👍
Are you going to continue maintaining it for Python 3.10/3.11 going forward ?
import timeit
from functools import partial
from random import randint
from orderedset import OrderedSet as OS1
from ordered_set import OrderedSet as OS2
from sortedcollections import OrderedSet as OS3
item_count = 10_000
item_range = item_count // 2
items = [randint(0, item_range) for _ in range(item_count)]
items_b = [randint(0, item_range) for _ in range(item_count)]
oset1a = OS1(items)
oset2a = OS2(items)
oset1b = OS1(items_b)
oset2b = OS2(items_b)
assert oset1a.difference(oset1b) == oset2a.difference(oset2b)
assert oset1a.intersection(oset1b) == oset2a.intersection(oset2b)
oset1c = OS1(items)
oset2c = OS2(items)
oset1c.add(item_range + 1)
oset2c.add(item_range + 1)
assert oset1c == oset2c
for i in range(item_range):
assert (i in oset1a) == (i in oset2a)
if i in oset1a:
assert oset1a.index(i) == oset2a.index(i)
def init_set(T, items) -> set:
return T(items)
def init_set_list(T, items) -> list:
return list(T(items))
def init_set_d(items) -> dict:
return dict.fromkeys(items)
def init_set_d_list(items) -> list:
return list(dict.fromkeys(items))
def update(s: set, items) -> set:
s.update(items)
return s
def update_d(s: dict, items) -> dict:
d2 = dict.fromkeys(items)
s.update(d2)
return s
set_types = [set, OS1, OS2, OS3]
oss = [init_set(T, items) for T in set_types]
od = init_set_d(items)
osls = [init_set_list(T, items) for T in set_types[1:]] + [init_set_d_list(items)]
for x in osls:
assert osls[0] == x
osls = [update(init_set(T, items), items_b) for T in [OS1]] + [update_d(init_set_d(items), items_b)]
osls = [list(x) for x in osls]
for x in osls:
assert osls[0] == x
number = 1000
repeats = 4
for i in range(repeats):
print(f'----- {i} ------')
print('-- init set like --')
print(f'd: {timeit.timeit(partial(init_set_d, items),number=number)=}')
for idx, T in enumerate(set_types):
print(f'{idx}: {timeit.timeit(partial(init_set, T, items),number=number)=}')
print('-- unique list --')
print(f'd: {timeit.timeit(partial(init_set_d, items),number=number)=}')
for idx, T in enumerate(set_types):
print(f'{idx}: {timeit.timeit(partial(init_set_list, T, items),number=number)=}')
print('-- update set like --')
print(f'd: {timeit.timeit(partial(update_d, od, items_b),number=number)=}')
for idx, os in enumerate(oss[:-1]):
print(f'{idx}: {timeit.timeit(partial(update, os, items_b),number=number)=}')
I thought this problem was just for Poetry... Look what I get when I try to install a package that depends on it:
Note: This error originates from the build backend, and is likely not a problem with poetry but with orderedset (2.0.3) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "orderedset (==2.0.3)"'.
But, well the last commit is the 3ea350a from Feb 26, 2020... Unfortunately, this project seems to be dead...
this project seems to be dead...
The previously linked alternative project https://github.com/rspeer/ordered-set does however work for me with Python 3.11.
@impredicative, thanks a lot for the advise!
The package is not even installing on Python 3.9. This is not in a container. It is in Ubuntu with
gcc
present. On Python 3.10 it is having issues with pytest. The package hasn't been touched in close to two years. If it's officially dead, please mark the repo as Archived, otherwise it ought to be made to work smoothly as before.