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

How to filter out .gitignore with python -m build --sdist #1058

Closed
jamesbraza opened this issue Jul 23, 2024 · 4 comments
Closed

How to filter out .gitignore with python -m build --sdist #1058

jamesbraza opened this issue Jul 23, 2024 · 4 comments

Comments

@jamesbraza
Copy link
Contributor

I have a pyproject.toml like the below:

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools_scm]
version_file = "src/package/version.py"

I noticed after running python -m build --sdist that the built .tar.gz contains version controlled files like .gitignore or folders like .github.

Reading the setuptools docs, it talks about setuptools_scm and including files: https://setuptools.pypa.io/en/stable/userguide/extension.html#adding-support-for-revision-control-systems

Is there some way to, within pyproject.toml, specify to setuptools_scm how to exclude files and folders? Or should one fall back onto MANIFEST.in for exclusions like that?

@RonnyPfannschmidt
Copy link
Contributor

Manifest is good for such exclusions and way simpler than gut export ignores

@jamesbraza
Copy link
Contributor Author

Just to be clear, so you're saying instead of MANIFEST.in, one could use something like a .gitattributes file to dictate what files Git will export?

More just trying to understand, I agree it sounds more hacky than MANIFEST.in

@RonnyPfannschmidt
Copy link
Contributor

setuptools-scm asks git archive for the file list to correctly manage export ignores and export substitutions, that part is pretty hacky but does its job - the most painless way to better controll the archive content is the manifest when using setuptools, or the hatch pattersn when using hatch

@jamesbraza
Copy link
Contributor Author

Thank you again, that makes sense. I added a docs contribution related to this to help future devs. Cheers!

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

2 participants