Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP517 #537

Open
Alessandro-Barbieri opened this issue May 18, 2022 · 7 comments
Open

PEP517 #537

Alessandro-Barbieri opened this issue May 18, 2022 · 7 comments

Comments

@Alessandro-Barbieri
Copy link

Could you move the buildsystem to PEP517?

@einarnn
Copy link
Contributor

einarnn commented May 20, 2022

@Alessandro-Barbieri, could you take a look at the changes on the branch einarnn-pep517 and see if they deliver what you're after:

https://github.com/ncclient/ncclient/tree/einarnn-pep517

Thanks!

@Alessandro-Barbieri
Copy link
Author

Alessandro-Barbieri commented May 21, 2022

We already have versioneer installed sistem wide and your vendored versioneer is clashing with it

@einarnn
Copy link
Contributor

einarnn commented May 21, 2022

I always package ncclient in an isolated environment to avoid clashes. I have attached a source tar.gz file you can try installing if you like. I am not an expert on the implications of PEP517 or exactly what problems are being caused overall by the way we use versioneer, so if you have explicit feedback on changes you would recommend, I'd be happy to get that.

Please feel free to try this:

ncclient-0.6.13 5.g3b2cd19.tar.gz

pip install ncclient-0.6.13 5.g3b2cd19.tar.gz should work. It installs cleanly for me in a fresh virtual environment (with or without versioneer explicitly installed in that environment), and I'm running on macOS:

❯ pip install ncclient-0.6.13 5.g3b2cd19.tar.gz
Processing ./ncclient-0.6.13 5.g3b2cd19.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting lxml>=3.3.0
  Using cached lxml-4.8.0-cp310-cp310-macosx_12_0_arm64.whl
Collecting paramiko>=1.15.0
  Using cached paramiko-2.11.0-py2.py3-none-any.whl (212 kB)
Requirement already satisfied: setuptools>0.6 in /Users/einarnn/.virtualenvs/pep517/lib/python3.10/site-packages (from ncclient==0.6.13 5.g3b2cd19) (62.1.0)
Collecting pynacl>=1.0.1
  Using cached PyNaCl-1.5.0-cp36-abi3-macosx_10_10_universal2.whl (349 kB)
Collecting cryptography>=2.5
  Using cached cryptography-37.0.2-cp36-abi3-macosx_10_10_universal2.whl (5.3 MB)
Collecting bcrypt>=3.1.3
  Using cached bcrypt-3.2.2-cp36-abi3-macosx_10_10_universal2.whl (50 kB)
Collecting cffi>=1.1
  Using cached cffi-1.15.0-cp310-cp310-macosx_11_0_arm64.whl (173 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Building wheels for collected packages: ncclient
  Building wheel for ncclient (pyproject.toml) ... done
  Created wheel for ncclient: filename=ncclient-0.6.13 5.g3b2cd19-py2.py3-none-any.whl size=84957 sha256=a0118b42e4e185826af6220a96d9a44733f139f5be010086ca8b075964f38f03
  Stored in directory: /Users/einarnn/Library/Caches/pip/wheels/54/2a/9c/739f36b91bf9cc8c9d35ae8f610fc5c9d60ac759d64d492cc9
Successfully built ncclient
Installing collected packages: six, pycparser, lxml, cffi, pynacl, cryptography, bcrypt, paramiko, ncclient
Successfully installed bcrypt-3.2.2 cffi-1.15.0 cryptography-37.0.2 lxml-4.8.0 ncclient-0.6.13 5.g3b2cd19 paramiko-2.11.0 pycparser-2.21 pynacl-1.5.0 six-1.16.0

@einarnn
Copy link
Contributor

einarnn commented May 21, 2022

Or this one: ncclient-0.6.13 6.g2413a91.tar.gz

@Alessandro-Barbieri
Copy link
Author

In gentoo we use system packages and we don't use pip for installing
This is what currently happens with the latest changes

>>> Compiling source in /var/tmp/portage/dev-python/ncclient-0.6.13-r1/work/ncclient-0.6.13 ...
 * python3_9: running distutils-r1_run_phase distutils-r1_python_compile
 *   Building the wheel for ncclient-0.6.13 via setuptools.build_meta
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.9/gpep517", line 4, in <module>
    sys.exit(main())
  File "/usr/lib/python3.9/site-packages/gpep517/__main__.py", line 177, in main
    return func(args)
  File "/usr/lib/python3.9/site-packages/gpep517/__main__.py", line 76, in build_wheel
    wheel_name = backend.build_wheel(args.wheel_dir, args.config_json)
  File "/usr/lib/python3.9/site-packages/setuptools/build_meta.py", line 244, in build_wheel
    return self._build_with_temp_dir(['bdist_wheel'], '.whl',
  File "/usr/lib/python3.9/site-packages/setuptools/build_meta.py", line 229, in _build_with_temp_dir
    self.run_setup()
  File "/usr/lib/python3.9/site-packages/setuptools/build_meta.py", line 174, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 45, in <module>
    version=versioneer.get_version(),
AttributeError: module 'versioneer' has no attribute 'get_version'

@einarnn
Copy link
Contributor

einarnn commented May 22, 2022

@Alessandro-Barbieri, the changes I have made seem to work in a fairly standard environment, and the pyproject.toml file I have added is consulted in my standard environment using pip. However, I the installed the gpep517 tool that I believe gentoo uses, and it doesn't work, with the error above. However, I have specified the dependencies in pyproject.toml, and it seems gpep517 ignores these?

I am not an expert in Python packaging, and I am not currently prepared to roll back the use of versioneer as it is useful in automating versioned package generation.

However, I am open to any suggestions PRs related to my perhaps incorrect updates on the branch einarnn-pep517 or any other approaches which also facilitate automated package versioning from a git tag (including changing from versioneer to something else that provides equivalent functionality).

@Alessandro-Barbieri
Copy link
Author

Alessandro-Barbieri commented May 22, 2022

Don't use gpep517. Try this instead: remove versioneer.py and install this versioneer instead https://github.com/python-versioneer/python-versioneer

They define get_version here https://github.com/python-versioneer/python-versioneer/blob/280fb6ce89af73ac6ced3c66354a16506a57fc6c/src/get_versions.py#L90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants