setuptools icon indicating copy to clipboard operation
setuptools copied to clipboard

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

Open jwodder opened this issue 2 years ago • 9 comments

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

  • [X] I agree to follow the PSF Code of Conduct

jwodder avatar May 31 '22 12:05 jwodder

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

abravalheri avatar Jun 07 '22 20:06 abravalheri

Totally looking forward to getting rid of MANIFEST.in.

MuellerSeb avatar Jun 08 '22 22:06 MuellerSeb

Implementation on the poetry side.

caniko avatar Oct 05 '22 13:10 caniko

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?

AlexanderJuestel avatar Oct 28 '23 09:10 AlexanderJuestel

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

MuellerSeb avatar Oct 28 '23 10:10 MuellerSeb

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?

ml31415 avatar Apr 18 '24 09:04 ml31415

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"]

peekxc avatar Aug 05 '24 13:08 peekxc

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

jwodder avatar Aug 05 '24 13:08 jwodder

I see. Then please ignore my comment.

peekxc avatar Aug 05 '24 16:08 peekxc