Use pyre site-package feature (#589)

* Use pyre site-package feature
* Update readme, remove example
This commit is contained in:
Luke Petre 2022-01-07 07:34:50 -05:00 committed by GitHub
parent 2f75246c3a
commit 9f6ff017f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 39 deletions

View file

@ -77,19 +77,6 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install --upgrade --upgrade-strategy eager build -r requirements.txt -r requirements-dev.txt
- name: Get Python site-packages
id: python-info
run: |
echo "::set-output name=SITE_PACKAGES::$(python -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')"
- name: Configure Pyre
id: pyre_template
uses: chuhlomin/render-template@v1.2
with:
template: .github/workflows/.pyre_configuration.template
vars: |
python_site_packages: ${{ steps.python-info.outputs.SITE_PACKAGES }}
- name: Write Pyre Config
run: echo '${{ steps.pyre_template.outputs.result }}' > .pyre_configuration
- name: Make sure Pyre uses the working copy
run: pip install -e .
- run: pyre --version

1
.gitignore vendored
View file

@ -15,6 +15,5 @@ build/
libcst/_version.py
.coverage
.hypothesis/
.pyre_configuration
.python-version
target/

View file

@ -6,7 +6,7 @@
"."
],
"search_path": [
"stubs", "{{ .python_site_packages }}"
"stubs", {"site-package": "setuptools_rust"}
],
"workers": 3,
"strict": true

View file

@ -1,12 +0,0 @@
{
"source_directories": [
"."
],
"search_path": [
"stubs"
],
"exclude": [
".*/native/.*"
],
"strict": true
}

View file

@ -175,24 +175,19 @@ for more examples of how to run tests.
We use `Pyre <https://github.com/facebook/pyre-check>`_ for type-checking.
To set up pyre check environment:
1. Copy the example Pyre config: ``cp .pyre_configuration.example .pyre_configuration``.
2. In the config file, add your venv site-packages dir to "search_path". (e.g. add "/workspace/libcst-env/lib/python3.7/site-packages")
Note: venv dir must **not** be inside the libcst dir
3. Remove installed LibCST and install from the source code:
.. code-block:: shell
pip uninstall -y libcst
pip install -e .
To verify types for the library, do the following in the root:
.. code-block:: shell
pyre check
*Note*: You may need to remove installed LibCST and install from the source code prior to type checking:
.. code-block:: shell
pip uninstall -y libcst
pip install -e .
To generate documents, do the following in the root:
.. code-block:: shell