py-fastplus 0.2.0__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.
- py_fastplus-0.2.0/.githooks/pre-commit +42 -0
- py_fastplus-0.2.0/.github/workflows/Commit.yml +41 -0
- py_fastplus-0.2.0/.github/workflows/Publish.yml +205 -0
- py_fastplus-0.2.0/.gitignore +72 -0
- py_fastplus-0.2.0/Cargo.lock +220 -0
- py_fastplus-0.2.0/Cargo.toml +15 -0
- py_fastplus-0.2.0/LICENSE +21 -0
- py_fastplus-0.2.0/PKG-INFO +32 -0
- py_fastplus-0.2.0/README.md +20 -0
- py_fastplus-0.2.0/examples/parse_demo.rs +11 -0
- py_fastplus-0.2.0/pyproject.toml +24 -0
- py_fastplus-0.2.0/python/fastplus/__about__.py +6 -0
- py_fastplus-0.2.0/python/fastplus/__init__.py +7 -0
- py_fastplus-0.2.0/python/fastplus/core.pyi +118 -0
- py_fastplus-0.2.0/python/fastplus/parser.py +8 -0
- py_fastplus-0.2.0/python/tests/test_all.py +75 -0
- py_fastplus-0.2.0/src/ast.rs +129 -0
- py_fastplus-0.2.0/src/fastplus.pest +81 -0
- py_fastplus-0.2.0/src/field.rs +512 -0
- py_fastplus-0.2.0/src/lib.rs +8 -0
- py_fastplus-0.2.0/src/operator.rs +1510 -0
- py_fastplus-0.2.0/src/parser.rs +472 -0
- py_fastplus-0.2.0/src/python.rs +430 -0
- py_fastplus-0.2.0/src/python_macro.rs +148 -0
- py_fastplus-0.2.0/uv.lock +573 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/bin/zsh
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
run_check() {
|
|
5
|
+
local name="$1"
|
|
6
|
+
shift
|
|
7
|
+
|
|
8
|
+
local output
|
|
9
|
+
local exit_code
|
|
10
|
+
|
|
11
|
+
if output=$("$@" 2>&1); then
|
|
12
|
+
return 0
|
|
13
|
+
else
|
|
14
|
+
exit_code=$?
|
|
15
|
+
print -u2 -- "$name failed"
|
|
16
|
+
print -u2 -r -- "$output"
|
|
17
|
+
return "$exit_code"
|
|
18
|
+
fi
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
run_check "ruff check" uv run ruff check python
|
|
22
|
+
run_check "ruff format" uv run ruff format --check python
|
|
23
|
+
run_check "ty" uv run ty check
|
|
24
|
+
|
|
25
|
+
run_check "cargo check" env \
|
|
26
|
+
PYO3_PYTHON="$(pwd)/.venv/bin/python" \
|
|
27
|
+
cargo check --all-targets --all-features
|
|
28
|
+
|
|
29
|
+
run_check "cargo test" env \
|
|
30
|
+
PYO3_PYTHON="$(pwd)/.venv/bin/python" \
|
|
31
|
+
cargo test --all-targets --all-features
|
|
32
|
+
|
|
33
|
+
for example_path in examples/*.rs(N); do
|
|
34
|
+
example_name="${example_path:t:r}"
|
|
35
|
+
run_check "cargo run --example $example_name" env \
|
|
36
|
+
PYO3_PYTHON="$(pwd)/.venv/bin/python" \
|
|
37
|
+
cargo run --example "$example_name" --all-features
|
|
38
|
+
done
|
|
39
|
+
|
|
40
|
+
run_check "cargo clippy" env \
|
|
41
|
+
PYO3_PYTHON="$(pwd)/.venv/bin/python" \
|
|
42
|
+
cargo clippy --all-targets --all-features -- -D warnings
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Commit
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
cargo-test:
|
|
12
|
+
name: cargo test (${{ matrix.os }})
|
|
13
|
+
runs-on: ${{ matrix.os }}
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v6
|
|
19
|
+
- uses: actions/setup-python@v6
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.x"
|
|
22
|
+
- name: Run cargo test
|
|
23
|
+
run: cargo test
|
|
24
|
+
|
|
25
|
+
pytest:
|
|
26
|
+
name: uv run pytest (${{ matrix.os }})
|
|
27
|
+
runs-on: ${{ matrix.os }}
|
|
28
|
+
strategy:
|
|
29
|
+
matrix:
|
|
30
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v6
|
|
33
|
+
- uses: actions/setup-python@v6
|
|
34
|
+
with:
|
|
35
|
+
python-version: "3.x"
|
|
36
|
+
- name: Install uv
|
|
37
|
+
uses: astral-sh/setup-uv@v7
|
|
38
|
+
- name: Install dependencies
|
|
39
|
+
run: uv sync --dev
|
|
40
|
+
- name: Run pytest
|
|
41
|
+
run: uv run pytest
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- dev
|
|
8
|
+
tags:
|
|
9
|
+
- '*'
|
|
10
|
+
pull_request:
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
linux:
|
|
18
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
platform:
|
|
22
|
+
- runner: ubuntu-22.04
|
|
23
|
+
target: x86_64
|
|
24
|
+
- runner: ubuntu-22.04
|
|
25
|
+
target: x86
|
|
26
|
+
- runner: ubuntu-22.04
|
|
27
|
+
target: aarch64
|
|
28
|
+
- runner: ubuntu-22.04
|
|
29
|
+
target: armv7
|
|
30
|
+
- runner: ubuntu-22.04
|
|
31
|
+
target: s390x
|
|
32
|
+
- runner: ubuntu-22.04
|
|
33
|
+
target: ppc64le
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v6
|
|
36
|
+
- uses: actions/setup-python@v6
|
|
37
|
+
with:
|
|
38
|
+
python-version: "3.x"
|
|
39
|
+
- name: Build wheels
|
|
40
|
+
uses: PyO3/maturin-action@v1
|
|
41
|
+
with:
|
|
42
|
+
target: ${{ matrix.platform.target }}
|
|
43
|
+
args: --release --out dist --find-interpreter
|
|
44
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
45
|
+
manylinux: auto
|
|
46
|
+
- name: Upload wheels
|
|
47
|
+
uses: actions/upload-artifact@v6
|
|
48
|
+
with:
|
|
49
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
50
|
+
path: dist
|
|
51
|
+
|
|
52
|
+
musllinux:
|
|
53
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
54
|
+
strategy:
|
|
55
|
+
matrix:
|
|
56
|
+
platform:
|
|
57
|
+
- runner: ubuntu-22.04
|
|
58
|
+
target: x86_64
|
|
59
|
+
- runner: ubuntu-22.04
|
|
60
|
+
target: x86
|
|
61
|
+
- runner: ubuntu-22.04
|
|
62
|
+
target: aarch64
|
|
63
|
+
- runner: ubuntu-22.04
|
|
64
|
+
target: armv7
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v6
|
|
67
|
+
- uses: actions/setup-python@v6
|
|
68
|
+
with:
|
|
69
|
+
python-version: "3.x"
|
|
70
|
+
- name: Build wheels
|
|
71
|
+
uses: PyO3/maturin-action@v1
|
|
72
|
+
with:
|
|
73
|
+
target: ${{ matrix.platform.target }}
|
|
74
|
+
args: --release --out dist --find-interpreter
|
|
75
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
76
|
+
manylinux: musllinux_1_2
|
|
77
|
+
- name: Upload wheels
|
|
78
|
+
uses: actions/upload-artifact@v6
|
|
79
|
+
with:
|
|
80
|
+
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
81
|
+
path: dist
|
|
82
|
+
|
|
83
|
+
windows:
|
|
84
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
85
|
+
strategy:
|
|
86
|
+
matrix:
|
|
87
|
+
platform:
|
|
88
|
+
- runner: windows-latest
|
|
89
|
+
target: x64
|
|
90
|
+
python_arch: x64
|
|
91
|
+
- runner: windows-latest
|
|
92
|
+
target: x86
|
|
93
|
+
python_arch: x86
|
|
94
|
+
- runner: windows-11-arm
|
|
95
|
+
target: aarch64
|
|
96
|
+
python_arch: arm64
|
|
97
|
+
steps:
|
|
98
|
+
- uses: actions/checkout@v6
|
|
99
|
+
- uses: actions/setup-python@v6
|
|
100
|
+
with:
|
|
101
|
+
python-version: "3.13"
|
|
102
|
+
architecture: ${{ matrix.platform.python_arch }}
|
|
103
|
+
- name: Build wheels
|
|
104
|
+
uses: PyO3/maturin-action@v1
|
|
105
|
+
with:
|
|
106
|
+
target: ${{ matrix.platform.target }}
|
|
107
|
+
args: --release --out dist --find-interpreter
|
|
108
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
109
|
+
- name: Upload wheels
|
|
110
|
+
uses: actions/upload-artifact@v6
|
|
111
|
+
with:
|
|
112
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
113
|
+
path: dist
|
|
114
|
+
|
|
115
|
+
macos:
|
|
116
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
117
|
+
strategy:
|
|
118
|
+
matrix:
|
|
119
|
+
platform:
|
|
120
|
+
- runner: macos-15-intel
|
|
121
|
+
target: x86_64
|
|
122
|
+
- runner: macos-latest
|
|
123
|
+
target: aarch64
|
|
124
|
+
steps:
|
|
125
|
+
- uses: actions/checkout@v6
|
|
126
|
+
- uses: actions/setup-python@v6
|
|
127
|
+
with:
|
|
128
|
+
python-version: "3.x"
|
|
129
|
+
- name: Build wheels
|
|
130
|
+
uses: PyO3/maturin-action@v1
|
|
131
|
+
with:
|
|
132
|
+
target: ${{ matrix.platform.target }}
|
|
133
|
+
args: --release --out dist --find-interpreter
|
|
134
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
135
|
+
- name: Upload wheels
|
|
136
|
+
uses: actions/upload-artifact@v6
|
|
137
|
+
with:
|
|
138
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
139
|
+
path: dist
|
|
140
|
+
|
|
141
|
+
sdist:
|
|
142
|
+
runs-on: ubuntu-latest
|
|
143
|
+
steps:
|
|
144
|
+
- uses: actions/checkout@v6
|
|
145
|
+
- name: Build sdist
|
|
146
|
+
uses: PyO3/maturin-action@v1
|
|
147
|
+
with:
|
|
148
|
+
command: sdist
|
|
149
|
+
args: --out dist
|
|
150
|
+
- name: Upload sdist
|
|
151
|
+
uses: actions/upload-artifact@v6
|
|
152
|
+
with:
|
|
153
|
+
name: wheels-sdist
|
|
154
|
+
path: dist
|
|
155
|
+
|
|
156
|
+
release:
|
|
157
|
+
name: Release
|
|
158
|
+
if: ${{ github.event_name != 'pull_request' }}
|
|
159
|
+
runs-on: ubuntu-latest
|
|
160
|
+
needs: [linux, musllinux, windows, macos, sdist]
|
|
161
|
+
permissions:
|
|
162
|
+
# Use to sign the release artifacts
|
|
163
|
+
id-token: write
|
|
164
|
+
# Used to upload release artifacts
|
|
165
|
+
contents: write
|
|
166
|
+
# Used to generate artifact attestation
|
|
167
|
+
attestations: write
|
|
168
|
+
steps:
|
|
169
|
+
- uses: actions/checkout@v6
|
|
170
|
+
- uses: actions/download-artifact@v7
|
|
171
|
+
- name: Determine release tag
|
|
172
|
+
id: release-tag
|
|
173
|
+
shell: bash
|
|
174
|
+
run: |
|
|
175
|
+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
|
176
|
+
echo "tag=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"
|
|
177
|
+
else
|
|
178
|
+
echo "tag=${GITHUB_REF_NAME}-latest" >> "$GITHUB_OUTPUT"
|
|
179
|
+
fi
|
|
180
|
+
- name: Move release tag to current commit
|
|
181
|
+
env:
|
|
182
|
+
RELEASE_TAG: ${{ steps.release-tag.outputs.tag }}
|
|
183
|
+
run: |
|
|
184
|
+
git tag --force "$RELEASE_TAG" "$GITHUB_SHA"
|
|
185
|
+
git push origin "refs/tags/$RELEASE_TAG" --force
|
|
186
|
+
- name: Generate artifact attestation
|
|
187
|
+
uses: actions/attest@v4
|
|
188
|
+
with:
|
|
189
|
+
subject-path: 'wheels-*/*'
|
|
190
|
+
- name: Create or update GitHub Release
|
|
191
|
+
uses: softprops/action-gh-release@v3
|
|
192
|
+
with:
|
|
193
|
+
tag_name: ${{ steps.release-tag.outputs.tag }}
|
|
194
|
+
generate_release_notes: true
|
|
195
|
+
append_body: false
|
|
196
|
+
overwrite_files: true
|
|
197
|
+
files: wheels-*/*
|
|
198
|
+
- name: Install uv
|
|
199
|
+
uses: astral-sh/setup-uv@v7
|
|
200
|
+
- name: Publish to PyPI Test
|
|
201
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
202
|
+
run: uv publish --publish-url https://test.pypi.org/legacy/ 'wheels-*/*'
|
|
203
|
+
- name: Publish to PyPI
|
|
204
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
205
|
+
run: uv publish 'wheels-*/*'
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/target
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
.venv/
|
|
14
|
+
env/
|
|
15
|
+
bin/
|
|
16
|
+
build/
|
|
17
|
+
develop-eggs/
|
|
18
|
+
dist/
|
|
19
|
+
eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
include/
|
|
26
|
+
man/
|
|
27
|
+
venv/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
pip-selfcheck.json
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
|
|
45
|
+
# Translations
|
|
46
|
+
*.mo
|
|
47
|
+
|
|
48
|
+
# Mr Developer
|
|
49
|
+
.mr.developer.cfg
|
|
50
|
+
.project
|
|
51
|
+
.pydevproject
|
|
52
|
+
|
|
53
|
+
# Rope
|
|
54
|
+
.ropeproject
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
.DS_Store
|
|
61
|
+
|
|
62
|
+
# Sphinx documentation
|
|
63
|
+
docs/_build/
|
|
64
|
+
|
|
65
|
+
# PyCharm
|
|
66
|
+
.idea/
|
|
67
|
+
|
|
68
|
+
# VSCode
|
|
69
|
+
.vscode/
|
|
70
|
+
|
|
71
|
+
# Pyenv
|
|
72
|
+
.python-version
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "fastplus"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"pest",
|
|
10
|
+
"pest_derive",
|
|
11
|
+
"pyo3",
|
|
12
|
+
"thiserror",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[[package]]
|
|
16
|
+
name = "heck"
|
|
17
|
+
version = "0.5.0"
|
|
18
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
19
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
20
|
+
|
|
21
|
+
[[package]]
|
|
22
|
+
name = "libc"
|
|
23
|
+
version = "0.2.189"
|
|
24
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
25
|
+
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
|
26
|
+
|
|
27
|
+
[[package]]
|
|
28
|
+
name = "memchr"
|
|
29
|
+
version = "2.8.3"
|
|
30
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
31
|
+
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|
32
|
+
|
|
33
|
+
[[package]]
|
|
34
|
+
name = "once_cell"
|
|
35
|
+
version = "1.21.4"
|
|
36
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
37
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
38
|
+
|
|
39
|
+
[[package]]
|
|
40
|
+
name = "pest"
|
|
41
|
+
version = "2.8.8"
|
|
42
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
43
|
+
checksum = "7df728be843c7070fab6ab7c328c4e9e9d78e23bf749c0669c86ee7ebfa050a2"
|
|
44
|
+
dependencies = [
|
|
45
|
+
"memchr",
|
|
46
|
+
"ucd-trie",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[[package]]
|
|
50
|
+
name = "pest_derive"
|
|
51
|
+
version = "2.8.8"
|
|
52
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
53
|
+
checksum = "9e2dd6fc3b26b3462ee188aac870f5a41d398f1cd5e2408d16531bd71c9591fd"
|
|
54
|
+
dependencies = [
|
|
55
|
+
"pest",
|
|
56
|
+
"pest_generator",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[[package]]
|
|
60
|
+
name = "pest_generator"
|
|
61
|
+
version = "2.8.8"
|
|
62
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
+
checksum = "6a7a9205cfb6f596a9e8b689c0a15f9ceb7a1aafae7aaf788150ac65b29975b6"
|
|
64
|
+
dependencies = [
|
|
65
|
+
"pest",
|
|
66
|
+
"pest_meta",
|
|
67
|
+
"proc-macro2",
|
|
68
|
+
"quote",
|
|
69
|
+
"syn 2.0.119",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
[[package]]
|
|
73
|
+
name = "pest_meta"
|
|
74
|
+
version = "2.8.8"
|
|
75
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
76
|
+
checksum = "85abd351c0de1e8384fc791a0737111a350394937e92b956b743dac12429f57c"
|
|
77
|
+
dependencies = [
|
|
78
|
+
"pest",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
[[package]]
|
|
82
|
+
name = "portable-atomic"
|
|
83
|
+
version = "1.14.0"
|
|
84
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
85
|
+
checksum = "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3"
|
|
86
|
+
|
|
87
|
+
[[package]]
|
|
88
|
+
name = "proc-macro2"
|
|
89
|
+
version = "1.0.107"
|
|
90
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
91
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
92
|
+
dependencies = [
|
|
93
|
+
"unicode-ident",
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
[[package]]
|
|
97
|
+
name = "pyo3"
|
|
98
|
+
version = "0.29.0"
|
|
99
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
100
|
+
checksum = "cd274650b21d4bfc26a0a47587962c1edb425f69287324355cd040c3ea66071c"
|
|
101
|
+
dependencies = [
|
|
102
|
+
"libc",
|
|
103
|
+
"once_cell",
|
|
104
|
+
"portable-atomic",
|
|
105
|
+
"pyo3-build-config",
|
|
106
|
+
"pyo3-ffi",
|
|
107
|
+
"pyo3-macros",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
[[package]]
|
|
111
|
+
name = "pyo3-build-config"
|
|
112
|
+
version = "0.29.0"
|
|
113
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
114
|
+
checksum = "c5e2a7d2f0d013342f295c048ad19237add5154a55b1c5a254c0ec93d4109078"
|
|
115
|
+
dependencies = [
|
|
116
|
+
"target-lexicon",
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
[[package]]
|
|
120
|
+
name = "pyo3-ffi"
|
|
121
|
+
version = "0.29.0"
|
|
122
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
123
|
+
checksum = "ca85c467da1bbc8d866eea5deff9cf29ea5f7785054a17da36e65bda9c05845b"
|
|
124
|
+
dependencies = [
|
|
125
|
+
"libc",
|
|
126
|
+
"pyo3-build-config",
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
[[package]]
|
|
130
|
+
name = "pyo3-macros"
|
|
131
|
+
version = "0.29.0"
|
|
132
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
133
|
+
checksum = "9ac53762fd065daa3194dd09337a38bd793a188100fd1a9304c4ab312d901771"
|
|
134
|
+
dependencies = [
|
|
135
|
+
"proc-macro2",
|
|
136
|
+
"pyo3-macros-backend",
|
|
137
|
+
"quote",
|
|
138
|
+
"syn 2.0.119",
|
|
139
|
+
]
|
|
140
|
+
|
|
141
|
+
[[package]]
|
|
142
|
+
name = "pyo3-macros-backend"
|
|
143
|
+
version = "0.29.0"
|
|
144
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
145
|
+
checksum = "4ca3a1557399783172dc5bf39cfca835157732532cba56b71d2292161e53b362"
|
|
146
|
+
dependencies = [
|
|
147
|
+
"heck",
|
|
148
|
+
"proc-macro2",
|
|
149
|
+
"quote",
|
|
150
|
+
"syn 2.0.119",
|
|
151
|
+
]
|
|
152
|
+
|
|
153
|
+
[[package]]
|
|
154
|
+
name = "quote"
|
|
155
|
+
version = "1.0.47"
|
|
156
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
157
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
158
|
+
dependencies = [
|
|
159
|
+
"proc-macro2",
|
|
160
|
+
]
|
|
161
|
+
|
|
162
|
+
[[package]]
|
|
163
|
+
name = "syn"
|
|
164
|
+
version = "2.0.119"
|
|
165
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
166
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
167
|
+
dependencies = [
|
|
168
|
+
"proc-macro2",
|
|
169
|
+
"quote",
|
|
170
|
+
"unicode-ident",
|
|
171
|
+
]
|
|
172
|
+
|
|
173
|
+
[[package]]
|
|
174
|
+
name = "syn"
|
|
175
|
+
version = "3.0.3"
|
|
176
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
177
|
+
checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
|
|
178
|
+
dependencies = [
|
|
179
|
+
"proc-macro2",
|
|
180
|
+
"quote",
|
|
181
|
+
"unicode-ident",
|
|
182
|
+
]
|
|
183
|
+
|
|
184
|
+
[[package]]
|
|
185
|
+
name = "target-lexicon"
|
|
186
|
+
version = "0.13.5"
|
|
187
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
188
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
189
|
+
|
|
190
|
+
[[package]]
|
|
191
|
+
name = "thiserror"
|
|
192
|
+
version = "2.0.19"
|
|
193
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
194
|
+
checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9"
|
|
195
|
+
dependencies = [
|
|
196
|
+
"thiserror-impl",
|
|
197
|
+
]
|
|
198
|
+
|
|
199
|
+
[[package]]
|
|
200
|
+
name = "thiserror-impl"
|
|
201
|
+
version = "2.0.19"
|
|
202
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
203
|
+
checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd"
|
|
204
|
+
dependencies = [
|
|
205
|
+
"proc-macro2",
|
|
206
|
+
"quote",
|
|
207
|
+
"syn 3.0.3",
|
|
208
|
+
]
|
|
209
|
+
|
|
210
|
+
[[package]]
|
|
211
|
+
name = "ucd-trie"
|
|
212
|
+
version = "0.1.7"
|
|
213
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
214
|
+
checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
|
|
215
|
+
|
|
216
|
+
[[package]]
|
|
217
|
+
name = "unicode-ident"
|
|
218
|
+
version = "1.0.24"
|
|
219
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
220
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "fastplus"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
|
|
7
|
+
[lib]
|
|
8
|
+
name = "fastplus"
|
|
9
|
+
crate-type = ["cdylib", "rlib"]
|
|
10
|
+
|
|
11
|
+
[dependencies]
|
|
12
|
+
pest = "2.8.8"
|
|
13
|
+
pest_derive = "2.8.8"
|
|
14
|
+
pyo3 = "0.29.0"
|
|
15
|
+
thiserror = "2.0.19"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AshSwing
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-fastplus
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Summary: Add your description here
|
|
8
|
+
Author-email: AshSwing <ashswing@email.cn>
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
11
|
+
|
|
12
|
+
# FastPlus - Alpha Expression Language, based on WorldQuant's Fast Expression
|
|
13
|
+
|
|
14
|
+
基于 WorldQuant Fast Expression 开发的因子表达式语法解析器.
|
|
15
|
+
|
|
16
|
+
## 平台规则
|
|
17
|
+
|
|
18
|
+
- 关键字参数全部都可以使用字符串类型
|
|
19
|
+
- 数值标量会自动广播, 可以视作 MATRIX
|
|
20
|
+
|
|
21
|
+
## 当前操作符支持范围
|
|
22
|
+
|
|
23
|
+
当前实现面向 RegularAlpha,仅收录 RegularAlpha 可用的 108 个操作符。原始操作符资料中属于 SuperAlpha 的操作符暂不支持,包括 Combo、Reduce、Special 等类别中的专用操作符。
|
|
24
|
+
|
|
25
|
+
当前与平台行为保持一致的限制:
|
|
26
|
+
|
|
27
|
+
- `subtract` 目前只支持 `nary = 2`,即两个位置参数;平台的无限参数版本尚未实现。
|
|
28
|
+
- `add`、`multiply`、`max`、`min` 等 `nary = -1` 操作符只在签名中声明一个可变参数类型,实际使用时至少需要两个位置参数,由 op-check 负责校验。
|
|
29
|
+
- `jump_decay` 的位置参数为 `x` 和 `d`,关键字参数为 `stddev=false`、`sensitivity=0.5`、`force=0.1`。
|
|
30
|
+
- `ts_rank_gmean_amean_diff` 要求使用 `lookback` 关键字参数,以保持表达式语法的完整性;虽然平台允许将 `d` 作为位置参数传入,FastPlus 当前不采用这种写法。
|
|
31
|
+
- 除 `ts_rank_gmean_amean_diff` 外,包含 lookback 语义的时间序列操作符将 lookback 作为最后一个位置参数,例如 `ts_backfill(x, d)`、`ts_rank(x, d)`。
|
|
32
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# FastPlus - Alpha Expression Language, based on WorldQuant's Fast Expression
|
|
2
|
+
|
|
3
|
+
基于 WorldQuant Fast Expression 开发的因子表达式语法解析器.
|
|
4
|
+
|
|
5
|
+
## 平台规则
|
|
6
|
+
|
|
7
|
+
- 关键字参数全部都可以使用字符串类型
|
|
8
|
+
- 数值标量会自动广播, 可以视作 MATRIX
|
|
9
|
+
|
|
10
|
+
## 当前操作符支持范围
|
|
11
|
+
|
|
12
|
+
当前实现面向 RegularAlpha,仅收录 RegularAlpha 可用的 108 个操作符。原始操作符资料中属于 SuperAlpha 的操作符暂不支持,包括 Combo、Reduce、Special 等类别中的专用操作符。
|
|
13
|
+
|
|
14
|
+
当前与平台行为保持一致的限制:
|
|
15
|
+
|
|
16
|
+
- `subtract` 目前只支持 `nary = 2`,即两个位置参数;平台的无限参数版本尚未实现。
|
|
17
|
+
- `add`、`multiply`、`max`、`min` 等 `nary = -1` 操作符只在签名中声明一个可变参数类型,实际使用时至少需要两个位置参数,由 op-check 负责校验。
|
|
18
|
+
- `jump_decay` 的位置参数为 `x` 和 `d`,关键字参数为 `stddev=false`、`sensitivity=0.5`、`force=0.1`。
|
|
19
|
+
- `ts_rank_gmean_amean_diff` 要求使用 `lookback` 关键字参数,以保持表达式语法的完整性;虽然平台允许将 `d` 作为位置参数传入,FastPlus 当前不采用这种写法。
|
|
20
|
+
- 除 `ts_rank_gmean_amean_diff` 外,包含 lookback 语义的时间序列操作符将 lookback 作为最后一个位置参数,例如 `ts_backfill(x, d)`、`ts_rank(x, d)`。
|