VCS exclude overrides cannot be overrden by "include"
Description
Poetry seems to be unable to override excludes from .gitignore.
I have a python package which is completely auto-generated. So the entire source tree for the package is excluded in .gitignore. No matter what I try, I can't get Poetry to include the package source code in the python wheel.
Eg:
Git ignore
foo
[build-system]
build-backend = "poetry.core.masonry.api"
# ...
[tool.poetry]
packages = [
{ include = "foo/bar/baz" }
]
include = ["foo"]
# or poetry build ...
python3 -m build . --wheel
unzip -l foo_bar_baz-0.1.0-0.1.0-py3-none-any.whl
Output
rchive: dist/foo_bar_baz-0.1.0-0.1.0-py3-none-any.whl
Length Date Time Name
--------- ---------- ----- ----
504 01-01-2016 00:00 foo_bar_baz-0.1.0.dist-info/METADATA
106 01-01-2016 00:00 foo_bar_baz-0.1.0.dist-info/WHEEL
224 01-01-2016 00:00 foo_bar_baz-0.1.0.dist-info/RECORD
--------- -------
834 3 files
If I remove the git ignore file then the python files appear
Workarounds
None.
Poetry Installation Method
pip
Operating System
Macos
Poetry Version
2.1.3
Poetry Configuration
cache-dir = "/Users/philip.couling/Library/Caches/pypoetry"
data-dir = "/Users/philip.couling/Library/Application Support/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = "{data-dir}/python" # /Users/philip.couling/Library/Application Support/pypoetry/python
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/philip.couling/Library/Caches/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false
Python Sysconfig
sysconfig.log
Paste the output of 'python -m sysconfig', over this line.
Example pyproject.toml
Poetry Runtime Logs
poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.
I can't get Poetry to include the package source code in the python wheel.
if the autogenerated code is not part of your repository, then it should not be included in a source distribution
see also #10259 as likely duplicate
@dimbleby This is not a source distribution. This is a wheel. It definitely should be included in a wheel.
see also https://github.com/python-poetry/poetry/issues/10259 as likely duplicate
@dimbleby #10259 was closed by the OP with only a subtle hint about how they got around it. However I have confirmed that using include = ["foo/**/*"] did not work for me. So beyond that, I don't see any useful information there.
OP in that issue reported how they made it work, "subtle hint" is an odd characterisation of that!
If that doesn't work for you - https://github.com/python-poetry/poetry/issues/10259#issuecomment-2706398915 also pointed at the relevant code if you want to take a look and figure out what's going on.
OP in that issue reported how they made it work, "subtle hint" is an odd characterisation of that!
I mean to say their exact statement was:
NVM using poetry_test_issue_10259/myLibs/**/* works 🙃🙃🙃
I presume that's synonymous with me setting include = ["foo/**/*"] but I'm not confident in that reading of it. Given that it didn't work for me, I'm even less confident I understood. I'm open to other suggestions of what they meant.
Per default, includes are only for sdist. The following should work:
include = [ {path = "foo/**/*", format = ["wheel"]} ]
Oh! That's a bit of a trip hazard. I'll have a think about whether there's a way to call that out more obviously. 🤔
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.