question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generated setup.py should use setuptools.setup instead of distutils.core.setup

See original GitHub issue
  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: Gentoo Linux

  • Poetry version: 0.12.11

The command poetry build generates a setup.py file based on the contents of pyproject.toml. The setup file imports distutils.core.setup as the setup function, but passes build arguments that are only available in setuptools.setup, such as entry_points. When the package is installed via pip, this is not an issue, because pip still uses setuptools.setup, regardless of what is imported (see the distutils docs). However, other package managers may run into issues, because they use distutils. My distribution’s package manager (Portage) generates warnings:

usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
/usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'entry_points'
  warnings.warn(msg)
/usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)

In this case, no scripts will be installed, because the entry_points argument is not applicable for distutils.

Since setup.py uses features that are explicitly part of setuptools, but not distutils, I suggest that setuptools.setup should be imported. Would you accept a PR for this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:17
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
eli-schwartzcommented, Jul 1, 2019

My solution was to create distro packages of “dephell” for the Arch Linux distribution and use https://dephell.readthedocs.io/cmd-deps-convert.html to convert pyproject.toml into a usable setup.py file. I just download the source tarball from GitHub instead of PyPI, and as a result I also get testsuite files.

0reactions
techdragoncommented, Sep 9, 2019

I’m going to be including a fix for this in my work to fix #1350 since there is currently an outstanding PR ( https://github.com/pypa/setuptools/pull/1767 ) to bring setuptools in line with wheel and current documented practices regarding package license metadata, pip uses setuptools and I sincerely doubt there will be much traction trying to update distutils. So using setuptools directly just make sense.

Read more comments on GitHub >

github_iconTop Results From Across the Web

setuptools vs. distutils: why is distutils still a thing?
So, as you can see setuptools should be preferred to distutils, ... because it's maintained by a 3rd party rather than Python core...
Read more >
2. Writing the Setup Script — Python 3.11.1 documentation
The setup script is the centre of all activity in building, distributing, and installing modules using the Distutils. The main purpose of the...
Read more >
Dependencies Management in Setuptools
Setuptools allows you to declare dependencies that are not installed by default. This effectively means that you can create a “variant” of your...
Read more >
Why you shouldn't invoke setup.py directly - Paul Ganssle
For a long time, setuptools and distutils were the only game in town when it came to creating Python packages, and both of...
Read more >
What is setup.py? - Educative.io
The setup.py file is a Python file which indicates that the installation module/package is most likely packed and distributed using Distutils, the Python ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found