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

chicken-egg-problem - install poetry with poetry #2515

Closed
3 tasks done
Cielquan opened this issue Jun 7, 2020 · 4 comments
Closed
3 tasks done

chicken-egg-problem - install poetry with poetry #2515

Cielquan opened this issue Jun 7, 2020 · 4 comments
Labels
kind/feature Feature requests/implementations

Comments

@Cielquan
Copy link
Contributor

Cielquan commented Jun 7, 2020

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request / Bug Report

Foreword

While I took a look at #2457 and tried to implement it #2511 I encountered an breaking issue: You cannot install poetry from source directly.

I stated my findings and thoughts in the comments of the issue yesterday. But I think its better to outsource this discussion into another (this) issue because its off-topic for the other issue.

Quotes in the following text are either from my above linked comment or this issue itself.

The Issue

So first of all the encountered issue is not a problem if you install poetry like its described in the docs.

The problem occurs when you want to install poetry from source with pip install .:

When I clone the poetry repo I cannot install it via pip install . like pre-commit will do. For installing it it wants to build a wheel for poetry but fails so because for building it it wants to use itself but its dependencies are not there because its not installed - catch-22.

For the error output please see the spoiler in my linked comment. You can also simply reproduce the error when you clone the repo and install it into a venv (linux commands):

git clone https://github.com/python-poetry/poetry
python3 -m venv venv
source venv/bin/activate
pip install -U pip
pip install .

Solutions

I stated 3 solutions:

  1. Bootstrapping (I think its called): change from using itself to using poetry as a package (like we all do)
  2. add the install dependencies to the requires section in [build-system] in pyproject.toml
  3. include dependencies in poetry repo itself

And said:

I think option 2 and 3 are overhead and IMO option 1 is the solution.

So after a night of sleep I got some additional thoughts and changed my view on my statement from above. Now I think solution 1 would only be the best temporary solution to the problem (because its so easy to apply and can be changed back anytime).

IMO the best and most stylish approach would be solution 2 but only in conjunction with the following part.

Implementation

Before I talk further I want to state that till now I have not taken a single look into the internals of poetry and plan to do so. So please don't hit me 😉

poetry currently has 22 install dependencies (4 for py3.4 (drop in 1.1) and 6 for py2.7 (drop in 2.0)). I don't think all are necessary to use poetry as a building back-end.
So I think it would be best to not put all dependencies into the require section but allow poetry to be used in a minimal way with minimal dependencies as a building back-end to build the full poetry application from source.

Proposal

I would propose to implement solution 1 as a temporary fix first

(because its so easy to apply and can be changed back anytime)

and then implement solution 2 like state above.


What do you think?

EDIT: Added context to dependency amount

@Cielquan Cielquan added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Jun 7, 2020
@Cielquan
Copy link
Contributor Author

Cielquan commented Jun 7, 2020

I did some further testing and found out that the amount needed for use as build back-end is actually lower than thought.

I trail-and-errored myself through and came to the following result:

With py3.6 I need 10 dependencies.
With py2.7 I need 3 more.

[build-system]
requires = ["intreehooks",
    "clikit==0.4.2", #### 3.6
    "importlib_metadata==1.1.3", #### 3.6
    "tomlkit==0.5.11", #### 3.6
    "cleo==0.7.6", #### 3.6
    "jsonschema==3.1", #### 3.6
    "pyparsing==2.2", #### 3.6
    "pkginfo==1.4", #### 3.6
    "cachecontrol[filecache]==0.12.4", #### 3.6
    "cachy==0.3.0", #### 3.6
    "html5lib==1.0.1", #### 3.6
    "typing==3.7.4.1", #### 2.7
    "functools32==3.2.3-2", #### 2.7
    "subprocess32==3.5.4" #### 2.7
]

EDIT: Here with the corresponding version specifiers from the poetry dependencies.

requires = [
    "intreehooks",
    "clikit>=0.4.2,<0.5.0",
    "importlib_metadata==1.1.3",
    "tomlkit>=0.5.11,<0.6.0",
    "cleo>=0.7.6,<0.8.0",
    "jsonschema>=3.1,<4.0",
    "pyparsing>=2.2,<3.0",
    "pkginfo>=1.4,<2.0",
    "cachecontrol[filecache]>=0.12.4,<0.13.0",
    "cachy>=0.3.0,<0.4.0",
    "html5lib>=1.0,<2.0",
    "typing>=3.6,<4.0; python_version>='2.7' and python_version<'2.8' or python_version>='3.4' and python_version<'3.5'",
    "subprocess32>=3.5,<4.0; python_version>='2.7' and python_version<'2.8' or python_version>='3.4' and python_version<'3.5'",
    "functools32>=3.2.3,<4.0.0; python_version>='2.7' and python_version<'2.8'",
]

@sdispater
Copy link
Member

Thanks for the detailed issue report!

Just so you know, there is already the poetry-core package (the repository is here: https://github.com/python-poetry/core) that will be released officially with the 1.1 release of Poetry.

The develop branch already uses it (see https://github.com/python-poetry/poetry/blob/develop/pyproject.toml#L80). I also use it in some of my projects (like clikit).

@Cielquan
Copy link
Contributor Author

Cielquan commented Jun 7, 2020

@sdispater Thanks a bunch. That's the solution. I like it ❤️

pip install . on develop just works !! 🎆

Only issue is this:

ERROR: cleo 0.8.1 has requirement clikit<0.7.0,>=0.6.0, but you'll have clikit 0.5.1 which is incompatible.

This are the dependencies in pyproject.toml.

cleo = "^0.8.0"
clikit = "^0.5.1"

I will close #2516 and change #2511 to use develop so it can be released alongside with 1.1 (if merged).

EDIT: Must be pip's dependency resolving.

@Cielquan Cielquan closed this as completed Jun 7, 2020
@abn abn removed the status/triage This issue needs to be triaged label Sep 25, 2020
Copy link

github-actions bot commented Mar 3, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants