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 and pixi. #464

Merged
merged 8 commits into from
Oct 22, 2024
Merged

Add uv and pixi. #464

merged 8 commits into from
Oct 22, 2024

Conversation

samcunliffe
Copy link
Member

Resolves #419.

Notably not done, is that I've not updated the tutorial.md to use uv instead of Anaconda. I'd need to use a Windows machine to test the instructions before I'd feel confident changing the tutorial.

@samcunliffe samcunliffe added enhancement New feature or request website Related to https://github-pages.arc.ucl.ac.uk/python-tooling labels Oct 22, 2024
@samcunliffe samcunliffe requested review from paddyroddy and a team October 22, 2024 10:22
@samcunliffe samcunliffe self-assigned this Oct 22, 2024
@samcunliffe
Copy link
Member Author

@dstansby I thought you were on holiday!
Saw some recent pushes, so take the liberty of asking for review.... 🙏

@dstansby
Copy link
Member

@dstansby I thought you were on holiday!

🙈 🙉 🙊

Copy link
Collaborator

@matt-graham matt-graham left a comment

Choose a reason for hiding this comment

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

Other than minor typo fix looks good to me! Based on in-person conversation about uvx / uv tool install versus current solution, I think my comment below may be better dealt with in a separate future pull-request.

README.md Outdated
Comment on lines 76 to 82
1. Install [cookiecutter] in a `uv venv` or `conda` environment (commented lines for
`uv venv` example).

```
# conda create --channel conda-forge --name new-env-name
# conda activate new-env-name
# conda install pip
pip install cookiecutter
# uv venv # creates a .venv directory wherever you are
# source ./.venv/bin/activate
uv pip install cookiecutter
Copy link
Collaborator

Choose a reason for hiding this comment

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

As an alternative to installing in a (project specific) uv virtual environment we could recommend using the uv tools feature. Equivalent would then be something like

uv tool install cookiecutter

which will install cookiecutter in an isolated virtual environment and set up so cookiecutter is added to path.

Alternatively we could recommend using uvx to install and run directly in a temporary virtual environment

uvx cookiecutter gh:ucl-arc/python-tooling

This appears to be fairly minimal overhead (reports 13ms for installing packages in temporary virtual environment in my local system so no noticeable lag).

Problem with the latter is it then makes it difficult to keep instructions generic across different package manager / virtual environment solutions.

Copy link
Member Author

Choose a reason for hiding this comment

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

A bit of a rewording of the whole instructions then.

How about just laying out a few options in prose (doing away with step numbers)...

If you use [`uv`](LINK) you can use our template with the following one-liner
```sh
uvx cookiecutter gh:ucl-arc/python-tooling
```

You could also [install cookiecutter]() system-wide if you're likely to want to use cookiecutter again.
We like installing it as a [uv tool](LINKTOUVTOOLSDOCS)
```
uv tool install cookiecutter
cookiecutter gh:ucl-arc/python-tooling
```

docs/pages/virtual.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Co-authored-by: Sam Cunliffe <[email protected]>
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Member

@paddyroddy paddyroddy left a comment

Choose a reason for hiding this comment

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

A wonderful fruitful (🫐) discussion was had

@samcunliffe
Copy link
Member Author

think my comment below may be better dealt with in a separate future pull-request.

Sure! Though I think worth tackling.

Co-authored-by: Matt Graham <[email protected]>
@samcunliffe samcunliffe enabled auto-merge (squash) October 22, 2024 11:19
@paddyroddy
Copy link
Member

pre-commit.ci autofix

@samcunliffe samcunliffe merged commit e309826 into main Oct 22, 2024
15 checks passed
samcunliffe added a commit that referenced this pull request Nov 4, 2024
I've attempted to simplify the user-facing quick-start instructions. Not
a huge fan of enumerated instructions and the optional (but cool)
one-liner it doesn't really fit in 1. 2. 3....

Also it's a bit overkill to have a venv/conda environment just for
cookiecutter itself. The cookiecutter docs recommend `pipx install`. I
claim that we want to encourage `uvx` because it's fast and cool 😎 .

I've spent a bit of effort trying to be clear but comments on clarity
etc are very welcome.

I also moved and merged the dev instructions into CONTRIBUTING so README
is _**just**_ user-facing. And CONTRIBUTING is just dev.

This addresses
- #466 

And two comments
-
#464 (comment)
-
#419 (comment)

---------

Co-authored-by: David Stansby <[email protected]>
Co-authored-by: Patrick J. Roddy <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request website Related to https://github-pages.arc.ucl.ac.uk/python-tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discuss uv and add it to the website.
4 participants