cartography icon indicating copy to clipboard operation
cartography copied to clipboard

setup.py install is deprecated

Open juju4 opened this issue 2 years ago • 3 comments

Bug Template

Title: setup.py install is deprecated

Description:

What issue is being seen? Describe what should be happening instead of the bug, for example: Cartography should not crash, the expected value isn't returned, the data schema is wrong, etc.

  • https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html
  • https://peps.python.org/pep-0517/
  • https://github.com/microsoft/LightGBM/issues/5061

To Reproduce:

Steps to reproduce the behavior. Provide all data and inputs required to reproduce the issue.

$ dpkg -l python3 python3-setuptools
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name               Version        Architecture Description
+++-==================-==============-============-=========================================================================
ii  python3            3.10.6-1~22.04 amd64        interactive high-level object-oriented language (default python3 version)
ii  python3-setuptools 59.6.0-1.2     all          Python3 Distutils Enhancements
$ git clone https://github.com/lyft/cartography.git
Cloning into 'cartography'...
remote: Enumerating objects: 11267, done.
remote: Total 11267 (delta 0), reused 0 (delta 0), pack-reused 11267
Receiving objects: 100% (11267/11267), 5.89 MiB | 17.33 MiB/s, done.
Resolving deltas: 100% (8068/8068), done.
$ cd cartography/
$ python3 setup.py install
running install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/lib/python3/dist-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(
running bdist_egg
running egg_info
creating cartography.egg-info
writing cartography.egg-info/PKG-INFO
writing dependency_links to cartography.egg-info/dependency_links.txt
writing entry points to cartography.egg-info/entry_points.txt
writing requirements to cartography.egg-info/requires.txt
[...]

Please complete the following information::

  • Cartography release version or commit hash: HEAD, 6e6e69d3879f0c02950499d5a6f2e5887e0c72db
  • Python version: 3.10.6
  • OS (feel free to omit this if you don't think it's relevant to your issue): Ubuntu 22.04 but likely applicable to others

juju4 avatar Oct 30 '22 17:10 juju4

Hey, I skimmed the docs you linked and I see that running python setup.py install is deprecated, but I don't see anything else. Given that our docs say to use pip install cartography (https://lyft.github.io/cartography/install.html#install--page-root), is there still an action that we need to take?

achantavy avatar Nov 08 '22 23:11 achantavy

I'm also new to this. My understanding is that project should move to pyproject.toml + setup.cfg and at one point setup.py will be deprecated but no clear date.

other resources

  • https://setuptools.pypa.io/en/latest/userguide/quickstart.html#transitioning-from-setup-py-to-setup-cfg

Transitioning from setup.py to setup.cfg To avoid executing arbitrary scripts and boilerplate code, we are transitioning into a full-fledged setup.cfg to declare your package information instead of running setup(). This inevitably brings challenges due to a different syntax. Here we provide a quick guide to understanding how setup.cfg is parsed by setuptools to ease the pain of transition.

  • https://peps.python.org/pep-0518/
  • https://snarky.ca/what-the-heck-is-pyproject-toml/
  • https://ianhopkinson.org.uk/2022/02/understanding-setup-py-setup-cfg-and-pyproject-toml-in-python/
  • https://godatadriven.com/blog/a-practical-guide-to-setuptools-and-pyproject-toml/

juju4 avatar Nov 13 '22 01:11 juju4

I will have PR to switch to pyproject.toml for build https://github.com/chandanchowdhury/cartography/compare/chandanchowdhury:cartography:master...development

Unfortunately, my development branch has unmerged commits for another PR, so don't want to send these yet just in case other PR do not get merged.

chandanchowdhury avatar Apr 12 '24 13:04 chandanchowdhury