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

Use uv project interface in template #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

blueraft
Copy link
Collaborator

@blueraft blueraft commented Sep 9, 2024

  • Blog post announcing uv project interface.
  • Guide on how to manage projects.

It's still compatible with standard pip if a user doesn't want to use uv.

Copy link
Contributor

@JosePizarro3 JosePizarro3 left a comment

Choose a reason for hiding this comment

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

So now we can use uv directly without creating a virtual environment? Do we need to do some previous step to do this (like for generating the uv.lock file or something)?

@@ -111,6 +138,11 @@ skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

[tool.uv]
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not always working in MacOS (I think depending on the version) and Windows, and in Ubuntu Bernadette was also having the same issue. I saw all of this during the hackathon last week

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Are you sure they were not using just pip here? This is just the equivalent to passing the argument in the CLI.

### Template update

We use cruft to update the project based on template changes. A `cruft-update.yml` is included in Github workflows to automatically check for updates and create pull requests to apply updates. Follow the [instructions](https://github.blog/changelog/2022-05-03-github-actions-prevent-github-actions-from-creating-and-approving-pull-requests/) on how to enable Github Actions to create pull requests.
We use cruft to update the project based on template changes. A `cruft-update.yml` is included in Github workflows to automatically check for updates and create pull requests to apply updates. Follow the [instructions](https://github.blog/changelog/2022-05-03-github-actions-prevent-github-actions-from-creating-and-approving-pull-requests/) on how to enable Github Actions to create pull requests.
Copy link
Contributor

Choose a reason for hiding this comment

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

This cruft update is never working (as the changes are a bit too hard to track), so I doubt anyone is ever going to accept these changes, and the email notifications are a bit annoying.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree, maybe we can just keep the local command and remove the CI step.

```sh
pip install --upgrade pip
```
We highly recommend using `uv` to manage the project. Consider installing `uv` by following the official installation [guide](https://docs.astral.sh/uv/getting-started/installation/#installing-uv).
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, do not send people people to read some other documentation in another package management. Can you add a better explanation + step-by-step as it was before? Think that people is not going to open that uv guide (not even me), so is uv replacing the virtual environment? Can you summarize how uv manages projects in 1 or 2 lines?

```sh
pip install uv
```
Read the short [guide](https://docs.astral.sh/uv/guides/projects/) on how to manage projects.
Copy link
Contributor

Choose a reason for hiding this comment

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

See previous comment.

```sh
uv pip install -e '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple
uv sync --extra-all
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, this is new and I wrote a comment before regarding the tool.uv part with the index-url. So maybe you can ask Bernadette if this works for her? And maybe others in the team?

@lauri-codes
Copy link
Collaborator

This should probably be discussed in the plugin meeting so that people can voice their opinion.

@blueraft
Copy link
Collaborator Author

So now we can use uv directly without creating a virtual environment? Do we need to do some previous step to do this

Yes, you won't have to manually manage the environment. uv sync/ uv run for the first time will also create the lock file for you. All invocations of uv run will automatically use the correct venv and your venv will be up to date with all of the changes in the pyproject.toml file.

This should probably be discussed in the plugin meeting so that people can voice their opinion.

Makes sense, I will create a short intro for this and how to develop multiple plugins locally. In the mean time maybe Chema and others can try it out and see if it's helpful.

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.

3 participants