Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Commit 5054cbe

Browse files
MichaReisercharliermarsh
authored andcommitted
Merge branch 'RustPython:main' into main
2 parents 335780a + 69d27d9 commit 5054cbe

File tree

89 files changed

+27363
-30899
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+27363
-30899
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ jobs:
3737

3838
- uses: Swatinem/rust-cache@v2
3939

40-
- name: run tests with default features
41-
run: cargo test --all
42-
- name: run tests with embedded parser
43-
run: cargo test --all --no-default-features
44-
- name: run tests with generated parser
45-
run: cargo test --all --all-features
40+
- name: run tests with num-bigint
41+
run: cargo test --all --no-default-features --features num-bigint
42+
- name: run tests with malachite-bigint and all features
43+
run: cargo test --all --features location,malachite-bigint,constant-optimization,fold,unparse,visitor,all-nodes-with-ranges,full-lexer,serde --exclude rustpython-ast-pyo3
4644

4745
lint:
4846
name: Check Rust code with rustfmt and clippy
@@ -55,7 +53,9 @@ jobs:
5553
- name: run rustfmt
5654
run: cargo fmt --all -- --check
5755
- name: run clippy
58-
run: cargo clippy --all --all-features -- -Dwarnings
56+
run: cargo clippy --all --no-default-features --features num-bigint
57+
- name: run clippy
58+
run: cargo clippy --all --features location,malachite-bigint,constant-optimization,fold,unparse,visitor,all-nodes-with-ranges,full-lexer,serde --exclude rustpython-ast-pyo3 -- -Dwarnings
5959

6060
- uses: actions/setup-python@v4
6161
with:

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ include = ["LICENSE", "Cargo.toml", "src/**/*.rs"]
1212
resolver = "2"
1313
members = [
1414
"ast", "core", "format", "literal", "parser",
15+
"ast-pyo3",
1516
"ruff_text_size", "ruff_source_location",
1617
]
1718

@@ -20,7 +21,7 @@ rustpython-ast = { path = "ast", default-features = false }
2021
rustpython-parser-core = { path = "core", features = [] }
2122
rustpython-literal = { path = "literal" }
2223
rustpython-format = { path = "format" }
23-
rustpython-parser = { path = "parser" }
24+
rustpython-parser = { path = "parser", default-features = false }
2425

2526
ahash = "0.7.6"
2627
anyhow = "1.0.45"
@@ -32,7 +33,9 @@ log = "0.4.16"
3233
num-complex = "0.4.0"
3334
num-bigint = "0.4.3"
3435
num-traits = "0.2"
35-
pyo3 = { version = "0.18.3" }
36+
pyo3 = { version = "0.19.0" }
37+
malachite-bigint = { version = "0.1.0" }
38+
memchr = "2.5.0"
3639
rand = "0.8.5"
3740
serde = "1.0"
3841
static_assertions = "1.1"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ We try to keep these crates as a well-packaged library for more potential users.
88

99
- [RustPython][RustPython] is a Python interpreter
1010
- [Ruff][Ruff] is an extremely fast Python linter
11+
- [Pylyzer][Pylyzer] is a static code analyzer / language server for Python
1112
- [Baembal][Baembal] is a Python package to accelerate `ast.parse`
1213

1314
[RustPython]: https://github.com/RustPython/RustPython
1415
[Ruff]: https://github.com/charliermarsh/ruff
16+
[Pylyzer]: https://github.com/mtshiba/pylyzer
1517
[Baembal]: https://github.com/youknowone/baembal

ast-pyo3/.gitignore

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

ast-pyo3/Cargo.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[package]
2+
name = "rustpython-ast-pyo3"
3+
version = "0.0.1"
4+
edition = "2021"
5+
6+
[features]
7+
# abi3 = ["pyo3/abi3-py37"] # will be supported from next pyo3 version
8+
# This feature is experimental
9+
# It reimplements AST types, but currently both slower than python AST types and limited to use in other API
10+
wrapper = []
11+
12+
[lib]
13+
name = "rustpython_ast"
14+
crate-type = ["cdylib"]
15+
16+
[dependencies]
17+
rustpython-ast = { workspace = true, features = ["location"] }
18+
rustpython-parser = { workspace = true, features = ["num-bigint"] }
19+
num-complex = { workspace = true }
20+
num-traits = { workspace = true }
21+
once_cell = { workspace = true }
22+
23+
pyo3 = { workspace = true, features = ["num-bigint", "num-complex"] }

ast-pyo3/pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[build-system]
2+
requires = ["maturin>=0.15,<0.16"]
3+
build-backend = "maturin"
4+
5+
[project]
6+
name = "rustpython_ast"
7+
requires-python = ">=3.7"
8+
classifiers = [
9+
"Programming Language :: Rust",
10+
"Programming Language :: Python :: Implementation :: CPython",
11+
]
12+
13+
[tool.maturin]
14+
# module-name = "_rustpython_ast"
15+
features = ["pyo3/extension-module"]

ast-pyo3/rustpython_ast/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from rustpython_ast.rustpython_ast import parse
2+
3+
__all__ = ["parse"]

0 commit comments

Comments
 (0)