pypa / pypa/setuptools

[Doubt] Distribution.get_name() always "UNKNOWN" in extensions when using `pyproject.toml` (in `setuptools.finalize_distribution_options` entry-point)

Open
#4,247 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation help wanted
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

setuptools version

setuptools==69.1.1

Python version

Python 3.11

OS

Fedoa Workstation 39

Additional environment information

No response

Description

I've a custom setuptools extension, which tries to do some things, based on the name of the Distribution. It has worked before, but now, we are migrating the keywords from the setup.py to the pyproject.toml and this resulted in the Distribution.get_name() always being UNKNOWN in the Options finalizer (setuptools.finalize_distribution_options entry-point).

Expected behavior

I'd have expected the distribution options to be set when running the option finalizers, regardless of whether the options are set using the pyproject.toml or the setup.py.

How to Reproduce
  1. Clone the example from https://github.com/hansingt/setuptools-dist-name-unknown
  2. python -m venv venv
  3. ./venv/bin/pip install -e .
  4. ./venv/bin/python setup.py --name
Output
DIST NAME: UNKNOWN
test

PS: The behaviour is demonstrated using a direct call to setup.py, but it behaves the same, when building the distribution, either using setup.py bdist_wheel,pip wheel, or python -m build. The only difference is, that you don't see the output when running these commands.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked setuptools-dist-name-unknown example, create the virtual environment, install it in editable mode, and run python setup.py --name to reproduce the UNKNOWN output. Read the setuptools.finalize_distribution_options entry-point behavior and compare it with the setup.py and pyproject.toml configuration. Done means the distribution name is available to the option finalizer regardless of which configuration file defines it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.