简体   繁体   中英

Disable publishing to PyPi with poetry

I am a setting up Poetry in combination with Tox to automate builds and testing. The project I am working on however is private and I want to avoid anyone working on it accidentally publishing it to PyPi. I have initialized a project using poetry init and my assumption is that the resulting setup does not result in a viable package that can be published without any further setup to begin with. Is this correct?

How could I further configure poetry so that even if someone accidentally runs poetry publish in the future the package will not actually be published.

Another option seems to be adding "Private:: Do not Upload" to classifiers in pyproject.toml .

[tool.poetry]
classifiers = ["Private :: Do not Upload"]

https://github.com/python-poetry/poetry/issues/3692#issuecomment-789346308

As I know poetry does not support such straightforward option yet. But the workaround is possible:

[tool.poetry]
exclude = ["**"]

In TOML format: * denotes a single level wildcard, and ** denotes all files in the given directory hierarchy.

exclude = ["**"] option prevents project files from getting into the package when poetry build is executed. It will show:

[ModuleOrPackageNotFound]
No file/folder found for package package_name

But nevertheless, poetry will create a tar.gz file and include three files in it: pyproject.toml , setup.py , and PKG-INFO . And it can be published

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM