No description
Find a file
adisbladis 64f7a11c03
Merge pull request #51 from nix-community/toml-path-deps-hook
Convert TOML path dependency filtering to a setup hook
2020-02-23 15:56:27 +01:00
bin Add CLI to supplement git hashes 2019-12-28 21:45:51 +00:00
hooks Turn pyproject.toml patching into a hook 2020-02-23 14:37:01 +00:00
pkgs/poetry poetry: 1.0.2 -> 1.0.3 2020-02-01 21:56:43 +00:00
tests Comment pypy tests 2020-02-23 14:37:01 +00:00
.gitignore Gitignore result symlinks 2020-01-10 14:02:32 +00:00
.gitlab-ci.yml Add ability to skip tests through environment 2020-01-12 19:58:59 +00:00
check-fmt ci: add nix code formatting check 2019-12-13 18:35:18 +01:00
cli.nix nixpkgs-fmt fixup 2020-01-22 17:21:03 +00:00
default.nix Turn pyproject.toml patching into a hook 2020-02-23 14:37:01 +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 Turn pyproject.toml patching into a hook 2020-02-23 14:37:01 +00:00
Makefile Properly fetch sdists with extension 2019-06-24 17:01:27 +01:00
mk-poetry-dep.nix Turn pyproject.toml patching into a hook 2020-02-23 14:37:01 +00:00
overlay.nix Add overlay files 2019-11-19 16:34:50 +00:00
overrides.nix Add uvloop overrides for MacOS builds 2020-01-23 23:24:07 +00:00
pep425.nix Improve PEP425 support 2019-12-17 18:13:11 +01:00
pep508.nix Fix platform_python_implementation field 2020-01-22 18:33:24 +00:00
README.md Update README 2019-12-17 21:16:28 +01:00
semver.nix Add full operator support 2020-01-09 12:48:07 +00: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.