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

python setup.py and the use of setup.py as a command line tool are deprecated #473

Closed
cclauss opened this issue Jan 30, 2024 · 14 comments
Closed

Comments

@cclauss
Copy link
Contributor

cclauss commented Jan 30, 2024

https://packaging.python.org/en/latest/discussions/setup-py-deprecated

However, python setup.py and the use of setup.py as a command line tool are deprecated.

From the test errors in #472 on macOS 12 and later.

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.

----------------------------- Captured stderr call -----------------------------
/Users/runner/work/hpy/hpy/.tmpdir/popen-gw0/test_hpymod_legacy_cpython_0/venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

    ********************************************************************************
    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.
    ********************************************************************************

!!
self.initialize_options()
/Users/runner/work/hpy/hpy/.tmpdir/popen-gw0/test_hpymod_legacy_cpython_0/venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

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

    See https://github.com/pypa/setuptools/issues/917 for details.
@mattip
Copy link
Contributor

mattip commented Jan 31, 2024

The pyroject.toml has a build section, so it should be a matter of pip install build; python -m build .; python -m pip install dist/*.whl, or something along those lines.

@mattip
Copy link
Contributor

mattip commented Jan 31, 2024

Or maybe just python -m pip install . (note the .)

@cclauss
Copy link
Contributor Author

cclauss commented Jan 31, 2024

Agreed... I was worried about how to handle three of the failing tests that do:
'setup.py', f'--hpy-abi={hpy_abi}', 'install'

@mattip
Copy link
Contributor

mattip commented Jan 31, 2024

I think you should be able to use python -m pip install . --config-settings="--hpy-api={hpy_abi}"?

@nulano
Copy link

nulano commented Jan 31, 2024

I think you need python -m pip install . --global-option="--hpy-abi={hpy_abi}" but that is also deprecated.

--config-settings does not seem to be passed through to the setup function currently: pypa/setuptools#2491

To avoid this deprecation, Pillow uses a custom build backend wrapping setuptools (python-pillow/Pillow#7171) and I've created python-pillow/Pillow#7658 to fix some issues with that.

@hodgestar
Copy link
Contributor

If there is no solution that isn't deprecated, I'm not sure we can do better than what we do now.

@cclauss
Copy link
Contributor Author

cclauss commented Jan 31, 2024

A problem is that Mac users are quite diligent about updating macOS and #472 demonstrates that installation tests fails on macOS 12, 13, and 14.

@hodgestar
Copy link
Contributor

@cclauss You're quoting documentation about what pip would like to have happen, but I don't see a solution being offered. We can't not pass the information about which ABI to build for.

@f-cozzocrea
Copy link

The pyroject.toml has a build section, so it should be a matter of pip install build; python -m build .; python -m pip install dist/*.whl, or something along those lines.

This doesn't work the last time I tried it. Build/setuptools will complain that the project script contains absolute paths (for the helper source files), and refuse to build. See my issue at #435 for related discussion.

@mattip
Copy link
Contributor

mattip commented Feb 1, 2024

Using python -m build worked locally for me

We can't not pass the information about which ABI to build for.

We could use an environment variable

@mattip
Copy link
Contributor

mattip commented Feb 1, 2024

Correction: using python -m build works for the hpy build itself, I did not try using hpy in a test package.

@hodgestar
Copy link
Contributor

An environment variable might help. I tried that with pip awhile ago and the environment variable wasn't passed into the isolated build, but perhaps we can do the build with python -m build and then pip install the generated wheels.

@hodgestar
Copy link
Contributor

If others agree and someone wants to do this, we could try rewrite the tests in test/hpy_devel/test_distutils.py to build with python -m build where python setup.py was used before.

@cclauss
Copy link
Contributor Author

cclauss commented Feb 4, 2024

we could try rewrite the tests...

https://github.com/hpyproject/hpy/pull/472/files#diff-8ca48d70aa8abbf3dec9764a6d23dc3d0879df302dd383d795011b487be2b898 was an attempt to do that but I think I am in over my head.

@cclauss cclauss closed this as completed Apr 26, 2024
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

5 participants