Closed jab closed 1 year ago
It looks like the latest nixpkgs is making the test phase fail. I'll investigate the issue during the next days. As a workaround, you can try building the package without running the tests by making the following change:
diff --git a/default.nix b/default.nix
index 8a4f132..a6b6613 100644
--- a/default.nix
+++ b/default.nix
@@ -25,8 +25,7 @@ python3.pkgs.toPythonApplication (python3.pkgs.pynixify.overridePythonAttrs
checkInputs = drv.checkInputs ++ [ nix chosenNixfmt bats ];
checkPhase = ''
- ${if runMypy then "mypy pynixify/ tests/ acceptance_tests/" else ""}
- pytest tests/ -m 'not usesnix' # We can't run Nix inside Nix builds
+ true
'';
postInstall = ''
Thanks, with that workaround I was able to build pynixify and get a little farther. Now pynixify fails when I run it, as follows:
❯ pynixify --local bidict -r dev-deps/dev.txt
error: Unsupported system
(use '--show-trace' to show detailed location information)
Traceback (most recent call last):
File "/nix/store/4dw4mqplg5r8z41r0q6f59vjl69q7frj-python3.10-pynixify-0.1/bin/..pynixify-wrapped-wrapped", line 9, in <module>
sys.exit(main())
File "/nix/store/4dw4mqplg5r8z41r0q6f59vjl69q7frj-python3.10-pynixify-0.1/lib/python3.10/site-packages/pynixify/command.py", line 157, in main
asyncio.run(_main_async(
File "/nix/store/n3qask6wrby75704dz3vcwnd3f9vkab8-python3-3.10.9/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/nix/store/n3qask6wrby75704dz3vcwnd3f9vkab8-python3-3.10.9/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/nix/store/4dw4mqplg5r8z41r0q6f59vjl69q7frj-python3.10-pynixify-0.1/lib/python3.10/site-packages/pynixify/command.py", line 188, in _main_async
version_chooser: VersionChooser = await _build_version_chooser(
File "/nix/store/4dw4mqplg5r8z41r0q6f59vjl69q7frj-python3.10-pynixify-0.1/lib/python3.10/site-packages/pynixify/command.py", line 60, in _build_version_chooser
nixpkgs_data = NixpkgsData(await load_nixpkgs_data({}))
File "/nix/store/4dw4mqplg5r8z41r0q6f59vjl69q7frj-python3.10-pynixify-0.1/lib/python3.10/site-packages/pynixify/nixpkgs_sources.py", line 109, in load_nixpkgs_data
assert status == 0
AssertionError
Would you like me to open a separate issue for this? My ultimate goal here is to be able to use nix to enter an environment for local development of my Python library, https://github.com/jab/bidict. To do that, I thought I would try converting my pip-tools-based dependency specs into nix expressions via pynixify first.
Thanks again for your help with this.
If you're talking about this dev.txt file, it's likely that pynixify will fail for this usecase. Quoting pynixify's README:
Your requirements file shouldn't be the output of
pip freeze
because it has==
in all requirements. Therefore, it makes reusing Nixpkgs packages harder. You shouldn't treat your requirements file as a lockfile, but as an abstract definition indicating the minimum and maximum versions of each library. Keep in mind that you don't need a lockfile: you can just pin Nixpkgs to have something with the reproducibility of lockfiles. Or even better than it, since Nix also tracks the system dependencies of each library!
So I'd recommend to start with a requirements file without pinned versions (the project's pyproject.toml
could be a good starting point for determining the deps), and only add version markers if the chosen versions are incompatible with your project.
Closing the issue. Right now mypy will be used only on nixos-unstable, and just confirmed it builds fine with it after some fixes. Feel free to re-open if you have any related issue.
Just followed the instructions from https://github.com/cript0nauta/pynixify#installation in a freshly-installed nix-darwin environment and it failed with