Commit graph

55 commits

Author SHA1 Message Date
Zsolt Dollenstein
bd96010782
exclude native/target directory from sdist (#928) 2023-05-24 20:36:31 +01:00
Amethyst Reese
6a7b82e2b6 PEP 621 + hatch to run tests/lint/etc
Moves PEP 621 metadata from `setup.py` and `requirements*.txt` into the
`[project]` table of `pyproject.toml`. This enables using hatch as a
task runner for the project, where previously one would need to remember
a bunch of different commands, or repeatedly consult the readme's
developer guide to find all of the relevant commands.

This creates the following hatch commands:

- docs
- fixtures
- format
- lint
- test
- typecheck

It also updates all of the github actions workflows to use the
appropriate hatch commands, and the readme's developer guide, so that
there is only one source of truth for what constitutes running tests.

The "test" workflows now drop the matrix distinction between "pure" or
"native", and run tests in both modes from a single build.

ghstack-source-id: 8834da7825
Pull Request resolved: https://github.com/Instagram/LibCST/pull/893
2023-03-14 19:37:41 -07:00
Amethyst Reese
944ff159f6
Add setuptools-rust to build requirements in setup.py (#873)
Hoping this resolves the CI failures on 3.11
2023-02-21 18:47:09 -08:00
Andrey Semakin
ff01b86786
Add py3.11 classifier (#816) 2022-11-11 09:00:42 +00:00
Adam Johnson
5900a4ecd6
Add package links to PyPI (#688) 2022-05-16 19:11:11 +01:00
Luke Petre
e5ab7b90b4
Drop support for running libcst using a python 3.6 interpreter (#663)
* Drop support for running libcst using a python 3.6 interpreter

* PR feedback
2022-03-24 11:31:48 -04:00
Zsolt Dollenstein
c44ff0500b
Fix license headers (#560)
* Facebook -> Meta

* remove year from doc copyright
2021-12-28 11:55:18 +00:00
John Reese
10c3aa09a7
Upgrade to µsort 1.0.0rc1, and apply formatting changes (#565)
* Upgrade to usort==1.0.0rc1

* Apply sorting changes from usort 1.0.0rc1

* reapply codegen

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
2021-12-21 14:55:04 -08:00
Zsolt Dollenstein
c02de9b718
Implement a Python PEG parser in Rust (#566)
This massive PR implements an alternative Python parser that will allow LibCST to parse Python 3.10's new grammar features. The parser is implemented in Rust, but it's turned off by default through the `LIBCST_PARSER_TYPE` environment variable. Set it to `native` to enable. The PR also enables new CI steps that test just the Rust parser, as well as steps that produce binary wheels for a variety of CPython versions and platforms.

Note: this PR aims to be roughly feature-equivalent to the main branch, so it doesn't include new 3.10 syntax features. That will be addressed as a follow-up PR.

The new parser is implemented in the `native/` directory, and is organized into two rust crates: `libcst_derive` contains some macros to facilitate various features of CST nodes, and `libcst` contains the `parser` itself (including the Python grammar), a `tokenizer` implementation by @bgw, and a very basic representation of CST `nodes`. Parsing is done by
1. **tokenizing** the input utf-8 string (bytes are not supported at the Rust layer, they are converted to utf-8 strings by the python wrapper)
2. running the **PEG parser** on the tokenized input, which also captures certain anchor tokens in the resulting syntax tree
3. using the anchor tokens to **inflate** the syntax tree into a proper CST

Co-authored-by: Benjamin Woodruff <github@benjam.info>
2021-12-21 18:14:39 +00:00
Zsolt Dollenstein
2cd43c4b78
disable setuptools local scheme when env var is set (#551) 2021-11-18 15:00:06 +00:00
Steven Troxler
69156c7775
Bump pyre-check to latest version (#516)
The current version of the pyre query api requires a running
watchman server, which has to be started independently.
2021-09-07 12:08:46 +01:00
Steven Troxler
5e1e3fe970
The ufmt tool combines usort and black with a consistent wrapper, (#515)
which ensures we won't have inconsistent black-vs-isort errors
going forward. We can always format by running `ufmt format .`
at the root, and check with `ufmt check .` in our CI actions.
2021-08-25 20:39:29 -04:00
Luke Petre
1c3a27bbd5
Add Github Actions and derive version from git tags (#471)
* Use setuptools-scm to derive the current version from git metadata

* Add Github Action equivalent to the current circleci tasks

* Run pyre integration test in GH action / tox
2021-08-10 15:01:16 +01:00
Jimmy Lai
7ca738bf39
Upgrade dev tools (Black/Flake8/isort) and read install requirements from requirements.txt (#380)
* Read install requirements from requirements.txt

* read extras_require from requirements-dev.txt

* add requirements-dev.txt to MANIFEST.in

* apply fixes for new version of Black and Flake8

* don't upgrade Pyre

* re-format
2020-08-31 10:44:55 -07:00
Tim Hatch
771d5e14b7
Include missing test data in install (#365) 2020-08-11 17:44:16 -07:00
Tim Hatch
dbcb5bed99
Improve default-version selection logic (#306)
* Add Python 3.9 to tox envlist

* Require newer typing_extensions for 3.9

For simplicity, use the new version in all cases.

* Improve default-version selection to work on 3.9

While were at it, improve the code to work with a likely 3.10 by
allowing multiple digits for minor version.
2020-06-10 10:29:58 -07:00
Jimmy Lai
dee174d5f8 [typing] add missing type annotations 2020-03-19 07:41:19 -07:00
Jimmy Lai
7a534cfa32 [pyre] use --preserve-pythonpath to enable Pyre to read from site-packages/ 2020-03-06 21:42:46 +00:00
Jimmy Lai
4944293506 add copyright header 2020-02-25 10:11:42 -08:00
Jennifer Taylor
f6a1c77b2a Add a --version flag to libcst.tool, single-source version. 2020-02-07 11:51:58 -08:00
Jennifer Taylor
3ec41e3a92 Bump LibCST to new release 0.3.1. 2020-02-06 13:12:50 -08:00
Jennifer Taylor
9bfc6fdd29 Fix dependencies in LibCST setup.py discovered when setting up LibCST from scratch. 2020-01-28 13:45:18 -08:00
Jennifer Taylor
acdda22b51 Bump LibCST to new release 0.3.0. 2020-01-17 11:38:06 -08:00
Jennifer Taylor
fdd5cbbfe6 Implement parsing of posonly param indicator ('/'). This brings us to full 3.8 compatibility. 2020-01-17 10:57:48 -08:00
Jennifer Taylor
744ca1e47d Bump LibCST to 0.2.7 in preparation for changing instagram source of truth. 2020-01-07 11:45:28 -08:00
Jimmy Lai
a1bd01990a bump LibCST version to 0.2.6 2020-01-02 10:08:33 -08:00
Jennifer Taylor
9c6ccbb80e Bump LibCST to 0.2.5. 2019-12-05 16:36:09 -08:00
Jennifer Taylor
652ddca974 Bump LibCST to 0.2.4. 2019-11-13 17:56:09 -08:00
Jennifer Taylor
ec7ee6f7d7 Bump LibCST to 0.2.3. 2019-11-12 10:58:28 -08:00
Jennifer Taylor
0391905bde Bump LibCST to 0.2.2. 2019-10-24 15:01:39 -07:00
Jimmy Lai
c88ff66aef bump version to 0.2.1 2019-10-14 10:30:58 -07:00
Jennifer Taylor
08b6657db2 Bump version to 0.2.0, update changelog. 2019-10-04 13:13:30 -07:00
Jennifer Taylor
3f5dc1e632 Bump version to 0.1.3. 2019-09-18 16:51:32 -07:00
Jimmy Lai
23b7b5ade2 support mypy using py.typed 2019-09-16 13:49:08 -07:00
Jennifer Taylor
e972a3c9b3 Remove parso as a dependency.
We've forked parso internally, so we no longer need a dependency on it. This
exposed an unused version info function that still referenced parso, so I
deleted it.
2019-09-12 14:09:00 -07:00
Jennifer Taylor
f9ff50047e Bump hypothesis/hypothesmith version now that https://github.com/Zac-HD/hypothesmith/issues/3 is resolved. 2019-09-10 16:57:16 -07:00
Jennifer Taylor
38d220d224 Bump version number to 0.1.2. 2019-08-29 14:25:37 -07:00
Zac Hatfield-Dodds
2c27c0862c Fuzz with Hypothesmith 2019-08-21 17:55:28 -07:00
Jennifer Taylor
941dee9977 Bump revision number to release 0.1.1 which corrects dependencies. 2019-08-20 15:53:16 -07:00
jimmylai
71ba5cc51d
update dependent package version in setup.py 2019-08-19 13:39:02 -07:00
jimmylai
d4dca1db5e
[CI] add test coverage run and codecov integration 2019-08-19 11:31:55 -07:00
Jennifer Taylor
5d1514e416 Bump version number for 0.1.dev8 release. 2019-08-12 17:27:22 -07:00
jimmylai
6138e74542
[document] add jupyter based tutorial page
* [document] add jupyter based tutorial page

* add return type and fix typos
2019-08-06 16:34:03 -07:00
jimmylai
04804d03af
improve setup.py to be ready for publishing package to pypi
* improve setup.py to be ready for publishing package to pypi

* remove dev from version
2019-08-06 16:09:47 -07:00
jimmylai
88064092af
[document] Use ReadTheDot Theme 2019-08-01 12:09:32 -07:00
jimmylai
c621875c81 use rst format for README 2019-07-23 16:10:03 -07:00
jimmylai
120cfa9229 add sphinx autodoc templates and docs CI job 2019-07-22 20:05:27 -07:00
jimmylai
4e14e66aa6 add missing flake8 dependency in requirements-dev.txt to fix lint CI job 2019-07-22 20:04:37 -07:00
Jimmy Lai
1a55071f47 remove unused import sys 2019-07-22 19:59:57 -07:00
Benjamin Woodruff
8fba418f2c Add runtime type validation support
This ports `CSTNode.validate_types_shallow` and
`CSTNode.validate_types_deep`, as well as `libcst._type_enforce` to the
open-source release.

These are useful if someone wants to use LibCST without a static type
checker.

These weren't originally included because `libcst._type_enforce` wasn't
3.7 compatible.
2019-07-22 19:53:49 -07:00