DavHau/mach-nix

Add other requirement formats

DavHau opened this issue · 4 comments

This ticket should track the general progress for adding additional requirement formats.

  • poetry (project.toml)
  • poetry (poetry.lock)
  • PEP 518
  • Pipenv

... Well I'm watching this one for sure!

We might want to use poetry2nix to parse poetry requirements.
Of course this raises the question, if mach-nix is still needed at all since poertry2nix is able to complete the build on its own.
But:

  • poetry2nix probably doesn't handle non-python dependencies as well as mach-nix. (It doesn't take advantage of nixpkgs)
  • it isn't able to automatically mix in extra packages into the environment
  • It probably wouldn't integrate well with some other mach-nix features which I'm not aware of right now.

It would be super great to support PEP-517/PEP-518 the way poetry2nix does - so one can develop a python project the usual python way, but add a flake.nix into the directory and get toolchain-level reproducibility and optimal docker images essentially for free


UPD: to clarify, at this moment running mach-nix.buildPythonPackage against a directory with poetry-based project does not work

An extractor for poetry could maybe look something (relatively straight forward) like the following:

{
  pyproject = builtins.fromTOML /path/to/pyproject.toml;
  pname = pyproject.tool.poetry.name;
  version = pyproject.tool.poetry.version;
  meta.description = pyproject.tool.poetry.description;
  meta.homepage = pyproject.tool.poetry.homepage;
  meta.license = pyproject.tool.poetry.license;
  requirements = map someFormatCoersionFunction pyproject.tool.poetry.dependencies;
}