python-poetry / python-poetry/poetry

Include configuration overrides the package format constraints.

Open
#2,461 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/build-system kind/bug status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: Ubuntu 20.04

  • Poetry version: 1.05

Project Structure

.
├── LICENSE.rst
├── noxfile.py
├── poetry.lock
├── pyproject.toml
├── README.rst
├── src
│ ├── mypkg
│ └── mypkg_obfuscated
└── tests
├── __init__.py
└── test_main.py

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

  • Complete development is being done on mypkg hence we want it to be included into the packages for testing using pytest, nox and other utilities.
  • mypkg_obfuscated is being added to the packages because we only want to send the obfuscated version of the package when distributing
  • The format option has been included to ensure that we include only the obfuscated version of the code in the wheel format which will be shipped.

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the package builds using the provided pyproject.toml, especially the include and packages entries with their format constraints. Start by comparing the generated sdist and wheel contents, using the project structure and tests/test_main.py as context. Done means confirming whether include is expected to apply to both formats and documenting or correcting the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.