avocado-framework / avocado

Avocado is a set of tools and libraries to help with automated testing. One can call it a test framework with benefits. Native tests are written in Python and they follow the unittest pattern, but any executable can serve as a test.
https://avocado-framework.github.io/
Other
343 stars 340 forks source link

Warnings on Installation Regarding Deprecated setuptools #5754

Open isomorphik7 opened 1 year ago

isomorphik7 commented 1 year ago

Describe the bug

When attempting to install Avocado from source using the ./setup.py install --user command, I encountered several deprecation warnings. These warnings seem to be related to the use of deprecated setuptools features.

Steps to reproduce

  1. Clone the Avocado repository (git clone https://github.com/avocado-framework/avocado.git)
  2. Navigate into the Avocado directory (cd avocado)
  3. Run ./setup.py build
  4. Run ./setup.py install --user

Expected behavior

The installation process should complete without any deprecation warnings.

Current behavior

The installation process emits multiple deprecation warnings related to setuptools. These warnings relate to:

System information

Additional information

Despite the warnings, the package appears to install successfully, but I am concerned that these warnings indicate potential future compatibility issues.

Here's a snippet of the warnings:

$ ./setup.py install --user
running install
/usr/lib/python3.11/site-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.11/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
writing avocado_framework.egg-info/PKG-INFO
writing dependency_links to avocado_framework.egg-info/dependency_links.txt
writing entry points to avocado_framework.egg-info/entry_points.txt
writing requirements to avocado_framework.egg-info/requires.txt
writing top-level names to avocado_framework.egg-info/top_level.txt
reading manifest file 'avocado_framework.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'avocado_framework.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
/usr/lib/python3.11/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning:     Installing 'avocado.etc.avocado.scripts.job' as data is deprecated, please list it in `packages`.
    !!

    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'avocado.etc.avocado.scripts.job' as an importable package,
    but it is not listed in the `packages` configuration of setuptools.

    'avocado.etc.avocado.scripts.job' has been automatically added to the distribution only
    because it may contain data files, but this behavior is likely to change
    in future versions of setuptools (and therefore is considered deprecated).

    Please make sure that 'avocado.etc.avocado.scripts.job' is included as a package by using
    the `packages` configuration field or the proper discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).

    You can read more about "package discovery" and "data files" on setuptools
    documentation page.

!!

  check.warn(importable)
/usr/lib/python3.11/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning:     Installing 'avocado.etc.avocado.sysinfo' as data is deprecated, please list it in `packages`.
    !!

    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'avocado.etc.avocado.sysinfo' as an importable package,
    but it is not listed in the `packages` configuration of setuptools.

    'avocado.etc.avocado.sysinfo' has been automatically added to the distribution only
    because it may contain data files, but this behavior is likely to change
    in future versions of setuptools (and therefore is considered deprecated).

    Please make sure that 'avocado.etc.avocado.sysinfo' is included as a package by using
    the `packages` configuration field or the proper discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).

    You can read more about "package discovery" and "data files" on setuptools
    documentation page.

!!

  check.warn(importable)
/usr/lib/python3.11/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning:     Installing 'avocado.libexec' as data is deprecated, please list it in `packages`.
    !!

    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'avocado.libexec' as an importable package,
    but it is not listed in the `packages` configuration of setuptools.

    'avocado.libexec' has been automatically added to the distribution only
    because it may contain data files, but this behavior is likely to change
    in future versions of setuptools (and therefore is considered deprecated).

    Please make sure that 'avocado.libexec' is included as a package by using
    the `packages` configuration field or the proper discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).

    You can read more about "package discovery" and "data files" on setuptools
    documentation page.

!!

  check.warn(importable)
NyuydineBill commented 7 months ago

Hello! I am Nyuydine Bill an applicant for outreachy internship, I wish to know if this issue is still relevant so I can start working on it Thanks @clebergnu

clebergnu commented 6 months ago

Hi @NyuydineBill, thanks for reaching out. Yes, this issue still is relevant. As a matter of fact, it's being addressed right now, but you may also be able to help.

There may be a simple fix to each of the warnings being produced, and if you are able to come up with these fixes, they'd be more than welcome.

But, I've chosen to take on this issue from a different angle: removing the setuptools dependency from Avocado. The reason is that Python 3.12 and later standard installations do not come with setuptools, and having an Avocado installation that depends only on Python itself is very attractive.

The first part of the work is removing Avocado's dependency on pkg_resources. This is a WIP so you shouldn't worry about it.

But, with the removal of setuptools, we must change the way we describe and perform Avocado's packaging. Converting Avocado's setup.py to a project.toml is most probably the way to go, see https://packaging.python.org/en/latest/.

If you want to experient with that, it'd be greatly appreciated.