Setup development environment#
We use uv to manage our development environment. Please make sure you have it installed before proceeding.
Clone the repository
git clone https://github.com/rendeirolab/lazyslide.git
# or
gh repo clone rendeirolab/lazyslide
Checkout to a new branch
Please replace new-feature with a meaningful name for your branch.
git checkout -b new-feature
Sync development environment
uv sync
Install pre-commit hooks
uv run prek install
We use prek to run code formatting and linting checks before each commit.
Start a Python session
IPython
uv run --with ipython ipython
Jupyter
uv run --with jupyter jupyter lab
# With extensions
uv run --with jupyter --with dask-labextension jupyter lab
VS Code/PyCharm If you run in VS Code or PyCharm, you don’t need to do anything else.
Code style#
The configuration is defined in pyproject.toml and enforced through pre-commit hooks.
To format code
uv run task fmt
# or
ruff format docs/source src/lazyslide tests
Testing#
LazySlide uses pytest for testing. Tests are located in the tests directory.
To run all tests
uv run task test
To run a specific test file
uv run python -m pytest tests/test_example.py
When adding new tests:
Create a new file in the
testsdirectory with a name starting withtest_*.Import pytest and the module you want to test.
Write test functions with names starting with
test_*.Use assertions to verify expected behavior.
Documentation#
Documentation is built using Sphinx and is located in the docs directory.
To build the documentation
# Build doc with cache
uv run task doc-build
# Fresh build
uv run task doc-clean-build
To serve the documentation locally
uv run task doc-serve
This will start a local server at http://localhost:8000.
Documentation is written in reStructuredText (.rst) and Jupyter notebooks (.ipynb) using the myst-nb extension.
Submitting changes#
Commit your changes and push them to your branch.
Create a pull request on GitHub.
Ensure all CI checks pass.
Wait for a review from a maintainer.