Skip to content

[RFE] Micropipenv get-python-version #189

Description

@frenzymadness

Given these two facts:

  • micropipenv is able to parse all the .lock and pyproject files and
  • micropipenv is not able to create a Python virtual environment

it might make sense to implement a new command get-python-version. The new command would basically just print out the information about the Python version the configuration is prepared for.

Let's say I'd like to use micropipenv instead of pipenv in an automated script for deploying applications. I'm able to create my own virtual environment for the application but I need to know which Python version to use. And this is the spot micropipenv can help me. All the logic to find the proper file and parse all the JSONs or TOMLs is already there so this new feature would enable us to do something like:

PYTHON_VERSION=`micropipenv get-python-version`
python$PYTHON_VERSION -m venv venv
source venv/bin/activate
micropipenv install

@encukou I hope that I described your idea correctly.

This is slightly related to #187

Possible problems to solve:

  • requirements.txt files do not contain Python version, what to return in this case?
  • poetry can use version specifiers like ==3.6.7 or >=3.6.7 or worse ^3.7, what version return in case of such ranges?
  • pipfile should contain only one version and it's generated there automatically but the specification is kinda vague and it seems to me that a pipfile without python_version is valid and pipenv works fine in that case without any issues of warnings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.priority/backlogHigher priority than priority/awaiting-more-evidence.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions