Comments (11)
@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.
@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.
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.
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.
@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.
(or adding a setting to pyproject.toml perhaps)
from poetry.
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.
@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.
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.
Thanks so much for the Python 2.7 support, I've verified it works!
from poetry.
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)
- Extras with packages from groups other than main are not locked/installed correctly HOT 2
- poetry version 1.8.2 missing dependency `certifi` on homebrew install HOT 3
- virtualenvs.prefer-active-python is not respected HOT 9
- ModuleNotFoundError in test files HOT 3
- Specific Python Versions Unexpected Behavior HOT 1
- Cannot install ipykernel 6.29.4 with poetry HOT 5
- RHEL9(plow)/poetry not setting ld library paths correctly when installing PyTorch along with not installing a requirement(numpy) HOT 5
- RFE: Please provide update for `keyring` 25.x
- Package docutils (0.21.post1) not found. HOT 8
- Sub dependencies not being installed when explicitly providing a repository via source HOT 5
- `poetry add` should choose latest supported package version for project's Python constraints HOT 1
- Poetry fails to resolve dependencies that pull from a source HOT 1
- Legacy Repository Handler Allowing Mismatched Versions To Be Installed HOT 5
- Allow SSL certs to be defined per repository host
- --only main doesn't ignore dev dependencies HOT 2
- Dependency resolution using Azure Package Feed no longer operates correctly HOT 2
- Could not find a matching version of package quip-api when install quip-api HOT 1
- How to point token for private repo? HOT 1
- Overriding required python version for dependency. HOT 6
- Unable to find installation candidates for bitsandbytes (0.43.1) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poetry.