-
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
Simpler UX for non-package (data science) projects #2068
Comments
I think this is a great feature reuqest, and have been thinking the same thing for a long while. It was one of the main reasons I did not move away from Pipenv (until now). We can probably attribute Pipenv's previous success to many things, but the main use of Pipenv was to "install packages/projects" and not "create packages". I am sure that attributed some to it success because it made package management easier for the Python ecosystem. This is also an unsubstantiated guess but I bet the majority of Python users are looking for a packet/project manager, not a package creation tool when looking at Pipenv. Thus I feel like @gjoseph92 is right on point. |
I personally don't see much difference between a project and a package. All of my works with poetry are 'projects', but they need to be deployed, and to be deployed they need to be packaged (in the general sense), and specifically a Python package has been a good way to do that for me.Then again, I use a templating system to make new 'projects' anyway rather than poetry init or poetry new, no entering of anything, so it's kind of moot. (I don't object to your use case btw, I'm just not 100% on-board with the assertion that it's the most common one) |
@danmur Could you elaborate on why you think that packaging a project is more common? I think it is way off assuming people equate a project == package. I guess that an abundance of more users would know what pip the package installer is and use it, than packaging python projects with e.g. setuptools, wheels. Many people do not deploy their own project by packaging it. E.g. in a container world you usually install with pip or Again, I'm genuinely curious why you think packaging a Python project would be common, as I think it is not. Maybe it is I who am way off here, hence why I am curious. |
I haven't taken a survey so it's just my experience that this is how projects are generally distributed and deployed. Like I said, if this workflow works for you and others I think that's fine. Perhaps we are from different worlds :). I also build container images by installing packages and using a private repo. I see what is happening in your install with pip example but to be honest I can't see why I'd ever want to build a container with a python file or two and not put them in a package so it's easy to reproduce the build, or share the packages with others (or make two builds, one for linux and one for windows). I think since you're saying these are data science projects that your use case is quite different to mine, and that's fine, but there are lots of other use cases for building and deploying software into production systems and in my experience this is generally done by using the packaging tools available to the language (not just Python). I will add as well that the data scientists at my current job do something similar to what you're describing, but if it ever reaches production it's packaged. Just my opinion. |
Thanks for your input. I suppose we are just from different worlds as you say 😃 I don't work in data projects myself, it was the original poster that did. |
As a Data Science student who's been using Poetry for projects (without packaging) and packaged projects [0], here's my 2¢. Given that it's late, I'll skip most of what I'd like to say and focus on one point: documentation. Poetry has a lot of space to improve, documentation-wise. This isn't just online -- I stumbled upon this issue while looking for how to use "package data" -- but also in the executable itself. Specifically, the errors are confusing. As an example, when trying to find information on ~> poetry run --help
[RuntimeError]
Poetry could not find a pyproject.toml file in /Users/az or its parents Now, this is a case of "whoops, wrong command", but it also illustrates another important point: Poetry currently doesn't fail educationally. Contrast The same command, but using Cargo~> cargo run --help
cargo-run
Run the main binary of the local package (src/main.rs)
USAGE:
cargo run [OPTIONS] [--] [args]...
[...]
~> cargo help run
cargo-run
Run the main binary of the local package (src/main.rs)
[...] This is but one unrepresentative example, but it does show that there is space for Python's ecosystem to improve.
I'm actually against this, because I've accidentally run
I don't hold any particular opinions here, other than bouncing off the interactive deps tool [1], but
I could get behind this. Though, at this point, why not have a
Another point is this: regardless of if packaging is more common or not, should Poetry (and the broader ecosystem) take an opinionated stance of "Yes, all nontrivial Python code should be packaged"? Rust, as a compiled language, takes that stance. Python probably shouldn't make that declaration for all code -- one-off scripts are an easy counterexample. But should all nontrivial projects see packaging? If so, then packaging needs to be as frictionless as possible. [0] This is for a variety of reasons, including
[1] The interface didn't give a good way to cancel, I think. Testing the interface:
There's also an inconsistency between I'll probably have some new input later, once this quarter finishes and I have time to actually organize my thoughts. |
Sad there is no progress on no-package use, I think it is quite helpful! My usecase is a documentation project with jupyter-book and sphinx, where I need to install dependecies in virtual environment. I want to list these deps in I could use pipenv, venv and probably conda, but prefer poetry for this (I had to explore a conflict of dependecies that was never apparent in requirements.txt, but rightfllly rejected by poetry). Ideally there is some flag like |
I don't quite get the issue @epogrebnyak. I can create a new Poetry project using |
@danmur - you are right, frsej init-install sequence works well. I had Cannot install package error, but can't replicate it now, must be some editing or corruption of pyproject.toml. Can confirm fresh init and install without package work fine, just as you say, so no need for --no-package flag. |
Duplicate #1132 |
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. |
Feature Request
Since pipenv is dead (pypa/pipenv#4058), I've been using Poetry. It's a great tool, and better than pipenv—but the UX is oriented more specifically towards creating new Python packages, not managing multiple Python projects in general. When working on data science projects, which are not and never will become Python packages, I'd prefer a less-opinionated interface.
In Pipenv, I like that creating a new environment is minimalist and simple:
With poetry, I have to read the docs more carefully to figure out
poetry init
vspoetry new
, then runpoetry init
and hit Enter a bunch of times to bypass thepyproject.toml
metadata that I don't particularly care about (or is irrelevant, such as the version), type out my packages one-by-one, forget thatjupyterlab
isn'tjupyter-lab
, screw it up, ctrl-C, break my shell (#2067), open a new Terminal because I don't know aboutreset
, and do it all again.poetry init -n
is an okay workaround right now, but I usually forget the name of the flag and have to look it up, which is annoying.If poetry is becoming the primary tool for Python environment and dependency management, it's worth thinking about the UX for data science, since that's such a common reason to use Python (and need to manage a bunch of per-project environments) these days.
A few ideas:
As discussed in #1132,
pyproject.toml
not requiring a version or name is probably a prerequisite to all of these.poetry add
creates apyproject.toml
in the current directory, if not already within a poetry project (similar to pipenv semantics)poetry init
is non-interactive by defaultpoetry new
only creates a directory andpyproject.toml
by default,poetry new --package
would add the boilerplate scaffolding of README, tests, package directory, etc.This doesn't address making the simple case simple and easy to document to beginners, though.
Perhaps a larger change could be moving the current semantics under a
poetry package
command group (poetry package new
,poetry package init
), and havingpoetry init
/new
be for creating non-package "data science" projects.My (unsubstantiated) guess is that people create new Python projects way more frequently than they create new Python packages. How many times a week do you make a new package? (For me, very rarely.) How many times a week to you make an isolated data science project to try things out? (For me, nearly every day.) To me, this justifies making non-package projects the primary interface, and package-based projects more of a special case. But I recognize that that changes the current semantics and goals of Poetry a fair amount.
Also, happy to move this to a comment on #1132 if you do think it's a duplicate issue.
The text was updated successfully, but these errors were encountered: