Giter VIP home page Giter VIP logo

Comments (11)

sdispater avatar sdispater commented on May 18, 2024 5

@radix Just to keep you posted.

The Python 2.7 support is coming along quite well. The only part remaining is the packaging/building part the rest is already supported (project creation and dependency installation).

So, expect full Python 2.7 support sometime next week :-)

from poetry.

sdispater avatar sdispater commented on May 18, 2024 2

@radix Why would poetry use an external dependency while there is a perfectly functional module in the standard library?

I perfectly understand what you are saying, believe me, but I don't want to bloat the CLI with options like --python, --three, --two like pipenv because it is a pain to maintain and each developer has its own way of managing its Python versions.

poetry behaves a lot like bundler in Ruby in the sense that it will use whatever Python version it has been installed for (or the virtualenv one if it's activated).

That's why I am currently working on making poetry compatible with Python 2.7 (which in this case will use virtualenv management tool like virtualenv) so that if you have a Python 2.7-only project you would just have to install poetry for Python 2.7 and it would behave like expected.

from poetry.

radix avatar radix commented on May 18, 2024 1

Supporting poetry running on python 2.7 would be excellent. It would mirror how cargo works as well. Do you have any list of work that needs to be done that maybe I could help with?

Just for argument's sake, I think the answer to your first question is very clear: because it would enable more use cases. I personally never want to activate a virtualenv again in my life. It's one of the worst parts of Python development. I never even want to be at risk of mutating my virtualenv in a way that isn't tracked in a .toml or .lock file. So I want to make sure I use a tool that can take care of it entirely for me and isolate me from the environment.

However, the suggestion of having poetry actually run on python 2.7 would be a good alternative to supporting arguments like --two. So I'm happy as long as that's eventually possible :)

from poetry.

sdispater avatar sdispater commented on May 18, 2024

Thanks for your interest in poetry!

You might want to take a look at https://poetry.eustace.io/docs/basic-usage/#poetry-and-virtualenvs

Basically, if you want to use a Python 2.7 virtualenv you will have to create it yourself using pew, virtualenv or even pyenv.

This is due to the fact that poetry, being a Python 3 only library, uses the venv module to create virtualenvs which will use the Python version for which poetry has been installed.

So you will be able to manage your Python 2.7 project with poetry but it won't be able to automatically create the virtualenv.

from poetry.

radix avatar radix commented on May 18, 2024

@sdispater Does that mean I need to activate my virtualenv manually when I want to use poetry? I really want to avoid that. What if I create the virtualenv at ~/.cache/pypoetry/virtualenvs/{project}-3.6? Will that trick poetry into using my 2.7 virtualenv?

Could poetry instead use command line tools to create the virtualenv, so it could natively support managing python 2 virtualenvs, if specifying something like --python2 on the command line when setting up a virtualenv?

from poetry.

radix avatar radix commented on May 18, 2024

(or adding a setting to pyproject.toml perhaps)

from poetry.

sdispater avatar sdispater commented on May 18, 2024

I agree this is not ideal. But, for now anyway, there is no way around it.

However, I strongly suggest to use pyenv to create your virtualenv for Python 2.7 since you can then make it activate a virtualenv automatically when you are in your project's directory. This will remove the pain of activating it manually while still being able to use poetry.

I will keep that in mind, and if I can come up with a satisfying solution to this problem I will integarte it into poetry.

from poetry.

radix avatar radix commented on May 18, 2024

@sdispater Could poetry shell out to CLI tools running different versions of Python instead of using the venv package directly in-process? This seems like a pretty standard way to do it that other tools use (like mkvirtualenv).

btw, it seems that creating a python2.7-based virtualenv at ~/.cache/pypoetry/virtualenvs/project-py3.6 works fine; poetry seems to be using the python version from that virtualenv so everything is natively python2.7 inside. The only issue I've run into is the creation of the virtualenv.

from poetry.

sdispater avatar sdispater commented on May 18, 2024

To support 2.7, there is a bunch of things to do:

  • Changing type annotations to Python 2.7-compatible ones
  • Adapting any non-compatible code (which can be quite complex)
  • Handling unicode problems that might occur

from poetry.

radix avatar radix commented on May 18, 2024

Thanks so much for the Python 2.7 support, I've verified it works!

from poetry.

github-actions avatar github-actions commented on May 18, 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.

from poetry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.