Skip to content
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

Install dependencies from pyproject.toml like from requirements.txt with -r #11584

Closed
1 task done
PaleNeutron opened this issue Nov 8, 2022 · 8 comments
Closed
1 task done
Labels
type: feature request Request for a new feature

Comments

@PaleNeutron
Copy link

PaleNeutron commented Nov 8, 2022

What's the problem this feature will solve?

Python encourage user to put all project infomation into one file: pyproject.toml , including dependencies.

But currently, users who want to just install dependencies and run a project, I mean not install it into site-packages, could not do this just with pip.

People have to use pip-tools generate requirements.txt first.

Describe the solution you'd like

pip install -r pyproject.toml

Alternative Solutions

$ pip install pip-tools
$ python -m piptools compile \
    -o requirements.txt \
    pyproject.toml
$ pip install -r requirements.txt 

Additional context

No

Code of Conduct

@PaleNeutron PaleNeutron added S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature labels Nov 8, 2022
@pfmoore
Copy link
Member

pfmoore commented Nov 8, 2022

I don’t think that installing dependencies and running a project uninstalled is a pattern we want to encourage. If you’re running your project uninstalled, it’s probably an application, not a library, and applications should be using a requirements file. See https://caremad.io/posts/2013/07/setup-vs-requirement/

@PaleNeutron
Copy link
Author

But pyproject.toml contains sections far beyond setup.py.

For example: pytest, mypy, black, isort... configurations.

These sections with dependencies describe an application.

@pfmoore
Copy link
Member

pfmoore commented Nov 8, 2022

That’s the decision of those projects to use pyproject.toml for their configuration, and doesn’t relate to the point I’m making.

@PaleNeutron
Copy link
Author

PaleNeutron commented Nov 8, 2022

So what's your suggestions for those modern application with pyproject.toml? Maitain another requirements.txt file contains duplicate things in pyproject.toml?

@uranusjr
Copy link
Member

uranusjr commented Nov 8, 2022

See discussions in #4783. The final comment mentioned container image layers, which I think is a use case that’s more relevant now than back then. I still believe this belongs to workflow tools (e.g. pip-tools, poetry, pdm) instead of pip, however.

@rgommers
Copy link

rgommers commented Feb 2, 2023

This feature request seems to me to basically be a duplicate of the --only-deps one in gh-11440.

I don’t think that installing dependencies and running a project uninstalled is a pattern we want to encourage. If you’re running your project uninstalled, it’s probably an application, not a library, and applications should be using a requirements file.

This is an incorrect assumption I'd say. I came here through a request from someone wanting this for libraries, and I've had the same need myself. It seems pretty obvious to me: if you have your build and runtime dependencies listed in pyproject.toml, then what is the way to install a complete development environment with all those dependencies? Right now there is no way to do that I think.

My suggestion here would be to:

  1. Consolidate this issue and Add --only-deps (and --only-build-deps) option(s) #11440
  2. Extend the UX need to ensure different groups of dependencies (build, runtime, optional) can be installed from pyproject.toml in a reasonable way.

@PaleNeutron PaleNeutron changed the title Install just dependencies from pyproject.toml like from requirements with -r Install dependencies from pyproject.toml like from requirements.txt with -r Feb 2, 2023
@ambadyanands
Copy link

if you have your build and runtime dependencies listed in pyproject.toml, then what is the way to install a complete development environment with all those dependencies? Right now there is no way to do that I think.

@rgommers Hi, wouldn't pip install . (for core dependencies), pip install .[dev] (for dev dependencies), etc. work as mentioned here? Or am I missing something here?

@pradyunsg
Copy link
Member

Consolidating this into #8049, since this is strictly a subset of the request made there.

Or am I missing something here?

People don't wanna install the project itself, but only its dependencies.

@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Mar 17, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

6 participants