Commit graph

1043 commits

Author SHA1 Message Date
Zsolt Dollenstein
2feb8ea198
Replace custom _add_slots decorator with dataclasses slots=True
Dataclasses has a built-in slots generation feature since Python 3.10.
2024-03-03 10:57:41 +00:00
Zsolt Dollenstein
8a19d05538
remove comment 2024-02-03 12:30:39 +00:00
Zsolt Dollenstein
a4fb999774
ci: build linux-arm64 wheels using emulation (#1102)
Stop using self-hosted runner
2024-02-03 11:39:41 +00:00
Zsolt Dollenstein
e5cc07c342
ci: upgrade to cibuildwheel 2.16.5 (#1101)
This fixes wheel build failures on Windows.
2024-02-03 09:52:16 +00:00
Zsolt Dollenstein
68f98c676c
ci: various tweaks (#1100) 2024-02-03 09:40:04 +00:00
Zsolt Dollenstein
724026aa65
Remove reference to distutil (#1099)
Distutil has been removed in Python 3.12.

Tested by:
```
py -m libcst.tool codemod noop.NOOPCommand .\libcst\tool.py
Calculating full-repo metadata...
Executing codemod...
Finished codemodding 1 files!
 - Transformed 1 files successfully.
 - Skipped 0 files.
 - Failed to codemod 0 files.
 - 0 warnings were generated.
```
2024-02-02 20:58:56 +00:00
Zsolt Dollenstein
55f3e34dfc
Add roundtrip tests from Python (#1098)
Our current roundtrip tests only excerise the Rust codepaths. This PR runs the same roundtrip scenarios but from Python.
2024-02-02 20:50:07 +00:00
Zsolt Dollenstein
c854c986b6
Fix parsing list matchers without explicit brackets (#1097)
```
match a:
  case 1, 2: pass
```

This is parsed correctly by the grammar, but the default values of `MatchList.lbracket` and `MatchList.rbracket` are inconsistent between Python and Rust, causing the above snippet to round-trip (from Python) to:
```
match a:
  case [1, 2]: pass
```

Fixes #1096.
2024-02-02 20:49:25 +00:00
Amethyst Reese
a2a60c147c
Make readme example use python syntax highlighting (#1092) 2024-01-18 19:09:52 +00:00
Amethyst Reese
fad448eb81
Upgrade rust to version 1.70 in readthedocs config (#1091)
Readthedocs builds are currently failing because the libcst wheel fails
to build, hitting an error when trying to get rust dependencies:

```
running build_rust
  Updating crates.io index
error: failed to select a version for the requirement `regex = "=1.9.3"`
candidate versions found which didn't match: 1.8.4, 1.8.3, 1.8.2, ...
location searched: crates.io index
required by package `libcst v1.1.0 (/home/docs/checkouts/readthedocs.org/user_builds/libcst/checkouts/latest/native/libcst)`
error: `cargo metadata --manifest-path native/libcst/Cargo.toml --format-version 1` failed with code 101
```

Assuming this is related to current configuration requesting rust v1.55,
rather than 1.70 that is currently offered.
2024-01-16 21:15:47 +00:00
dependabot[bot]
f5fe4eb25a
Bump flake8 from 6.1.0 to 7.0.0 (#1088)
Bumps [flake8](https://github.com/pycqa/flake8) from 6.1.0 to 7.0.0.
- [Commits](https://github.com/pycqa/flake8/compare/6.1.0...7.0.0)

---
updated-dependencies:
- dependency-name: flake8
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-16 09:02:10 -08:00
dependabot[bot]
c5ef75d0c3
Bump jinja2 from 3.1.2 to 3.1.3 (#1090)
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.1.2...3.1.3)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-16 09:01:32 -08:00
dependabot[bot]
dfcba1ff03
Bump ufmt from 2.2.0 to 2.3.0 (#1047)
Bumps [ufmt](https://github.com/omnilib/ufmt) from 2.2.0 to 2.3.0.
- [Changelog](https://github.com/omnilib/ufmt/blob/main/CHANGELOG.md)
- [Commits](https://github.com/omnilib/ufmt/compare/v2.2.0...v2.3.0)

---
updated-dependencies:
- dependency-name: ufmt
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 14:06:02 +00:00
dependabot[bot]
266f531de1
Bump fixit from 2.0.0.post1 to 2.1.0 (#1087)
Bumps [fixit](https://github.com/Instagram/Fixit) from 2.0.0.post1 to 2.1.0.
- [Changelog](https://github.com/Instagram/Fixit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Instagram/Fixit/compare/v2.0.0.post1...v2.1.0)

---
updated-dependencies:
- dependency-name: fixit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 14:05:38 +00:00
dependabot[bot]
c6fa092565
Update maturin requirement from <0.16,>=0.8.3 to >=0.8.3,<1.5 (#1059)
Updates the requirements on [maturin](https://github.com/pyo3/maturin) to permit the latest version.
- [Release notes](https://github.com/pyo3/maturin/releases)
- [Changelog](https://github.com/PyO3/maturin/blob/main/Changelog.md)
- [Commits](https://github.com/pyo3/maturin/compare/v0.8.3...v1.4.0)

---
updated-dependencies:
- dependency-name: maturin
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-05 09:39:05 +00:00
Wilfred Hughes
c011a48a24
Allow Element::codegen to be used by external users (#1071)
The `Codegen` trait is `pub`, but users wanting to explicitly perform
codegen for `Element` had to copy-paste this part of the code.
2024-01-04 19:26:27 +00:00
Zsolt Dollenstein
a5f1f9a231
ci: use separate artifact names (#1085) 2024-01-04 12:42:15 +00:00
Alvaro Leiva geisse
1757e0f5b4
installing rustc/cargo for mybinder demo (#1083)
when we switch to the rust compiler by default, mybinder stop working, as reoported in https://github.com/Instagram/LibCST/issues/1054 this is because the binder docker image does not have a rust compiler or tools, this install them by using the apt.txt file

Co-authored-by: Alvaro Leiva Geisse <aleivag@meta.com>
2024-01-03 22:16:52 +00:00
anonymousdouble
dbbfe1e0b8
Update test_fix_pyre_directives.py (#1082)
* Update test_fix_pyre_directives.py

refactor with fstring to format string to make code more Pythonic.

* Update test_fix_pyre_directives.py

refactor with fstring to format string to make code more Pythonic.

* Update test_fix_pyre_directives.py

refactor with fstring to format string to make code more Pythonic.

* Update test_fix_pyre_directives.py

refactor with fstring to format string to make code more Pythonic.

* Update test_fix_pyre_directives.py

refactor with chain constant value assignment to make code more Pythonic

* Update test_fix_pyre_directives.py

refactor with chain constant value assignment to make code more Pythonic
2024-01-03 13:06:33 -08:00
Zsolt Dollenstein
30df6fcdab
remove 3.8 support (#1073)
This PR also starts using 3.12 properly in CI
2024-01-03 12:06:37 -08:00
dependabot[bot]
4b31d3db49
Bump actions/setup-python from 4 to 5 (#1060)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 10:10:35 -08:00
dependabot[bot]
dc329f29ac
Bump actions/upload-artifact from 3 to 4 (#1065)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 10:05:13 -08:00
dependabot[bot]
976b84c618
Bump actions/download-artifact from 3 to 4 (#1066)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 10:02:15 -08:00
dependabot[bot]
5a8650b92e
Bump black from 23.9.1 to 23.12.1 (#1077)
Bumps [black](https://github.com/psf/black) from 23.9.1 to 23.12.1.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/23.9.1...23.12.1)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 10:01:27 -08:00
Zsolt Dollenstein
43a27b1222
cI: remove rust cache (#1074) 2023-12-20 22:23:21 +00:00
Zsolt Dollenstein
ce5903f4cb
ci: update rust toolchain GHA (#1072)
`actions-rs` is unmaintained
2023-12-20 16:58:39 +00:00
David Tolnay
d97fb9be80
Update syn to v2 (#1064) 2023-12-20 15:53:54 +00:00
David Tolnay
52bbff6dfc
Set repository metadata entry for Rust crates (#1063) 2023-12-12 22:40:40 +00:00
dependabot[bot]
f8a9b80d9e
Bump rustix from 0.38.9 to 0.38.19 in /native (#1043)
Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.38.9 to 0.38.19.
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.9...v0.38.19)

---
updated-dependencies:
- dependency-name: rustix
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-18 15:07:17 -07:00
dependabot[bot]
9dd3ea7ec7
Bump pypa/cibuildwheel from 2.16.1 to 2.16.2 (#1041)
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.16.1 to 2.16.2.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.16.1...v2.16.2)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-09 11:14:31 +01:00
Zsolt Dollenstein
693c6dc947
upgrade flake8 (#1040) 2023-10-06 10:01:06 -07:00
Itamar Oren
88d0b36cdd
Update pyproject.toml for Python 3.12 support (#1038)
* Update pyproject.toml for Python 3.12 support

add 3.12 classifier and update description to correctly reflect supported Python versions

* Update pyproject.toml

make the stated parsable versions range consistent with the README
2023-10-05 20:36:12 -07:00
Kyle Into
83f0daed42
fix filepathprovider generic type (#1036)
* fix filepathprovider type

* remove extra import
2023-10-05 20:18:39 -07:00
Itamar Oren
19c2862ea3
Update README.rst (#1039)
update Python parseable versions range to include 3.12
2023-10-05 20:18:05 -07:00
Zsolt Dollenstein
8d4229d959
bump version to 1.1.0 (#1037) 2023-10-05 19:16:12 -07:00
Sergii Dymchenko
7ca5d7f173
Fix link in type_inference_provider.py (#1035)
Same change as https://github.com/Instagram/LibCST/pull/913, but in the docstring.
2023-10-05 15:46:25 -07:00
Zsolt Dollenstein
5df1569a40
Parse multiline expressions in f-strings (#1027) 2023-10-02 10:33:29 -07:00
Zsolt Dollenstein
738dc2f893
Upgrade pyre (#1032)
* Upgrade pyre

* regen fixtures
2023-10-02 09:43:17 -07:00
Zsolt Dollenstein
face393db0
eliminate relative paths from Cargo.toml (#1031)
* eliminate relative paths from Cargo.toml

* fix paths in LICENSE files
2023-10-02 08:05:33 -07:00
dependabot[bot]
74e8a0e7c0
Bump pypa/cibuildwheel from 2.16.0 to 2.16.1 (#1029)
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.16.0 to 2.16.1.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.16.0...v2.16.1)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 08:03:49 -07:00
Zsolt Dollenstein
03179b55eb
Parse arbitrarily nested f-strings (#1026) 2023-10-01 20:58:40 +01:00
André C. Silva
552af63d29
ScopeProvider: Record Access for Attributes and Decorators (#1019)
* Support for Attributes and Decorators in _NameUtil

* Replaced _NameUtil with get_full_name_for_node

* Added tests
2023-10-01 18:34:42 +01:00
dependabot[bot]
e1da64b53e
Bump ufmt from 2.1.0 to 2.2.0 (#1005)
Bumps [ufmt](https://github.com/omnilib/ufmt) from 2.1.0 to 2.2.0.
- [Changelog](https://github.com/omnilib/ufmt/blob/main/CHANGELOG.md)
- [Commits](https://github.com/omnilib/ufmt/compare/v2.1.0...v2.2.0)

---
updated-dependencies:
- dependency-name: ufmt
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-01 14:40:48 +01:00
André C. Silva
f81cc8d00e
AddImportsVisitor: add imports before the first non-import statement (#1024)
* AddImportsVisitor will now only add at the top of module

- Also added new tests to cover these cases

* Fixed an issue with from imports

* Added a couple tests for AddImportsVisitor

* Refactoring of GatherImportsVisitor

* Refactors, typos and typing changes
2023-10-01 14:38:33 +01:00
Zsolt Dollenstein
46060119a4
Scope provider changes for type annotations (#1014) 2023-09-30 11:16:27 +01:00
dependabot[bot]
5346bbfbdd
Bump Swatinem/rust-cache from 2.6.2 to 2.7.0 (#1020)
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.6.2 to 2.7.0.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.6.2...v2.7.0)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-30 10:20:56 +01:00
dependabot[bot]
a27c4c745c
Bump pypa/cibuildwheel from 2.15.0 to 2.16.0 (#1025)
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.15.0 to 2.16.0.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.15.0...v2.16.0)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-25 09:16:01 +01:00
Zsolt Dollenstein
37277e5fe7 add upper bound to pyo3 dependency 2023-09-16 04:02:14 -07:00
Zsolt Dollenstein
9d869b6639
scope_provider: Simplify parent resolution (#1013)
This PR introduces `Scope._next_visible_parent` which deduplicates much of the logic between `_contains_in_self_or_parent`, `_find_assignment_target_parent`, and `_getitem_from_self_or_parent`.

This will be helpful when implementing scope resolution for the future `AnnotationScope`.

There should be no functionality change.
2023-09-16 03:59:29 -07:00
dependabot[bot]
b509cc8b08
Bump black from 23.7.0 to 23.9.1 (#1017)
Bumps [black](https://github.com/psf/black) from 23.7.0 to 23.9.1.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/23.7.0...23.9.1)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-16 03:37:50 -07:00