- Clone the repo:
git clone [email protected]:python-lsp/python-lsp-server.git
- Create the virtual environment:
python -m venv .venv
- Activate:
source .venv/bin/activate
- Install an editable installation:
pip install -e .
- This will ensure you'll see your edits immediately without reinstalling the project
- Configure your editor to point the pylsp executable to the one in
.venv
Go to file pylsp/python_lsp.py
, function start_io_lang_server
,
and on the first line of the function, add some logging:
log.info("It works!")
Save the file, restart the LSP server and you should see the log line:
2023-10-12 16:46:38,320 CEST - INFO - pylsp._utils - It works!
Now the project is setup in a way you can quickly iterate change you want to add.
- Install runtime dependencies:
pip install .[all]
- Install test dependencies:
pip install .[test]
- Run
pytest
:pytest -v
- To run a specific test file, use
pytest test/test_utils.py
- To run a specific test function within a test file,
use
pytest test/test_utils.py::test_debounce
- To run tests matching a certain expression, use
pytest -k format
- To increase verbosity of pytest, use
pytest -v
orpytest -vv
- To enter a debugger on failed tests, use
pytest --pdb