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 support for uv project management #1446

Closed
wants to merge 5 commits into from

Conversation

lamalex
Copy link
Contributor

@lamalex lamalex commented Sep 15, 2024

Adds support to python.nix to use uv sync when enabled and uv >= 0.4.4
uv 0.4.4 is the first version to respect UV_PROJECT_ENVIRONMENT which
allows uv to play nicely with the venv created by devenv (not .venv)

Adds an initUvScript if `uv.sync` is enabled.
Calls `uv sync` to install python packages as defined in pyproject.toml

fixes: cachix#1405
@domenkozar
Copy link
Member

Looks like a great start :) Thank you so much!

Could you also add a test to tests?

@lamalex
Copy link
Contributor Author

lamalex commented Sep 17, 2024

How do I generate docs so that check will pass?

@domenkozar
Copy link
Member

Error: Error: Pushing to https://github.com/lamalex/devenv
remote: Permission to lamalex/devenv.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/lamalex/devenv/': The requested URL returned error: 403

@sandydoo I think we've enabled this for PRs, but we'd have to target upstream branch for it to work.

@domenkozar
Copy link
Member

@lamalex

       error: at /run/github-runner/cachix-x86_64-linux/devenv/devenv/tests/python-uv-sync/devenv.nix:2:1:
            1| { pkgs, config, ... }:
            2| : let
             | ^
            3| pkgs-unstable = import inputs.nixpkgs-unstable { system = pkgs.stdenv.system; };

       error: syntax error, unexpected ':'

@domenkozar
Copy link
Member

I've rebased and cleaned up in 7df6f2b, but I'm seeing test fail:

~/dev/cachix/devenv/tests/python-uv-sync/directory ~/dev/cachix/devenv/tests/python-uv-sync
Using Python 3.11.8 interpreter at: /nix/store/nbiqypvcx2k9g8d7s4l0h3ym0hz8fa50-python3-3.11.8-env/bin/python3
Creating virtualenv at: /home/domen/dev/cachix/devenv/tests/python-uv-sync/.devenv/state/venv
error: Unable to find lockfile at `uv.lock`. To create a lockfile, run `uv lock` or `uv sync`.
uv sync failed. Run 'uv sync' manually.
~/dev/cachix/devenv/tests/python-uv-sync

@lamalex any idea what's going on?

@domenkozar
Copy link
Member

Seems like we need to commit the initial uv.lock.

I've merged this manually, thank you!

@domenkozar domenkozar closed this Sep 20, 2024
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.

2 participants