Skip to content
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

Add instruction for pip in the README #230

Merged
merged 3 commits into from
Aug 31, 2024
Merged
Changes from 1 commit
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
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ pip install git+https://git@github.com/wiseodd/asdl@asdfghjkl
For development purposes, e.g. if you would like to make contributions, follow
the following steps:

1. Install [`uv`](https://github.com/astral-sh/uv)
**With `uv`**

1. Install [`uv`](https://github.com/astral-sh/uv), e.g. `pip install --upgrade uv`
2. Then clone this repository and install the development dependencies:

```bash
Expand All @@ -81,11 +83,23 @@ uv sync --all-extras
3. `laplace-torch` is now available in editable mode, e.g. you can run:

```bash
uv run python example/regression_example.py
uv run python examples/regression_example.py

# Or, equivalently:
source .venv/bin/activate
python example/regression_example.py
python examples/regression_example.py
```

**With `pip`**

```bash
git clone git@github.com:aleximmer/Laplace.git

# Recommended to create a virtualenv before the following step
pip install -e ".[dev]"

# Run as usual, e.g.
python examples/regression_examples.py
```

> [!NOTE]
Expand Down Expand Up @@ -438,6 +452,8 @@ For example, currently the [`curvature.CurvlinopsInterface`](https://github.com/

The documentation is available [here](https://aleximmer.github.io/Laplace) or can be generated and/or viewed locally:

**With `uv`**

```bash
# assuming the repository was cloned
uv sync --all-extras
Expand All @@ -447,11 +463,22 @@ uv run bash update_docs.sh
uv run pdoc --http 0.0.0.0:8080 laplace --template-dir template
```

**With `pip`**

```bash
# assuming the repository was cloned
pip install -e ".[dev]"
# create docs and write to html
bash update_docs.sh
# .. or serve the docs directly
pdoc --http 0.0.0.0:8080 laplace --template-dir template
```

## Contributing

Pull requests are very welcome. Please follow these guidelines:

1. Install Laplace via `uv sync --all-extras` which will install `ruff` and all requirements necessary to run the tests and build the docs.
1. Follow the [development setup](#setup-dev-environment).
2. Use [ruff](https://github.com/astral-sh/ruff) as autoformatter. Please refer to the following [makefile](https://github.com/aleximmer/Laplace/blob/main/makefile) and run it via `make ruff`. Please note that the order of `ruff check --fix` and `ruff format` is important!
3. Also use [ruff](https://github.com/astral-sh/ruff) as linter. Please manually fix all linting errors/warnings before opening a pull request.
4. Fully document your changes in the form of Python docstrings, typehinting, and (if applicable) code/markdown examples in the `./examples` subdirectory.
Expand Down
Loading