Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch default parser implementation to native #929

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:
working-directory: native
- name: Build LibCST
run: hatch env create
- name: Pure Tests
- name: Tests
run: hatch run test
- name: Native Tests
- name: Pure Parser Tests
env:
LIBCST_PARSER_TYPE: ${{ matrix.parser }}
LIBCST_PARSER_TYPE: pure
run: hatch run test

# Run linters
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# 1.0.0 - 2023-05-25

The first major release of LibCST is essentially the same as 0.4.10, but using the
newer, Rust-based parser implementation by default. The old, pure Python parser is
scheduled for removal in the next (non-patch) release. Until then, it is available with
the `LIBCST_PARSER_TYPE` environment variable set to `pure`.

## Updated

* Switch the default parser implementation to native by @zsol in https://github.com/Instagram/LibCST/pull/929

# 0.4.10 - 2023-05-23

## New Contributors
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

def is_native() -> bool:
typ = os.environ.get("LIBCST_PARSER_TYPE")
return typ == "native"
return typ != "pure"


def _parse(
Expand Down
5 changes: 2 additions & 3 deletions native/libcst/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
A native extension to enable parsing of new Python grammar in LibCST.

The extension is written in Rust, and exposed to Python using [PyO3](https://pyo3.rs/).
This is packaged together with libcst, and can be imported from `libcst.native`. When
the `LIBCST_PARSER_TYPE` environment variable is set to `native`, the LibCST APIs use
this module for all parsing.
This is packaged together with libcst, and can be imported from `libcst.native`. By default
the LibCST APIs use this module for all parsing.

Later on, the parser library might be packaged separately as
[a Rust crate](https://crates.io). Pull requests towards this are much appreciated.
Expand Down