$ docker run -ti --rm --name poetry-include python:3.11 bash
root@125be24bdd5c:/# curl -sSL https://install.python-poetry.org | python3 -
Retrieving Poetry metadata
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
/root/.local/bin
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing Poetry (1.8.3): Done
Poetry (1.8.3) is installed now. Great!
To get started you need Poetry's bin directory (/root/.local/bin) in your `PATH`
environment variable.
Add `export PATH="/root/.local/bin:$PATH"` to your shell configuration file.
Alternatively, you can call Poetry explicitly with `/root/.local/bin/poetry`.
You can test that everything is set up by executing:
`poetry --version`
root@125be24bdd5c:/# export PATH="/root/.local/bin:$PATH"
root@125be24bdd5c:/# mkdir /root/poetryinclude
root@125be24bdd5c:/# cd /root/poetryinclude
root@125be24bdd5c:~/poetryinclude# touch CHANGELOG.md
root@125be24bdd5c:~/poetryinclude# touch tests.py
root@125be24bdd5c:~/poetryinclude# touch poetryinclude.py
root@125be24bdd5c:~/poetryinclude# cat > pyproject.toml
[tool.poetry]
name = "poetryinclude"
version = "1.0.0"
description = "Test"
authors = ["Remi Rampin <remi@rampin.org>"]
include = [
{ path = "tests.py", format = "sdist" },
{ path = "CHANGELOG.md", format = "sdist" },
]
[tool.poetry.dependencies]
python = ">=3.8,<4"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
root@125be24bdd5c:~/poetryinclude# poetry build
Creating virtualenv poetryinclude-jtwbT7vC-py3.11 in /root/.cache/pypoetry/virtualenvs
Building poetryinclude (1.0.0)
- Building sdist
- Built poetryinclude-1.0.0.tar.gz
- Building wheel
- Built poetryinclude-1.0.0-py3-none-any.whl
root@125be24bdd5c:~/poetryinclude# ls dist
poetryinclude-1.0.0-py3-none-any.whl poetryinclude-1.0.0.tar.gz
root@125be24bdd5c:~/poetryinclude# unzip -t dist/poetryinclude-1.0.0-py3-none-any.whl
Archive: dist/poetryinclude-1.0.0-py3-none-any.whl
testing: poetryinclude.py OK
testing: poetryinclude-1.0.0.dist-info/METADATA OK
testing: poetryinclude-1.0.0.dist-info/WHEEL OK
testing: poetryinclude-1.0.0.dist-info/RECORD OK
No errors detected in compressed data of dist/poetryinclude-1.0.0-py3-none-any.whl.
root@125be24bdd5c:~/poetryinclude# rm -rf dist
root@125be24bdd5c:~/poetryinclude# cat > pyproject.toml
[tool.poetry]
name = "poetryinclude"
version = "1.0.0"
description = "Test"
authors = ["Remi Rampin <remi@rampin.org>"]
include = [
#{ path = "tests.py", format = "sdist" },
#{ path = "CHANGELOG.md", format = "sdist" },
"tests.py",
"CHANGELOG.md",
]
[tool.poetry.dependencies]
python = ">=3.8,<4"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
root@125be24bdd5c:~/poetryinclude# poetry build
Building poetryinclude (1.0.0)
- Building sdist
- Built poetryinclude-1.0.0.tar.gz
- Building wheel
- Built poetryinclude-1.0.0-py3-none-any.whl
root@125be24bdd5c:~/poetryinclude# unzip -t dist/poetryinclude-1.0.0-py3-none-any.whl
Archive: dist/poetryinclude-1.0.0-py3-none-any.whl
testing: CHANGELOG.md OK
testing: poetryinclude.py OK
testing: tests.py OK
testing: poetryinclude-1.0.0.dist-info/METADATA OK
testing: poetryinclude-1.0.0.dist-info/WHEEL OK
testing: poetryinclude-1.0.0.dist-info/RECORD OK
No errors detected in compressed data of dist/poetryinclude-1.0.0-py3-none-any.whl.
root@125be24bdd5c:~/poetryinclude# pip install ./dist/poetryinclude-1.0.0.tar.gz
Processing ./dist/poetryinclude-1.0.0.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: poetryinclude
Building wheel for poetryinclude (pyproject.toml) ... done
Created wheel for poetryinclude: filename=poetryinclude-1.0.0-py3-none-any.whl size=1250 sha256=7faeb113124661316c456754709e392a88ab3930893c60ffbdc1167d19dd9989
Stored in directory: /root/.cache/pip/wheels/ea/a8/b7/0840aa27ffdcdfcff263bca6518c63e1783ff422c68f2ab096
Successfully built poetryinclude
Installing collected packages: poetryinclude
Successfully installed poetryinclude-1.0.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
[notice] A new release of pip is available: 24.0 -> 24.2
[notice] To update, run: pip install --upgrade pip
root@125be24bdd5c:~/poetryinclude# ls /usr/local/lib/python3.11/site-packages/CHANGELOG.md
/usr/local/lib/python3.11/site-packages/CHANGELOG.md
Note that wheel contains CHANGELOG.md, and installing from the sdist puts CHANGELOG.md in site-packages. This does NOT happen if setting format=sdist, even though it is supposedly the default.