However, my attempts to modify this to produce a devShell with the contents of pyproject.tom/poetry.lock available in the environment have all been failures, typically of this kind:
Thanks @Nebucatnetzer , I cloned your project and was able to instantiate the environment. Your flake is the same as my first variations on the template in that I too added a mkPoetryEnv attribute to the overlay and then included that in the buildInputs of a devShell. This indicates there is something that upsets poetry2nix in the pyproject/lock. This was my hunch from the beginning, I was hoping the infinite recursion would be strongly diagnostic of something
In my experience, this kind of infinite recursion in poetry2nix happens when there is setuptools, setuptools-scm or pip is in poetry.lock.
After doing poetry add setuptools@^61.2.0 geopandas@^0.11.1 pandas@^1.4.3 shapely@^1.8.2 folium@^0.12.1 matplotlib@3.5.2 numpy@^1.23.1 openmatrix@^0.3.5.0 pyyaml@^6.0 dask@2022.9.2 distributed@2022.9.2 tqdm@^4.64.0 scipy@^1.9.1 ipfn@^1.4.4 pyarrow@^9.0.0 jupyter@^1.0.0 notebook@^6.4.12 ipykernel@^6.15.3 keplergl@^0.3.2 sklearn@^0.0 protobuf@3.20.0 matsim-tools@^0.0.14 pygeos@^0.13 dvc@^2.34.2 dvc-s3@^2.21.0, there is matplotlib that has dependency as setuptools-scm in poetry.lock.
One way to be sure that it is causing the infinite recursion is to remove all the setuptools-scm related line in the poetry.lock and check whether infinite recursion occurs. If you erase setuptools-scm in dependency of matplotlib and setuptools-scm itself with file/hash info in poetry.lock, infinite recursion would probably disappear.
Since it is nearly impossible to erase them every time you poetry add a package, try the following flake.nix. Currently this is the best solution I’ve found so far. Any other solution that’s not as dirty as mine would be appreciated!
@sepiabrown , this looks very promising, and I expect to find many uses for it in future, thank you.
When I run it I encounter
error: attribute 'python_selected' missing
I have performed a few variations on overriding the setuptoolspython with the effect of un-dodging the infinite recursion error . Have you any thoughts?
Ah yes, this is one off the variations I tried: remove the python attribute from setuptools and update python39 to python310 throughout. For me this yields error: infinite recursion encountered again. Might we now be in the situation where another package (not setuptools) is responsible for the infinite recursion? Are we looking for the situation where pyproject.toml specifies a package i and a package j, and package j itself also depends on i?
If you experiment with poetry.lock, you can find that dvc depends on dvc-http and dvc-http depends on dvc!
poetry.lock was reproducible on my machine, so poetry.lock is not damaged.
I don’t know how to resolve this kind of issue. Maybe make an issue to the upstream and change the below code which includes dvc under install_requires?
In the meantime, you would have to manually delete dvc = "*" in [package.dependencies] of dvc-http.
Without dvc in pyproject.toml, the project is free of infinite recursion. (But I haven’t check whether it builds to the end without error.)
Thanks @sepiabrown , the circular dvc/dvc-http dependency helps explain the infinite recursion and removing dvc-http's dvc = * line from the poetry.lock dodges the infinite recursion. Thanks also for your suggestion to resolve upstream. The demonstration of overridescope' was also very enlightening. I consider the original query resolved. I think the actual poetry project is still a ways from being materialised using poetry2nix but is closer.
Yeah, my build error tells me that isal(python-isal) needed by xopen needed by matsim-tools fails to build because libisal.a cannot be found.
In nixpkgs there is isa-l already packaged but it seems it does’t offer libisal.a (I haven’t checked thoroughly so I may be wrong). If that’s true, then libisal needs to be packaged in nixpkgs!
Containers are now working, however be advised that I hacked it really badly together.
There aren’t that many projects out there which combine, poetry2nix, django and containers.