Skip to content

Experiment with uv #90

Open
Open

Description

@colindean

uv is fast rising in popularity. It's written by Astral, the same folks behind ruff.

It does everything that Poetry does when combined with pyenv for Python installation, although its Python or even pyenv's may not be suitable for production use.

This experimentation should try swapping out poetry + pyenv in the Makefile to see what changes would be necessary.

I would not consider a wholesale switch until uv is 1.0.0, at which time I'd consider it with the values of

  • first-time setup performance

  • package installation performance (cold cache)

  • package update performance (hot cache)

  • availability of tooling replacements, e.g. diff-poetry-lockfile in our GitHub workflows

    # This will post a comment on PRs when poetry.lock changes
    - name: Diff poetry.lock
    uses: nborrmann/diff-poetry-lock@c0afd3666864cec339f03ee5c5cf9cb671780c12

  • minimization of helper tasks e.g. poetry-venv-implode.

    make-python-devex/Makefile

    Lines 314 to 316 in 669a039

    .PHONY: poetry-implode-venv
    poetry-implode-venv: ## Destroys the Poetry-managed virtualenv
    sleep 2 && rm -rf $$($(POETRY) env info --path)

  • lockfile improvements (e.g. standardization track vs bespoke, diff-able, etc.)

  • others TBD

Activity

  1. lucabotti commented on Dec 26, 2024

    @lucabotti

    Initial setup would reduce to uv installation as the only real dependency for the makefile (could be the init target).
    After that, the pyproject.toml would be the only driver, given uv capability to install tools and python versions.

    For the comment about uv python and production use - given the recent move of python build standalone (https://astral.sh/blog/python-build-standalone) , I tried to analyse this comment better. Also some comments from Python bytes clarified the situation, and this is not really the case - python build standalone removes some dependencies from the underlying OS and, in my humble opinion, could be better isolated (yes, in docker also) for production use.

  2. lucabotti commented on Dec 26, 2024

    @lucabotti

    Additionally, check uv-migrator for migration of pyproject.toml

  3. colindean commented on Dec 27, 2024

    @colindean
    ContributorAuthor

    Thank you for the input! This will be useful when undertaking this exploration.

  4. lucabotti commented on Dec 27, 2024

    @lucabotti

    @colindean I am tempted to fork and submit a pull request, but my use case is different - I am Linux based, and checking the makefile your specific needs (macos, arm, data science) emerge, while I am more oriented to generic Python development. Not sure to be able to grant the specific needs - eg compilation flags - of your use case.

  5. colindean commented on Feb 17, 2025

    @colindean
    ContributorAuthor

    Solid analysis and links to current ecosystem blockers in this: johnthagen/python-blueprint#238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions