-
Notifications
You must be signed in to change notification settings - Fork 219
Add contributing guide to setup dev environment #470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9e57805
Add contributing guide to setup dev environment
staticf0x a605db2
Update CONTRIBUTING.md
staticf0x b9cbb89
Edits from review
staticf0x 295d2ff
Remove editor configuration
staticf0x a19fadc
Apply suggestions from code review
staticf0x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Setup the environment | ||
|
||
1. Clone the repo: `git clone git@github.com:python-lsp/python-lsp-server.git` | ||
2. Create the virtual environment: `python3 -m venv .venv` | ||
3. Activate: `source .venv/bin/activate` | ||
4. Install an editable installation: `pip3 install -e .` | ||
staticf0x marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- This will ensure you'll see your edits immediately without reinstalling the project | ||
5. Configure your editor to point the pylsp executable to the one in `.venv` | ||
|
||
## Trying out if it works | ||
|
||
Go to file `pylsp/python_lsp.py`, function `start_io_lang_server`, | ||
and on the first line of the function, add some logging: | ||
|
||
```py | ||
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. | ||
|
||
# Running tests | ||
|
||
1. Install runtime dependencies: `pip3 install .[all]` | ||
2. Install test dependencies: `pip3 install .[test]` | ||
staticf0x marked this conversation as resolved.
Show resolved
Hide resolved
|
||
3. Run `pytest`: `pytest -v` | ||
|
||
## Useful pytest options | ||
|
||
- 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` or `pytest -vv` | ||
- To enter a debugger on failed tests, use `pytest --pdb` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.