-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for application-first, library-first, and non-package modes that change Poetry defaults #1132
Comments
The
This has worked for all my application projects (e.g. Django) that will never be packaged. |
Yes, and the version is defaulted. In my use case, this is sitting in a project that has a name and version in another language's ecosystem. Choosing a name is not difficult. There are two good reasons I don't want to have to give a version, though:
And If I'm not giving a version to Poetry, I might as well not give a name either. |
As a general workaround for the second point, you could add a trove classifier starting with "Private ::", per pypi/warehouse#5440 |
I also want the option to configure the project that poetry manages as a non-package. |
Renamed to better capture the intent and make this the round-up issue for related duplicates. |
As prior art to potentially draw inspiration from, see
After testing it, I noted that [project.scripts]
test-app = "test_app.main:main" It's a small start, but I think this is the idea that Poetry could go down to begin treating and thinking about applications (e.g., a FastAPI app) differently from wheel-packaged libraries. |
I came here via #2458, but as an application developer working with fastapi I was also surprised coming from pip that poetry created a root package by default. Given the issue consolidation this something we can expect on the roadmap @neersighted? |
Seconding this request. I think the only change necessary is that the [tool.poetry]
name = "foo"
version = "0.0.0"
description = ""
authors = []
[tool.poetry.dependencies]
python = "^3.11" a minimal [tool.poetry.dependencies]
python = "^3.11" Neither Pipenv nor npm require this useless metadata like poetry currently does. |
Don't know if exactly related, but there's superficially similar discussion by the PyPA people. And also my similar (ill-conceived) issue: #8292 (comment) |
This is a good idea. We'd just need to make sure that [tool.poetry]
...
classifiers = [
"Private :: Do Not Upload",
] Since we do not yet have: But, given that applications in this configuration couldn't be built as a wheel, I think applications would get "private"-ness as natural consequence of this change? |
Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132
Poetry 1.7 displays an error otherwise (though things still work) https://github.com/orgs/python-poetry/discussions/8622 python-poetry/poetry#1132
1. Add --no-root to poetry invocations. Poetry 1.7 displays an error otherwise (though things still work) https://github.com/orgs/python-poetry/discussions/8622 python-poetry/poetry#1132 2. Document python-poetry/poetry#8623
1. Add --no-root to poetry invocations. Poetry 1.7 displays an error otherwise (though things still work) https://github.com/orgs/python-poetry/discussions/8622 python-poetry/poetry#1132 2. Document python-poetry/poetry#8623
Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132 > --no-root Do not install the root package (the current project).
Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132 > --no-root Do not install the root package (the current project).
Backport #27919 by @silverwind Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132 > --no-root Do not install the root package (the current project). Co-authored-by: silverwind <me@silverwind.io>
1. Add --no-root to poetry invocations. Poetry 1.7 displays an error otherwise (though things still work) https://github.com/orgs/python-poetry/discussions/8622 python-poetry/poetry#1132 2. Document python-poetry/poetry#8623
I drafted a PR to introduce a "non-package" mode: #8650 Documentation is still missing, but the PR description and the |
Adding one more use case that's somewhat similar to @radoering's: We have a monorepo of $NON_PYTHON projects where we use Python scripts for scripting (especially CI jobs, commit hooks etc.) Neither script is a standalone application or a library or anything. Like others have said before, we just use Poetry for dependency management. On the note of dependency management, the following may or may not also be relevant for the current discussion: I don't understand why Poetry forces me to specify a Python version in
Anyway, should I create a separate ticket for this or do people think this ties into the current discussion (and MR)? |
I have a bash alias for |
Imho, |
Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132 > --no-root Do not install the root package (the current project).
@silverwind …which brings us back to #2458 :) |
The addition of: [tool.poetry]
package-mode = false In #8650 looks perfect for my use case. I'm developing an Ansible collection I would like to package with Galaxy, but I prefer to manage dependencies with Poetry. Thank you very much! |
Thanks for implementing this. For those reaching this issue from a search engine, the documentation for enabling non-package-mode can be found here: https://python-poetry.org/docs/basic-usage/#operating-modes |
Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132 > --no-root Do not install the root package (the current project).
Thank you again for getting this in! Updated link since the above 404s for me: |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'd like to be able to use Poetry to manage a virtual environment for a project that I never intend to package or publish.
My particular use case is that I want to use Python for testing a project written for another language. I just want to use Python as a cross-platform scripting language that comes with a nice test framework (pytest). I don't want to have to give my project a name or version in
pyproject.toml
, but Poetry refuses to create a virtual environment or install any dependencies until they are given. Pipenv doesn't have this limitation (because it doesn't try to handle packaging, which would require a name and version), so I'm using it in the meantime. I love Poetry, and I would rather use one tool, so please consider limiting name and version checks to the methods that absolutely need them.The text was updated successfully, but these errors were encountered: