Skip to content

Conversation

jcastill
Copy link
Member

When running 'python3 setup.py install' we get an alert about deprecation:

running install
/usr/lib/python3.12/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated. !!

setup.py per se is not deprecated, but the way
it's invoked is. This commit provides an alternative way to install sos still using setup.py.


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname [email protected]?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?
  • Are all passwords or private data gathered by this PR obfuscated?

When running 'python3 setup.py install' we get an alert
about deprecation:

running install
/usr/lib/python3.12/site-packages/setuptools/_distutils/cmd.py:66:
SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

setup.py per se is not deprecated, but the way
it's invoked is. This commit provides an alternative
way to install sos still using setup.py.

Signed-off-by: Jose Castillo <[email protected]>
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-4042
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@jcastill
Copy link
Member Author

There were at least possible solutions/substitutions here:

1- When running the command as it is now in the README, we get this after the warning:

		********************************************************************************
		Please avoid running ``setup.py`` directly.
		Instead, use pypa/build, pypa/installer or other
		standards-based tools.

		See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
		********************************************************************************

The blog post offers as an alternative pip install, in a table in the section "Summary".

2- There's also this doc that offers an alternative to python3 setup.py install:

https://packaging.python.org/en/latest/discussions/setup-py-deprecated/#setup-py-deprecated
https://packaging.python.org/en/latest/guides/modernize-setup-py-project/#modernize-setup-py-project *

Here the command specified is:

python -m pip install .

I chose this one but can change it to the first one if you all think it's better.

  • In the second link it's mentioned that 'A pyproject.toml file is strongly recommended.' I've been experimenting with a pyproject.toml for sos just as a side thing, but if the community thinks it could be useful for us to have one, let me know and I can open a draft PR with the work I've done so far, and the issues I've encountered, so we can all work on this together.

@arif-ali
Copy link
Member

I had a go at converting the setup.py to pyproject.toml a while back, and had got stuck (I think it was abut the data_files option from setup.py that I couldn't replicate), and then didn't move it along and forgot about it. I would love to see us move to the new recommended approach (but that is my personal opinion)

@bmr-cymru
Copy link
Member

data_files is deprecated and "strongly discouraged":

https://setuptools.pypa.io/en/latest/userguide/declarative_config.html

And:

https://setuptools.pypa.io/en/latest/userguide/datafiles.html

"Old packaging installation methods in the Python ecosystem have traditionally allowed installation of 'data files', which are placed in a platform-specific location."

I don't believe there is a solution to this unfortunately - the Python community has made it pretty clear that the old methods for installing files in platform-specific locations isn't coming back (it's characterised as an uncommon use case in the 2nd link, but I think there are many packages that are affected by this, judging by all the hacks I've seen e.g. referenced in the below pypa issue).

This pypa/packaging-problems issue talks about it a bit more in the context of man pages:

pypa/packaging-problems#72

For the packages I maintain that are on PyPi I've just accepted for now at least that there's no good way to install the man pages or system-wide configuration files automatically. I've implemented "config create" commands to deal with the configuration aspect, but I don't know of any general solution to the man page issue so far :sadface:

@jcastill
Copy link
Member Author

Thank you both for your insights, it's really helpful. I noticed the same problems with man pages, and a similar one while translating/transforming from setup.py's scripts section to pyproject.toml [project.scripts], but that could be because I still don't understand it fully.

I'll open a discussion or an issue so we can put some ideas together and track some possible solutions.

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

Successfully merging this pull request may close these issues.

3 participants