pip-uv
state: | released |
maintainers: | @YorickvP |
Introduction¶
We use uv
to resolve python dependencies instead of pip
. This is faster and has slightly more features.
Options¶
deps¶
All dependencies of the package. This option should be set by the "outer world" and can be used to inherit attributes from pkgs
or inputs
etc.
By separating the task of retrieving things from the outside world, it is ensured that the dependencies are overridable.
Nothing will stop users from adding nixpkgs
itself as a dependency, but this will make it very hard for the user of the package to override any dependencies, because they'd have to figure out a way to insert their changes into the Nixpkgs fixpoint. By adding specific attributes to deps
instead, the user has a realistic chance of overriding those dependencies.
So deps should be specific, but not overly specific. For instance, the caller shouldn't have to know the version of a dependency in order to override it. The name should suffice. (e.g. nix = nixVersions.nix_2_12
instead of inherit (nixVersions) nix_2_12
.
type | lazy attribute set of raw value |
source | dream2nix/modules/dream2nix/core/deps |
default | { }
|
example |
{nixpkgs, ...}: {
inherit (nixpkgs) stdenv;
inherit (nixpkgs.haskellPackages) pandoc;
}
|
lock¶
lock.content¶
The content of the lock file.
All fields declared via lock.fields
are contained pointing to their respective values.
type | anything |
source | dream2nix/modules/dream2nix/core/lock/interface.nix |
lock.extraScripts¶
Extra shell scripts to execute when nix run .#{package}.lock
is called.
This allows adding custom logic to the lock file generation.
type | list of path |
source | dream2nix/modules/dream2nix/core/lock/interface.nix |
default | [ ]
|
lock.fields¶
Fields of the lock file
type | attribute set of (submodule) |
source | dream2nix/modules/dream2nix/core/lock/interface.nix |
default | { }
|
example |
{
pname = true;
version = true;
}
|
<name>¶
lock.fields.<name>.default¶
The default value in case the lock file doesn't exist or doesn't yet contain the field.
type | null or anything |
source | dream2nix/modules/dream2nix/core/lock/interface.nix |
default | null
|
lock.fields.<name>.script¶
A script to refresh the value of this lock file field. The script should write the result as json file to $out.
type | path |
source | dream2nix/modules/dream2nix/core/lock/interface.nix |
lock.invalidationData¶
Pass any data that should invalidate the lock file when changed. This is useful for example when the lock file should be regenerated when the requirements change.
type | anything |
source | dream2nix/modules/dream2nix/core/lock/interface.nix |
default | { }
|
example |
{
pip = {
lockVersion = "2";
requirements = [
"requests"
"pillow"
];
};
}
|
lib¶
lock.lib.computeFODHash¶
Helper function to write the hash of a given FOD to $out.
type | function that evaluates to a(n) path (read only) |
source | dream2nix/modules/dream2nix/core/lock/interface.nix |
lock.refresh¶
Script to refresh the lock file
type | package (read only) |
source | dream2nix/modules/dream2nix/core/lock/interface.nix |
pip¶
pip.constraintsList¶
Constrain versions using the given requirements.
Constraints are requirements.txt
-like entries that only control the version of a requirement that's installed. However, including a package in constraints will not trigger the installation of that package.
type | list of string |
source | cognix/modules/pip-uv |
default | [ ]
|
pip.overridesList¶
Override versions using the given requirements files.
Overrides specify a specific version of a requirement to be installed, regardless of the requirements declared by any constituent package, and regardless of whether this would be considered an invalid resolution.
While constraints are additive, in that they're combined with the requirements of the constituent packages, overrides are absolute, in that they completely replace the requirements of the constituent packages.
type | list of string |
source | cognix/modules/pip-uv |
default | [ ]
|
uv¶
pip.uv.enable¶
use uv solver
type | boolean |
source | cognix/modules/pip-uv |
default | true
|
pip.uv.extraArgs¶
Extra arguments to pass the the uv
solver.
type | list of string |
source | cognix/modules/pip-uv |
default | [ ]
|