pypa / setuptools

Official project repository for the Setuptools build system
https://pypi.org/project/setuptools/
MIT License
2.52k stars 1.19k forks source link

[FR] Support specifying MANIFEST.in config via pyproject.toml #3341

Open jwodder opened 2 years ago

jwodder commented 2 years ago

What's the problem this feature will solve?

Now that setuptools has support for specifying setup.cfg options in pyproject.toml, one config file remains: MANIFEST.in. It would be nice if MANIFEST.in options could be specified in pyproject.toml so that a setuptools project could be configured entirely through one file.

(And before anyone suggests it, setuptools_scm does not help me: there are files in source control that I don't want to include in sdists, like .gitignore and .github/, so I'd still need a MANIFEST.in, and I'm back to square one.)

Describe the solution you'd like

Just spitballing: the following MANIFEST.in:

graft tests
global-exclude *.py[cod]

could be represented in pyproject.toml as:

[tool.setuptools]
manifest = [
    "graft tests",
    "global-exclude *.py[cod]",
]

or maybe:

[tool.setuptools]
manifest = [
    ["graft", "tests"],
    ["global-exclude", "*.py[cod]"],
]

Alternative Solutions

No response

Additional context

No response

Code of Conduct

abravalheri commented 2 years ago

Hi @jwodder thank you very much for the suggestion.

How about we take this opportunity (the move to pyproject.toml) to come up with a better/clearer design for specifying which files to include/exclude?

I have the impression that people have a hard time with MANIFEST.in... Or is it just my impression?

(In terms of personal priority though, I am currently prioritizing my efforts in setuptools to improve PEP-compliance, starting with PEP 660 and probably moving next to the core metadata).

MuellerSeb commented 2 years ago

Totally looking forward to getting rid of MANIFEST.in.

caniko commented 2 years ago

Implementation on the poetry side.

AlexanderJuestel commented 1 year ago

Hello, I am at the point where I would like to specify the contents of a MANIFEST.in file within a pyproject.toml file. What is the best way to do it these days? I have seen poetry but never worked with it and would like to avoid using too many third-party packages. Can I link the MANIFEST file in the pyproject.toml file somehow?

MuellerSeb commented 1 year ago

These days I would recommend hatch/hatchling if you dont need compiled extensions: https://hatch.pypa.io/latest/config/build/

ml31415 commented 6 months ago

Tox has some legacy field for accelerating this transition, like:

[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py{39,310,311,312}
...

Until some solution for the final syntax is discussed, which seems to be lengthy process, why not adding [tool.setuptools.legacy_manifest_in] for the transition process?

peekxc commented 3 months ago

This seems resolved by using package_data:

The package_data argument is a dictionary that maps from package names to lists of glob patterns. Note that the data files specified using the package_data option neither require to be included within a MANIFEST.in file, nor require to be added by a revision control system plugin.

Thus no MANIFEST.in file is needed if package-data is specified in pyproject.toml, e.g.

# pyproject.toml
[tool.setuptools.package-data]
mypkg = ["*.txt", "*.rst"]
jwodder commented 3 months ago

@peekxc package_data only controls the inclusion of files inside actual Python code packages; it doesn't control inclusion of files outside of your package, like tests/ or tox.ini.

peekxc commented 3 months ago

I see. Then please ignore my comment.