pythonstl 0.1.4__tar.gz → 1.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pythonstl-1.1.4/.flake8 +18 -0
- pythonstl-1.1.4/.github/FUNDING.yml +1 -0
- pythonstl-1.1.4/.github/workflows/python.yml +48 -0
- pythonstl-1.1.4/.gitignore +151 -0
- pythonstl-1.1.4/Cargo.lock +245 -0
- pythonstl-1.1.4/Cargo.toml +13 -0
- {pythonstl-0.1.4/pythonstl.egg-info → pythonstl-1.1.4}/PKG-INFO +59 -46
- pythonstl-1.1.4/PUBLISHING.md +193 -0
- pythonstl-0.1.4/PKG-INFO → pythonstl-1.1.4/README.md +32 -46
- pythonstl-1.1.4/benchmarks/README.md +80 -0
- pythonstl-1.1.4/benchmarks/benchmark_algorithms.py +140 -0
- pythonstl-1.1.4/benchmarks/benchmark_all_structures.py +221 -0
- pythonstl-1.1.4/benchmarks/benchmark_binary_search.py +147 -0
- pythonstl-1.1.4/benchmarks/benchmark_map.py +113 -0
- pythonstl-1.1.4/benchmarks/benchmark_native.cpp +121 -0
- pythonstl-1.1.4/benchmarks/benchmark_rust_vs_py.py +193 -0
- pythonstl-1.1.4/benchmarks/benchmark_stack.py +79 -0
- pythonstl-1.1.4/benchmarks/benchmark_vector.py +109 -0
- pythonstl-1.1.4/example_usage.py +320 -0
- pythonstl-1.1.4/mypy.ini +15 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pyproject.toml +7 -3
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/__init__.py +20 -1
- pythonstl-1.1.4/pythonstl/_rust.pdb +0 -0
- pythonstl-1.1.4/pythonstl/facade/algorithms.py +331 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/facade/map.py +42 -14
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/facade/priority_queue.py +36 -8
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/facade/queue.py +40 -9
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/facade/set.py +40 -16
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/facade/stack.py +38 -9
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/facade/vector.py +64 -27
- pythonstl-1.1.4/src/lib.rs +733 -0
- pythonstl-1.1.4/tests/__init__.py +1 -0
- pythonstl-1.1.4/tests/test_algorithms.py +77 -0
- pythonstl-1.1.4/tests/test_binary_search.py +104 -0
- pythonstl-0.1.4/README.md +0 -404
- pythonstl-0.1.4/pythonstl.egg-info/SOURCES.txt +0 -36
- pythonstl-0.1.4/pythonstl.egg-info/dependency_links.txt +0 -1
- pythonstl-0.1.4/pythonstl.egg-info/top_level.txt +0 -1
- pythonstl-0.1.4/setup.cfg +0 -4
- {pythonstl-0.1.4 → pythonstl-1.1.4}/LICENSE +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/core/__init__.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/core/base.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/core/exceptions.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/core/iterator.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/facade/__init__.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/implementations/__init__.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/implementations/associative/__init__.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/implementations/associative/_map_impl.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/implementations/associative/_set_impl.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/implementations/heaps/__init__.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/implementations/heaps/_priority_queue_impl.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/implementations/linear/__init__.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/implementations/linear/_queue_impl.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/implementations/linear/_stack_impl.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/pythonstl/implementations/linear/_vector_impl.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/setup.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/tests/test_map.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/tests/test_priority_queue.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/tests/test_queue.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/tests/test_set.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/tests/test_stack.py +0 -0
- {pythonstl-0.1.4 → pythonstl-1.1.4}/tests/test_vector.py +0 -0
pythonstl-1.1.4/.flake8
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
github: AnshMNSoni
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Python Tests and Linting
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, master, develop ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main, master, develop ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v4
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install -e .
|
|
28
|
+
pip install pytest pytest-cov mypy flake8
|
|
29
|
+
|
|
30
|
+
- name: Run flake8
|
|
31
|
+
run: |
|
|
32
|
+
flake8 pythonstl/ --count --show-source --statistics
|
|
33
|
+
|
|
34
|
+
- name: Run mypy
|
|
35
|
+
run: |
|
|
36
|
+
mypy pythonstl/ --ignore-missing-imports
|
|
37
|
+
continue-on-error: true
|
|
38
|
+
|
|
39
|
+
- name: Run tests with coverage
|
|
40
|
+
run: |
|
|
41
|
+
pytest tests/ --cov=pythonstl --cov-report=xml --cov-report=term
|
|
42
|
+
|
|
43
|
+
- name: Upload coverage reports
|
|
44
|
+
uses: codecov/codecov-action@v3
|
|
45
|
+
if: matrix.python-version == '3.11'
|
|
46
|
+
with:
|
|
47
|
+
file: ./coverage.xml
|
|
48
|
+
fail_ci_if_error: false
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.nox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
*.py,cover
|
|
48
|
+
.hypothesis/
|
|
49
|
+
.pytest_cache/
|
|
50
|
+
cover/
|
|
51
|
+
|
|
52
|
+
# Translations
|
|
53
|
+
*.mo
|
|
54
|
+
*.pot
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
local_settings.py
|
|
59
|
+
db.sqlite3
|
|
60
|
+
db.sqlite3-journal
|
|
61
|
+
|
|
62
|
+
# Flask stuff:
|
|
63
|
+
instance/
|
|
64
|
+
.webassets-cache
|
|
65
|
+
|
|
66
|
+
# Scrapy stuff:
|
|
67
|
+
.scrapy
|
|
68
|
+
|
|
69
|
+
# Sphinx documentation
|
|
70
|
+
docs/_build/
|
|
71
|
+
|
|
72
|
+
# PyBuilder
|
|
73
|
+
.pybuilder/
|
|
74
|
+
target/
|
|
75
|
+
|
|
76
|
+
# Jupyter Notebook
|
|
77
|
+
.ipynb_checkpoints
|
|
78
|
+
|
|
79
|
+
# IPython
|
|
80
|
+
profile_default/
|
|
81
|
+
ipython_config.py
|
|
82
|
+
|
|
83
|
+
# pyenv
|
|
84
|
+
.python-version
|
|
85
|
+
|
|
86
|
+
# pipenv
|
|
87
|
+
Pipfile.lock
|
|
88
|
+
|
|
89
|
+
# poetry
|
|
90
|
+
poetry.lock
|
|
91
|
+
|
|
92
|
+
# pdm
|
|
93
|
+
.pdm.toml
|
|
94
|
+
|
|
95
|
+
# PEP 582
|
|
96
|
+
__pypackages__/
|
|
97
|
+
|
|
98
|
+
# Celery stuff
|
|
99
|
+
celerybeat-schedule
|
|
100
|
+
celerybeat.pid
|
|
101
|
+
|
|
102
|
+
# SageMath parsed files
|
|
103
|
+
*.sage.py
|
|
104
|
+
|
|
105
|
+
# Environments
|
|
106
|
+
.env
|
|
107
|
+
.venv
|
|
108
|
+
env/
|
|
109
|
+
venv/
|
|
110
|
+
ENV/
|
|
111
|
+
env.bak/
|
|
112
|
+
venv.bak/
|
|
113
|
+
|
|
114
|
+
# Spyder project settings
|
|
115
|
+
.spyderproject
|
|
116
|
+
.spyproject
|
|
117
|
+
|
|
118
|
+
# Rope project settings
|
|
119
|
+
.ropeproject
|
|
120
|
+
|
|
121
|
+
# mkdocs documentation
|
|
122
|
+
/site
|
|
123
|
+
|
|
124
|
+
# mypy
|
|
125
|
+
.mypy_cache/
|
|
126
|
+
.dmypy.json
|
|
127
|
+
dmypy.json
|
|
128
|
+
|
|
129
|
+
# Pyre type checker
|
|
130
|
+
.pyre/
|
|
131
|
+
|
|
132
|
+
# pytype static type analyzer
|
|
133
|
+
.pytype/
|
|
134
|
+
|
|
135
|
+
# Cython debug symbols
|
|
136
|
+
cython_debug/
|
|
137
|
+
|
|
138
|
+
# IDE
|
|
139
|
+
.vscode/
|
|
140
|
+
.idea/
|
|
141
|
+
*.swp
|
|
142
|
+
*.swo
|
|
143
|
+
*~
|
|
144
|
+
|
|
145
|
+
# OS
|
|
146
|
+
.DS_Store
|
|
147
|
+
Thumbs.db
|
|
148
|
+
|
|
149
|
+
# Project-specific private documentation
|
|
150
|
+
PUBLISHING.md
|
|
151
|
+
publishing.md
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "bitflags"
|
|
13
|
+
version = "2.13.0"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "cfg-if"
|
|
19
|
+
version = "1.0.4"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
22
|
+
|
|
23
|
+
[[package]]
|
|
24
|
+
name = "heck"
|
|
25
|
+
version = "0.4.1"
|
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
+
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
|
28
|
+
|
|
29
|
+
[[package]]
|
|
30
|
+
name = "indoc"
|
|
31
|
+
version = "2.0.7"
|
|
32
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
33
|
+
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
|
|
34
|
+
dependencies = [
|
|
35
|
+
"rustversion",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[[package]]
|
|
39
|
+
name = "libc"
|
|
40
|
+
version = "0.2.186"
|
|
41
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
42
|
+
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
|
43
|
+
|
|
44
|
+
[[package]]
|
|
45
|
+
name = "lock_api"
|
|
46
|
+
version = "0.4.14"
|
|
47
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
48
|
+
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
|
|
49
|
+
dependencies = [
|
|
50
|
+
"scopeguard",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[[package]]
|
|
54
|
+
name = "memoffset"
|
|
55
|
+
version = "0.9.1"
|
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
58
|
+
dependencies = [
|
|
59
|
+
"autocfg",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[[package]]
|
|
63
|
+
name = "once_cell"
|
|
64
|
+
version = "1.21.4"
|
|
65
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
66
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
67
|
+
|
|
68
|
+
[[package]]
|
|
69
|
+
name = "parking_lot"
|
|
70
|
+
version = "0.12.5"
|
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
72
|
+
checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
|
|
73
|
+
dependencies = [
|
|
74
|
+
"lock_api",
|
|
75
|
+
"parking_lot_core",
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
[[package]]
|
|
79
|
+
name = "parking_lot_core"
|
|
80
|
+
version = "0.9.12"
|
|
81
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
82
|
+
checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
|
|
83
|
+
dependencies = [
|
|
84
|
+
"cfg-if",
|
|
85
|
+
"libc",
|
|
86
|
+
"redox_syscall",
|
|
87
|
+
"smallvec",
|
|
88
|
+
"windows-link",
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
[[package]]
|
|
92
|
+
name = "portable-atomic"
|
|
93
|
+
version = "1.13.1"
|
|
94
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
95
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
96
|
+
|
|
97
|
+
[[package]]
|
|
98
|
+
name = "proc-macro2"
|
|
99
|
+
version = "1.0.106"
|
|
100
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
101
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
102
|
+
dependencies = [
|
|
103
|
+
"unicode-ident",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
[[package]]
|
|
107
|
+
name = "pyo3"
|
|
108
|
+
version = "0.21.2"
|
|
109
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
110
|
+
checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8"
|
|
111
|
+
dependencies = [
|
|
112
|
+
"cfg-if",
|
|
113
|
+
"indoc",
|
|
114
|
+
"libc",
|
|
115
|
+
"memoffset",
|
|
116
|
+
"parking_lot",
|
|
117
|
+
"portable-atomic",
|
|
118
|
+
"pyo3-build-config",
|
|
119
|
+
"pyo3-ffi",
|
|
120
|
+
"pyo3-macros",
|
|
121
|
+
"unindent",
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
[[package]]
|
|
125
|
+
name = "pyo3-build-config"
|
|
126
|
+
version = "0.21.2"
|
|
127
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
128
|
+
checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50"
|
|
129
|
+
dependencies = [
|
|
130
|
+
"once_cell",
|
|
131
|
+
"target-lexicon",
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
[[package]]
|
|
135
|
+
name = "pyo3-ffi"
|
|
136
|
+
version = "0.21.2"
|
|
137
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
138
|
+
checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403"
|
|
139
|
+
dependencies = [
|
|
140
|
+
"libc",
|
|
141
|
+
"pyo3-build-config",
|
|
142
|
+
]
|
|
143
|
+
|
|
144
|
+
[[package]]
|
|
145
|
+
name = "pyo3-macros"
|
|
146
|
+
version = "0.21.2"
|
|
147
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
148
|
+
checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c"
|
|
149
|
+
dependencies = [
|
|
150
|
+
"proc-macro2",
|
|
151
|
+
"pyo3-macros-backend",
|
|
152
|
+
"quote",
|
|
153
|
+
"syn",
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
[[package]]
|
|
157
|
+
name = "pyo3-macros-backend"
|
|
158
|
+
version = "0.21.2"
|
|
159
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
160
|
+
checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c"
|
|
161
|
+
dependencies = [
|
|
162
|
+
"heck",
|
|
163
|
+
"proc-macro2",
|
|
164
|
+
"pyo3-build-config",
|
|
165
|
+
"quote",
|
|
166
|
+
"syn",
|
|
167
|
+
]
|
|
168
|
+
|
|
169
|
+
[[package]]
|
|
170
|
+
name = "pythonstl"
|
|
171
|
+
version = "0.1.4"
|
|
172
|
+
dependencies = [
|
|
173
|
+
"pyo3",
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
[[package]]
|
|
177
|
+
name = "quote"
|
|
178
|
+
version = "1.0.45"
|
|
179
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
180
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
181
|
+
dependencies = [
|
|
182
|
+
"proc-macro2",
|
|
183
|
+
]
|
|
184
|
+
|
|
185
|
+
[[package]]
|
|
186
|
+
name = "redox_syscall"
|
|
187
|
+
version = "0.5.18"
|
|
188
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
189
|
+
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
|
|
190
|
+
dependencies = [
|
|
191
|
+
"bitflags",
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
[[package]]
|
|
195
|
+
name = "rustversion"
|
|
196
|
+
version = "1.0.22"
|
|
197
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
198
|
+
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
|
199
|
+
|
|
200
|
+
[[package]]
|
|
201
|
+
name = "scopeguard"
|
|
202
|
+
version = "1.2.0"
|
|
203
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
204
|
+
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
|
205
|
+
|
|
206
|
+
[[package]]
|
|
207
|
+
name = "smallvec"
|
|
208
|
+
version = "1.15.2"
|
|
209
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
210
|
+
checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
|
|
211
|
+
|
|
212
|
+
[[package]]
|
|
213
|
+
name = "syn"
|
|
214
|
+
version = "2.0.117"
|
|
215
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
216
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
217
|
+
dependencies = [
|
|
218
|
+
"proc-macro2",
|
|
219
|
+
"quote",
|
|
220
|
+
"unicode-ident",
|
|
221
|
+
]
|
|
222
|
+
|
|
223
|
+
[[package]]
|
|
224
|
+
name = "target-lexicon"
|
|
225
|
+
version = "0.12.16"
|
|
226
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
227
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
228
|
+
|
|
229
|
+
[[package]]
|
|
230
|
+
name = "unicode-ident"
|
|
231
|
+
version = "1.0.24"
|
|
232
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
233
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
234
|
+
|
|
235
|
+
[[package]]
|
|
236
|
+
name = "unindent"
|
|
237
|
+
version = "0.2.4"
|
|
238
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
239
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
240
|
+
|
|
241
|
+
[[package]]
|
|
242
|
+
name = "windows-link"
|
|
243
|
+
version = "0.2.1"
|
|
244
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
245
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "pythonstl"
|
|
3
|
+
version = "0.1.4"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
description = "Rust backend extension for pythonstl data structures"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
|
|
8
|
+
[lib]
|
|
9
|
+
name = "_rust"
|
|
10
|
+
crate-type = ["cdylib"]
|
|
11
|
+
|
|
12
|
+
[dependencies]
|
|
13
|
+
pyo3 = { version = "0.21.0", features = ["extension-module"] }
|
|
@@ -1,35 +1,29 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: pythonstl
|
|
3
|
-
Version:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Classifier:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
License-File: LICENSE
|
|
28
|
-
Dynamic: author
|
|
29
|
-
Dynamic: home-page
|
|
30
|
-
Dynamic: license-file
|
|
31
|
-
Dynamic: requires-python
|
|
32
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pythonstl
|
|
3
|
+
Version: 1.1.4
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
12
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
13
|
+
Classifier: Typing :: Typed
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Summary: C++ STL-style containers implemented in Python using the Facade Design Pattern
|
|
17
|
+
Keywords: stl,data-structures,containers,facade-pattern,cpp-stl,standard-template-library
|
|
18
|
+
Author-email: PySTL Contributors <pythonstl@example.com>
|
|
19
|
+
License: MIT
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
22
|
+
Project-URL: Documentation, https://github.com/AnshMNSoni/STL#readme
|
|
23
|
+
Project-URL: Homepage, https://github.com/AnshMNSoni/STL
|
|
24
|
+
Project-URL: Issues, https://github.com/AnshMNSoni/STL/issues
|
|
25
|
+
Project-URL: Repository, https://github.com/AnshMNSoni/STL
|
|
26
|
+
|
|
33
27
|
# PythonSTL - Python Standard Template Library
|
|
34
28
|
|
|
35
29
|
[](https://pepy.tech/project/pythonstl)
|
|
@@ -352,25 +346,43 @@ Full Python integration while maintaining STL compatibility:
|
|
|
352
346
|
- Copy protocol support
|
|
353
347
|
- Maintains backward compatibility
|
|
354
348
|
|
|
355
|
-
## Benchmarks
|
|
349
|
+
## 📊 Performance Benchmarks
|
|
356
350
|
|
|
357
|
-
PythonSTL
|
|
351
|
+
PythonSTL includes a compiled Rust backend (built with PyO3 and Maturin) for high-performance operations, alongside pure-Python fallbacks. Below are the actual performance comparison results against pure-Python and native C++ (compiled with `g++ -O3`).
|
|
358
352
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
353
|
+
### 1. Containers Performance (50,000 Operations)
|
|
354
|
+
|
|
355
|
+
| Container Class | Pure Python | Python + Rust | Speedup Status | Design / Algorithmic Trade-off |
|
|
356
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
357
|
+
| **Stack** | 0.2470s | 0.1604s | **1.54x faster** | Linear stack operations. Limited by FFI call overhead. |
|
|
358
|
+
| **Queue** | 0.2547s | 0.1946s | **1.31x faster** | FIFO operations. Limited by FFI call overhead. |
|
|
359
|
+
| **Vector** | 0.0050s | 0.0045s | **1.10x faster** | Push_back & random access indices. Limited by FFI. |
|
|
360
|
+
| **Set** | 0.0337s | 0.1844s | *0.18x faster* | **Sorted Set vs Unordered Hash Set** (replicates C++ B-Tree structure) |
|
|
361
|
+
| **Map** | 0.0421s | 0.2104s | *0.20x faster* | **Sorted Map vs Unordered Hash Map** (replicates C++ B-Tree structure) |
|
|
362
|
+
| **Priority Queue**| 0.0584s | 0.0900s | *0.65x faster* | Custom binary heap vs. C-optimized `heapq` module. |
|
|
363
|
+
|
|
364
|
+
* **Sorted Trees vs. Hash Tables**: Python's native `set` and `dict` are highly optimized $O(1)$ hash tables written in C. PythonSTL sets/maps replicate C++'s `std::set`/`std::map` using sorted trees (`BTreeSet`/`BTreeMap`), which run in $O(\log N)$ and sort keys.
|
|
365
|
+
* **FFI overhead**: Storing arbitrary Python objects in Rust requires acquiring the GIL and calling back into the Python VM for comparisons, creating high FFI boundaries.
|
|
366
|
+
|
|
367
|
+
### 2. Algorithms Suite
|
|
368
|
+
|
|
369
|
+
| Algorithm Name | Pure Python (Middle Pivot) | Python + Rust | Pure C++ (O3) | Rust Speedup | Design & FFI Insights |
|
|
370
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
371
|
+
| **next_permutation** | 0.3158s | 0.2530s | 0.0020s | **1.2x** | Lexicographical rearrangement. Limited by FFI conversions. |
|
|
372
|
+
| **nth_element** | 0.0068s | 0.0047s | 0.0000s | **1.5x** | Quickselect median find. (Previously **70.85s** before optimization). |
|
|
373
|
+
| **partition** | 0.0193s | 0.0197s | 0.0000s | **1.0x** | Lambda-predicate partitioning. Dominated by FFI callback overhead. |
|
|
374
|
+
|
|
375
|
+
* **Algorithmic Pivot Vulnerabilities**: A naive Lomuto partition (`pivot = arr[right]`) causes $O(N^2)$ worst-case time on already-sorted or reversed lists (taking **70.85s**). By switching PythonSTL to a middle-pivot (`arr[mid]`), we restore $O(N)$ average time (**0.0068s**).
|
|
376
|
+
|
|
377
|
+
### 3. Binary Search (5,000 Queries on 1,000,000 elements)
|
|
364
378
|
|
|
365
|
-
|
|
379
|
+
| Search Mode / Comparator | Pure Python | Python + Rust | Pure C++ (O3) | Rust Speedup | Systems & Design Insights |
|
|
380
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
381
|
+
| **Standard (`<` comparison)** | 0.0214s | 0.0028s | 0.0000s | **7.5x** | Preserves $O(\log N)$ via direct list indexing. |
|
|
382
|
+
| **Custom Comparator (lambda)**| 0.0251s | 0.0074s | N/A | **3.4x** | Overcomes Python loop overhead despite FFI callbacks. |
|
|
366
383
|
|
|
367
|
-
|
|
368
|
-
- STL-style API
|
|
369
|
-
- Better error messages
|
|
370
|
-
- Bounds checking
|
|
371
|
-
- Type safety
|
|
384
|
+
* **Direct Indexing**: Instead of extracting/copying the entire list (an $O(N)$ operation), the Rust backend uses direct GIL-bound indexing (`arr.get_item(mid)`), maintaining the strict $O(\log N)$ search complexity.
|
|
372
385
|
|
|
373
|
-
See `benchmarks/README.md` for detailed analysis.
|
|
374
386
|
|
|
375
387
|
## Testing
|
|
376
388
|
|
|
@@ -434,3 +446,4 @@ Contributions are welcome! Please:
|
|
|
434
446
|
- Issues: [GitHub Issues](https://github.com/AnshMNSoni/PythonSTL/issues)
|
|
435
447
|
|
|
436
448
|
**PythonSTL v0.1.1** - Bringing C++ STL elegance to Python
|
|
449
|
+
|