python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.69k stars 2.27k forks source link

Include configuration overrides the package format constraints. #2461

Open e0lithic opened 4 years ago

e0lithic commented 4 years ago

pyproject.toml

[tool.poetry]
name = "mypkg"
version = "0.1.0"
description = "Mypkg"
authors = ["tester <info@tester.com>"]
license = "MIT"
readme = "README.rst"
homepage = "xyz"
repository = "xyz"
documentation = "https://xyz.readthedocs.io"

include = ["src/mypkg_obfuscated/**/*"]

packages = [
    {include = "mypkg", from = "src", format = "sdist"},
    {include = "mypkg_obfuscated", from = "src", format="wheel"},
]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

PS: .gitignore contains the mypkg_obfuscated file as this is generated by running obfuscation and security scripts on mypkg. Hence there was a specific need to us the include in pyproject.toml even though mypkg_obfuscated was already present in the packages.

Usecase

Issue

It appears that include overrides the package formats and the mypkg_obfuscated gets included in the sdist format as well overriding the format constraints of the packages. I also went through the documentation but there isn't a format specific include/exclude which I came across.

I am very new to poetry and it could very well be the case that this is the intended flow for the include construct. Additionally if it appears that I am using poetry in unintended way , please feel free to guide me on the best method to achieve the specified goal of being able to distribute only the obfuscated code(mypkg_obfuscated) and be able to run all development flows on the open code(mypkg) in the same project.

And finally a vote of thanks for the great project. :+1:

e0lithic commented 4 years ago

@finswimmer In your opinion am I using poetry in the optimal way or there are other better ways of achieving the above ?

finswimmer commented 4 years ago

@e0lithic I think I understood what you are trying to do, and on the first look, your way looks like the correct way. But I have to investigate a little bit more whether the current behavior is a bug or a feature ;)

e0lithic commented 4 years ago

Hi again, considering there's been quite some time. I hope everyone is doing well. @finswimmer or @sdispater . Do you still consider the above mentioned issue as being a bug or an intended feature? I would plan building the scripts around poetry accordingly.