Skip to content

Commit

Permalink
Python: Update dev setup readme (#6797)
Browse files Browse the repository at this point in the history
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
The DEV setup readme does not clearly outline which workspace and
formatter to use in VSCode. And some instructions also show
inconsistencies in the project folder structures.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
Update the README to make things more obvious and consistent.

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
  • Loading branch information
TaoChenOSU authored Jun 18, 2024
1 parent 0ed3cca commit ecb9ae5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions python/DEV_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This optional `env_file_path` parameter will allow pydantic settings to use the

If using the second method, we suggest adding a copy of the `.env` file under these folders:

- [python/tests](tests)
- [./tests](./tests)
- [./samples/getting_started](./samples/getting_started).

## System setup
Expand Down Expand Up @@ -139,19 +139,24 @@ poetry run pre-commit install

## VSCode Setup

Open the [workspace](https://code.visualstudio.com/docs/editor/workspaces) in VSCode.
> The Python workspace is the `./python` folder if you are at the root of the repository.

Open any of the `.py` files in the project and run the `Python: Select Interpreter`
command from the command palette. Make sure the virtual env (venv) created by
`poetry` is selected.
The python you're looking for should be under `~/.cache/pypoetry/virtualenvs/semantic-kernel-.../bin/python`.
If prompted, install `ruff` and `black` (these should have been installed as part of `poetry install`).
If prompted, install `ruff`. (It should have been installed as part of `poetry install`).
You also need to install the `ruff` extension in VSCode so that auto-formatting uses the `ruff` formatter on save.
Read more about the extension here: https://github.com/astral-sh/ruff-vscode
## Tests
You can run the unit tests under the [tests/unit](tests/unit/) folder.
```bash
cd python
poetry install
poetry run pytest tests/unit
```
Expand All @@ -162,15 +167,13 @@ Alternatively, you can run them using VSCode Tasks. Open the command palette
You can run the integration tests under the [tests/integration](tests/integration/) folder.
```bash
cd python
poetry install
poetry run pytest tests/integration
```
You can also run all the tests together under the [tests](tests/) folder.
```bash
cd python
poetry install
poetry run pytest tests
```
Expand Down Expand Up @@ -327,7 +330,6 @@ Ideally you should run these checks before committing any changes, use `poetry r
We try to maintain a high code coverage for the project. To run the code coverage on the unit tests, you can use the following command:

```bash
cd python
poetry run pytest --cov=semantic_kernel --cov-report=term-missing:skip-covered tests/unit/
```
or use the following task (using `Ctrl+Shift+P`):
Expand Down

0 comments on commit ecb9ae5

Please sign in to comment.