cript0nauta / pynixify

Nix expression generator for Python projects
GNU General Public License v3.0
66 stars 11 forks source link

pynixify.exceptions.NoMatchingVersionFound: black overpy2 #34

Closed InLaw closed 4 years ago

InLaw commented 4 years ago

there are pypi packages not known?

e.g.


Traceback (most recent call last):
  File "/nix/store/s7jbqin95y5af68y3jc7qz0lmj3r3wbm-python3.7-pynixify-0.1/lib/python3.7/site-packages/pynixify/version_chooser.py", line 81, in require
    pkg = self._local_packages[canonicalize_name(r.name)]
KeyError: 'black'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/s7jbqin95y5af68y3jc7qz0lmj3r3wbm-python3.7-pynixify-0.1/bin/..pynixify-wrapped-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/s7jbqin95y5af68y3jc7qz0lmj3r3wbm-python3.7-pynixify-0.1/lib/python3.7/site-packages/pynixify/command.py", line 159, in main
    max_jobs=args.max_jobs,
  File "/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
    return future.result()
  File "/nix/store/s7jbqin95y5af68y3jc7qz0lmj3r3wbm-python3.7-pynixify-0.1/lib/python3.7/site-packages/pynixify/command.py", line 197, in _main_async
    for req in all_requirements
  File "/nix/store/s7jbqin95y5af68y3jc7qz0lmj3r3wbm-python3.7-pynixify-0.1/lib/python3.7/site-packages/pynixify/version_chooser.py", line 100, in require
    raise NoMatchingVersionFound(str(r))
pynixify.exceptions.NoMatchingVersionFound: black

if I add overpy2 to the packages it results in :

/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/asyncio/unix_events.py:878: RuntimeWarning: A loop is being detached from a child watcher with pending handlers
  RuntimeWarning)
Traceback (most recent call last):
  File "/nix/store/s7jbqin95y5af68y3jc7qz0lmj3r3wbm-python3.7-pynixify-0.1/lib/python3.7/site-packages/pynixify/version_chooser.py", line 81, in require
    pkg = self._local_packages[canonicalize_name(r.name)]
KeyError: 'overpy2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/s7jbqin95y5af68y3jc7qz0lmj3r3wbm-python3.7-pynixify-0.1/bin/..pynixify-wrapped-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/s7jbqin95y5af68y3jc7qz0lmj3r3wbm-python3.7-pynixify-0.1/lib/python3.7/site-packages/pynixify/command.py", line 159, in main
    max_jobs=args.max_jobs,
  File "/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
    return future.result()
  File "/nix/store/s7jbqin95y5af68y3jc7qz0lmj3r3wbm-python3.7-pynixify-0.1/lib/python3.7/site-packages/pynixify/command.py", line 197, in _main_async
    for req in all_requirements
  File "/nix/store/s7jbqin95y5af68y3jc7qz0lmj3r3wbm-python3.7-pynixify-0.1/lib/python3.7/site-packages/pynixify/version_chooser.py", line 100, in require
    raise NoMatchingVersionFound(str(r))
pynixify.exceptions.NoMatchingVersionFound: overpy2==0.4.2
cript0nauta commented 4 years ago

In the case of black, the tool hit an interesting corner case: the version of black included in nixpkgs is 19.10b0. The tool isn't considering the case where nixpkgs packages have pre-release versions, so it's failing unexpectedly. I'll prepare a fix soon. Meanwhile, you can be explicit in the black requirement to indicate you want the pre-release. Using black==19.10.b0 in the requirement instead of just black works ok.

With overpy2, the problem is caused by an upstream issue. The package maintaners only uploaded a wheel for it: https://pypi.org/project/overpy2/0.4.2/#files. pynixify expects a .tar.gz source distribution of the packages to be available. The solution to this is to request the overpy2 maintainers to build the tar.gz with python setup.py sdist and upload it to PyPI. Wheel support might be available in future releases of pynixify, but just for performance reasons, not to address missing .tar.gz files.

I'll keep the issue open until proper handling of the first issue is implemented. Wheel support will go to a separate issue.

Thanks again for reporting! :smile: