No description
Find a file
2020-01-08 14:03:01 +00:00
bin Add CLI to supplement git hashes 2019-12-28 21:45:51 +00:00
pkgs/poetry poetry: Don't propagate anything via PYTHONPATH 2020-01-04 19:29:17 +00:00
tests Add support for eggs 2020-01-08 14:03:01 +00:00
.gitignore gitignore *.egg-info files 2019-12-27 19:17:35 +00:00
.gitlab-ci.yml Re-enable tests on 19.09 2020-01-01 18:11:14 +00:00
check-fmt ci: add nix code formatting check 2019-12-13 18:35:18 +01:00
cli.nix Add documentation output 2020-01-01 17:59:19 +00:00
default.nix nixpkgs-fmt all the things 2020-01-02 22:23:07 +00:00
extensions.json Add support for eggs 2020-01-08 14:03:01 +00:00
flake.lock Add nix flake 2019-11-19 20:00:38 +00:00
flake.nix nixpkgs-fmt: format all the nix code 2019-12-11 13:31:22 +01:00
generate.py Add support for eggs 2020-01-08 14:03:01 +00:00
lib.nix Remove hard-coded known build systems 2020-01-02 18:27:01 +00:00
Makefile Properly fetch sdists with extension 2019-06-24 17:01:27 +01:00
mk-poetry-dep.nix Add support for eggs 2020-01-08 14:03:01 +00:00
overlay.nix Add overlay files 2019-11-19 16:34:50 +00:00
overrides.nix overrides: Include cython for numpy 2020-01-08 14:00:41 +00:00
pep425.nix Improve PEP425 support 2019-12-17 18:13:11 +01:00
pep508.nix Fix stripStr on Darwin 2020-01-01 14:32:24 +00:00
pyproject-without-path.py Add support for local path dependencies 2019-12-29 13:20:35 +00:00
README.md Update README 2019-12-17 21:16:28 +01:00
semver.nix Refactoring 2019-12-16 15:03:49 +01:00
shell.nix ci: add nix code formatting check 2019-12-13 18:35:18 +01:00

poetry2nix

poetry2nix turns Poetry projects into Nix derivations without the need to actually write Nix expressions. It does so by parsing pyproject.toml and poetry.lock and converting them to Nix derivations on the fly.

Usage

poetry2nix has 2 main use-cases:

  • mkPoetryApplication: For building poetry based Python applications.
  • mkPoetryEnv: For creating a python environment with the dependencies of a poetry.lock file.

Notes

Whenever possible poetry2nix uses source archives to install Python dependencies. Some packages however only provide binaries in the form of .whl files. If no source archives are provided, poetry2nix tries to select an appropriate manylinux binary and automatically adds the required dependencies to the python package. Note that for manylinux packages to work you need to use very recent nixpkgs.

Examples

mkPoetryApplication

poetry2nix.mkPoetryApplication {
    src = lib.cleanSource ./.;
    pyproject = ./pyproject.toml;
    poetrylock = ./poetry.lock;
    python = python3;
}

See ./pkgs/poetry/default.nix for a working example.

mkPoetryEnv

poetry2nix.mkPoetryEnv {
    poetrylock = ./poetry.lock;
    python = python3;
}

The above expression returns a package with a python interpreter and all packages specified in the poetry.lock lock file. See ./tests/env/default.nix for a working example.

Contributing

Contributions to this project are welcome in the form of GitHub PRs. Please consider the following before creating PRs:

  • This project uses nixpkgs-fmt for fomatting the Nix code. You can use `nix-shell --run "nixpkgs-fmt ." to format everything.
  • If you are planning to make any considerable changes, you should first present your plans in a GitHub issue so it can be discussed.
  • If you add new features please consider adding tests.

License

poetry2nix is released under the terms of the MIT license.