dream2nix
dream2nix copied to clipboard
"error: attribute 'name' missing" from the Python documentation
following the documentation page, my flake file
{
inputs = {
dream2nix.url = "github:nix-community/dream2nix";
};
outputs = inp:
inp.dream2nix.lib.makeFlakeOutputs {
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = ./.;
projects = ./pyproject.toml;
};
}
gives this error
error: attribute 'name' missing
at /nix/store/49wz7m3jxvvczxnz0li4fdam6bb1ckf6-source/src/modules/functions.discoverers/implementation.nix:106:46:
105| dlib.sanitizeRelativePath
106| "${config.dream2nixConfig.packagesDir}/${rootProject.name}/${project.relPath or ""}/dream-lock.json";
| ^
107|
With the (wip) poetry translator, the rootProject name should be taken from your pyproject.toml. Is
[tool.poetry]
name = "your-package"
defined there?
(we should probably default to the directories name if not defined)
hi @phaer ,
Yes, I have name defined under [tool.poetry].
I got the same error when trying the following pyproject.toml,
[project]
name = "titanic_ml"
description = "titanic_ml example package"
version = "0.1.0"
authors = [
{ name = "Niels Zeilemaker", email = "[email protected]" }
]
dependencies = [
"pyspark[ml]",
"sklearn"
]
[project.optional-dependencies]
dev = [
"tox",
"pre-commit",
"bump2version"
]
[build-system]
build-backend = "flit_core.buildapi"
requires = ["flit_core >=3.2,<4"]
Source: https://godatadriven.com/blog/minimal-pyproject-toml-example/
The pyproject.toml of the python project is not a valid value for the projects field.
Please use a dream2nix project description there.
nix run github:nix-community/dream2nix#detect-projects . > projects.toml should work for python as well as far as I understand.
The
pyproject.tomlof the python project is not a valid value for theprojectsfield.Please use a dream2nix project description there.
nix run github:nix-community/dream2nix#detect-projects . > projects.tomlshould work for python as well as far as I understand.
I see.
My challenge is that I want to use Nix in a non-intrusive way because I need to collaborate with people who don't use Nix.
Is it possible to anchor to requirements.txt instead of projects.toml?
Not sure what you mean by "anchor"…
Though as I already said in the chat today, for simple code contributions in a non-nix world, a simply mkShell (not even flake based!) providing a python close to the projects main version as well as pip and a venv, or simply running poetry "imperatively" worked well for me.
There is really no need to go through most of the packaging related woes, if you just want to contribute within a non-nix world.
Depending on the details, you might need to re-install your venv every couple of GCs, though you will get your work/contributions done.