Skip to content

Commit

Permalink
[CI] Use the latest LibCST source code in Pyre check
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmylai committed Mar 11, 2020
1 parent c7d2679 commit accc06f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
11 changes: 11 additions & 0 deletions .circleci/.pyre_configuration
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"source_directories": [
"."
],
"search_path": [
"stubs", "/tmp/libcst-env/lib/python3.7/site-packages"
],
"exclude": [
".*/\\.tox/.*"
]
}
7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ jobs:
source /tmp/libcst-env/bin/activate
pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
pyre --preserve-pythonpath check
pip uninstall -y libcst
pip install -e .
cp .pyre_configuration .pyre_configuration.backup
cp .circleci/.pyre_configuration .
pyre check
PYTHONPATH=`pwd` python libcst/tests/test_pyre_integration.py
cp .pyre_configuration.backup .pyre_configuration # revert config change back before git diff check
git diff --exit-code # verify no generated changes
- save_cache:
key: pyre-v1-{{ checksum "tox.ini" }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements-dev.txt" }}-{{ checksum "setup.py" }}-{{ checksum ".circleci/config.yml" }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ docs/source/.ipynb_checkpoints/
build/
.coverage
.hypothesis/
.pyre_configuration
16 changes: 13 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,22 @@ this:
See the `unittest documentation <https://docs.python.org/3/library/unittest.html>`_
for more examples of how to run tests.

We use `Pyre <https://github.com/facebook/pyre-check>`_ for type-checking. To
verify types for the library, do the following in the root:
We use `Pyre <https://github.com/facebook/pyre-check>`_ for type-checking.

To set up pyre check environment:

1. Update config file ``.pyre_configuration`` and add your venv site-pacakges dir to "search_path". (e.g. add "/workspace/libcst-env/lib/python3.7/site-packages")
2. 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 --preserve-pythonpath check
pyre check
To generate documents, do the following in the root:

Expand Down

0 comments on commit accc06f

Please sign in to comment.