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 uv support #1518

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add uv support #1518

wants to merge 3 commits into from

Conversation

abelaba
Copy link
Contributor

@abelaba abelaba commented Mar 21, 2025

This PR updates the documentation and readme file to support working with uv.
Fixes #1401

Bullet points from the parent issue

  • figuring out what options there, e.g., how we need to update out pyproject.toml
    • I haven't updated the pyproject.toml file. The project works with uv with the current configuration.
  • find out whether we can speed up / improve out build process via uv (https://github.com/sbi-dev/sbi/actions/runs/10702924386)
    • The current build process is configured with uv.
  • adapt the readme and other installation instructions on how to use sbi via uv
    • I have updated the readme and installation instructions.

Copy link

codecov bot commented Mar 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.33%. Comparing base (b5b4790) to head (b01cf64).
Report is 9 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1518       +/-   ##
===========================================
- Coverage   89.70%   79.33%   -10.38%     
===========================================
  Files         122      125        +3     
  Lines        9394     9808      +414     
===========================================
- Hits         8427     7781      -646     
- Misses        967     2027     +1060     
Flag Coverage Δ
unittests 79.33% <ø> (-10.38%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@janfb janfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thanks @abelaba !

I added a couple of comments, some of them are questions for clarification, so it's all open for discussion.

Comment on lines +75 to +89
```bash
uv venv
```

Then from `sbi` folder activate the virtual enviroment by running:

- For `macOS` or `Linux` users
```bash
source .venv/bin/activate
```

- For `Windows` users
```bash
.venv\Scripts\activate
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could be missing something, but wouldn't the user need to run something like uv add sbi?
or how would sbi be installed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is for creating and activating the virtual environment only.

Comment on lines +77 to +91
```bash
uv venv
```

Then from `sbi` folder activate the virtual enviroment by running:

- For `macOS` or `Linux` users
```bash
source .venv/bin/activate
```

- For `Windows` users
```bash
.venv\Scripts\activate
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are in the developer setting, I suggest one would need to something like:

  • cd sbi
  • uv init
  • uv sync --all-extras or uv sync --extra dev

and this would install all dependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I didn't add the cd sbi command as contributors would already be in the sbi folder on Step 3.
  • The uv init command is used for creating a new project. Running that command gives the following error.
    error: Project is already initialized in '...\sbi' ('pyproject.toml\' file exists)
  • I was following the pip interface and instead of the uv sync command I was using the uv venv command which creates the virtual environment.

Comment on lines +109 to +111
```bash
uv pip install -e ".[dev]"
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you are using the uv-pip interface here. hm, not sure. I think it would be better to explicitly use uv (the interface to pip is just for convenience).

see comment above, which actually relates to this part here.

Copy link
Contributor Author

@abelaba abelaba Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all the comments. Okay, I will update the documentation to use uv explicitly instead of the pip interface.

Comment on lines +140 to +143
```bash
uv pip install pre-commit
pre-commit install
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think pre-commit should be included in the uv sync --all-extras because it is listed in the dev dependencies. Thus, just pre-commit install should suffice here. but please test it locally.

If you are using [`uv`](http://docs.astral.sh/uv/) you can install the documentation dependencies using:

```bash
uv pip install -e ".[doc]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be uv sync --extra doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

adapt pyproject.toml and readme / installation instructions to work with uv
2 participants