Oryx
Oryx copied to clipboard
`pyproject.toml` should not be assumed to be a poetry project
Bug Report
PythonBashBuildSnippet.sh.tpl assumes that pyproject.toml
implies that it is a poetry project. However, this isn't generally true.
The code for setup.py
and pyproject.toml
could be handled by pip
instead like
elif [ -e "setup.py" ] || [ -e "pyproject.toml" ]
then
pip install .
A workaround (which I haven't tested yet) would be to create a requirements.txt
that just contains .
.
Hi @parched, thanks for your feedbacks. Looks that we're discussing about edge cases where poetry project can also be handled by other files like setup.py
and requirements.txt
, so we want to add a few more detection to these files to detect a poetry project? We'd like to cover most of cases with current detection logics. But how frequent these cases would happen to a poetry project? Please let me know if the understanding is correct.
setuptools now discourages using setup.py
. It currently recommends using pyproject.toml
and setup.cfg
together. I suspect it even may suggest to just use pyproject.toml
in the future.
Rather than trying to detect if it's a poetry project, I believe you should just be able to let pip
figure it out.
To properly detect Poetry you can either look for the existence of their lock file or check for the [tool.poetry]
table in pyproject.toml
. The key thing is pyproject.toml
is the Python standard for specifying package details, and so the file is in no way specific or exclusive to Poetry (e.g. Hatch, PDM, pipenv, etc. all use pyproject.toml
).
If you want a very generic solution to installing what a workspace wants to work, pip install -e .
is probably the closest, but even that leaves out any extras the user may want (and you have to preface that command with python -m
with python
being the path to the Python interpreter you are using).
@qianz2 if you would like direct help with this, please reach out internally in the Python group in Teams (or ping me directly and I can point you to the group).
Just adding another voice to this. We're using pyproject.toml
without poetry, and many more will shortly be doing so as it catches on. For now I just have a requirements.txt
file with .
in it which is working, but it would be nice to drop that.