Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .run/commands/pytest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ command_pytest() {
fi

if [ $coverage == "yes" ]; then
run_command uvrun coverage run -m pytest --testdox --force-testdox $color $tests
run_command uvrun coverage report
run_command uvrun pytest --cov=. --testdox --force-testdox $color $tests
run_command uvrun coverage lcov -o .coverage.lcov
if [ $html == "yes" ]; then
run_command uvrun coverage html -d .htmlcov
Expand Down
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debug Tests",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"purpose": ["debug-test"],
"console": "integratedTerminal",
"justMyCode": false
}
]
}
52 changes: 52 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"python.testing.pytestArgs": [
"--testdox",
"--force-testdox",
"src/tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.rulers": [132]
},
"mypy-type-checker.importStrategy": "fromEnvironment",
"files.exclude": {
"LICENSE": true,
"NOTICE": true,
"PyPI.md": true,
"SECURITY.md": true,
"build": true,
"dist": true,
"docs/.gitignore": true,
"docs/.sphinxignore": true,
"docs/_build": true,
"docs/_static": true,
"docs/_themes": true,
"docs/make.bat": true,
"docs/Makefile": true,
"out": true,
"run": true,
"uv.lock": true,
".coverage": true,
".coverage.lcov": true,
".coveragerc": true,
".gitattributes": true,
".github": true,
".gitignore": true,
".htmlcov": true,
".idea": true,
".mypy_cache": true,
".pre-commit-config.yaml": true,
".pytest_cache": true,
".python-version": true,
".readthedocs.yaml": true,
".ruff_cache": true,
".run": true,
".tabignore": true,
".venv": true,
"**/__pycache__": true
}
}
4 changes: 3 additions & 1 deletion Changelog
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Version 0.3.1 unreleased

* Fix windows commands for external tools.
* Fix windows commands for external tools with PyCharm.
* Fix Sphinx autoapi to generate docs for source, not tests.
* Add support for Visual Studio Code as an IDE.
* Use pytest-cov for test coverage, for more consistency.

Version 0.3.0 24 Sep 2025

Expand Down
65 changes: 57 additions & 8 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,67 @@ test with a different version of Python temporarily, set $UV_PYTHON in your
shell, and execute 'run install'. Make sure to unset and reinstall when done.
```

## Integration with PyCharm
## Integration with Visual Studio Code

Visual Studio Code does a good job of separating user preferences from
workspace (or project) preferences, so workspace preferences are checked
into `.vscode/settings.json`. The only thing you really need to configure
is the interpreter.

### Prerequisites

Before going any further, make sure sure that you have installed UV and have a
working bash shell. Then, run the suite and confirm that everything is working:

```
./run suite
```

### Open the Project

Currently, I use [PyCharm Community Edition](https://www.jetbrains.com/pycharm/download) as
my day-to-day IDE. By integrating the `run` script to execute MyPy and Ruff,
most everything important that can be done from a shell environment can also be
done right in PyCharm.
Once you have a working shell development environment, open the `uci-parse`
directory in the IDE (i.e. `code .`).

### Interpreter

Go to the command palette and search for `interpreter`. Choose **Python:
Select Interpreter**, then select the interpreter executable in the workspace.
This will be `.venv\Scripts\python.exe` on Windows, or `.venv/bin/python` on
Linux or MacOS.

### Running Unit Tests

Project configuration in `.vscode/settings.json` should configure the tests
properly. You can right click on `src/tests` in the explorer and run tests
from there, or do something similar for individual directories or `.py` files.
Workspace configuration includes a `launch.json` that should allow you to
run unit tests in the debugger.

### Plugins

Workspace configuration in `.vscode/settings.json` assumes that you have installed
the following plugins:

- [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
- [MyPy Type Checker](https://marketplace.visualstudio.com/items?itemName=ms-python.mypy-type-checker)
- [Ruff](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff)

The Ruff and MyPy linters will run automatically on any file that you open,
while you are editing the file. Language errors and linter warnings all show
up in the **Problems** view.

Ruff is set up as the default workspace formatter for `[python]` code. If you
want, you can configure Ruff to format code and optimize imports on save, or
you can run those actions manually. (For instance, on Windows **SHIFT-ALT-F**
will format code using Ruff, and **SHIFT-ALT-O** will organize imports.)

## Integration with PyCharm

PyCharm offers a good developer experience. However, the underlying configuration
on disk mixes together project policy (i.e. preferences about which test runner to
use) with system-specific settings (such as the name and version of the active Python
interpreter). This makes it impossible to commit complete PyCharm configuration
to the Git repository. Instead, the repository contains partial configuration, and
use) with system-specific settings (such as the name and version of the active Python
interpreter). This makes it impossible to commit complete PyCharm configuration
to the Git repository. Instead, the repository contains partial configuration, and
there are instructions below about how to manually configure the remaining items.

### Prerequisites
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dev = [
"ruff (>=0.12.10,<1.0.0)",
"pytest (>=8.0.2,<9.0.0)",
"pytest-testdox (>=3.1.0,<4.0.0)",
"coverage (>=7.4.4,<8.0.0)",
"pytest-cov (>=7.1.0,<8.0.0)",
"prek (>=0.2.1,<1.0.0)",
"mypy (>=1.6.0,<2.0.0)",
"colorama (>=0.4.6,<1.0.0)",
Expand Down Expand Up @@ -84,7 +84,8 @@ source = [ "src/uciparse" ]

[tool.coverage.report]
show_missing = false
precision = 1
precision = 0
omit = [ "src/tests/*" ]

[tool.pytest.ini_options]
filterwarnings = [
Expand Down Expand Up @@ -209,4 +210,4 @@ warn_unreachable = true
[[tool.mypy.overrides]]
module = "tests.*"
check_untyped_defs = false
allow_untyped_defs = true
disallow_untyped_defs = false
Loading
Loading