From 9f6ff017f204a1dc305c5c4effa96f14038bbfb9 Mon Sep 17 00:00:00 2001 From: Luke Petre Date: Fri, 7 Jan 2022 07:34:50 -0500 Subject: [PATCH] Use pyre site-package feature (#589) * Use pyre site-package feature * Update readme, remove example --- .github/workflows/build.yml | 13 ------------- .gitignore | 1 - ..._configuration.template => .pyre_configuration | 2 +- .pyre_configuration.example | 12 ------------ README.rst | 15 +++++---------- 5 files changed, 6 insertions(+), 37 deletions(-) rename .github/workflows/.pyre_configuration.template => .pyre_configuration (75%) delete mode 100644 .pyre_configuration.example diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6ae3df773..683595603 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.gitignore b/.gitignore index dc2a1b309..9bb9370aa 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,5 @@ build/ libcst/_version.py .coverage .hypothesis/ -.pyre_configuration .python-version target/ diff --git a/.github/workflows/.pyre_configuration.template b/.pyre_configuration similarity index 75% rename from .github/workflows/.pyre_configuration.template rename to .pyre_configuration index b2ed4b8d6..ae37b031d 100644 --- a/.github/workflows/.pyre_configuration.template +++ b/.pyre_configuration @@ -6,7 +6,7 @@ "." ], "search_path": [ - "stubs", "{{ .python_site_packages }}" + "stubs", {"site-package": "setuptools_rust"} ], "workers": 3, "strict": true diff --git a/.pyre_configuration.example b/.pyre_configuration.example deleted file mode 100644 index 37d889282..000000000 --- a/.pyre_configuration.example +++ /dev/null @@ -1,12 +0,0 @@ -{ - "source_directories": [ - "." - ], - "search_path": [ - "stubs" - ], - "exclude": [ - ".*/native/.*" - ], - "strict": true -} diff --git a/README.rst b/README.rst index 755bec86b..9ac213c3d 100644 --- a/README.rst +++ b/README.rst @@ -175,23 +175,18 @@ for more examples of how to run tests. We use `Pyre `_ 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: +To verify types for the library, do the following in the root: .. code-block:: shell - pip uninstall -y libcst - pip install -e . + pyre check -To verify types for the library, do the following in the root: +*Note*: You may need to remove installed LibCST and install from the source code prior to type checking: .. code-block:: shell - pyre check + pip uninstall -y libcst + pip install -e . To generate documents, do the following in the root: