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

Add option to specify python version for virtualenv #2083

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GibbonJojo
Copy link

I sometimes want to package virtualenvs with other python version than my system default. This adds another cli option to specify an alternative python executable. Naming is the same as for virtualenv
https://virtualenv.pypa.io/en/latest/cli_interface.html

I decided not to check for a valid executable in this code as virtualenv will forward the error anyways

I hope the code is fine as is, I'm not really versed in Ruby, but this might serve as a proposal for the requested change.

Tested it locally and works on my linux machine with a caveat though:

  1. virtualenv should not be installed in environments, instead it should be installed in the global interpreter or (preferred) via pipx
  2. virtualenv-tools can misfunction if you're trying to run it on a virtualenv, that has a different version than the one it's running on
    E.g. having Python3.10 as base, running
    virtualenv --python python3.12 environment_name
    cd environment_name
    virtualenv-tools --update-path /some/path

will throw an error while updating the .pycs

So given the example of having Python3.10 as your base python, but you want to build your virtualenv for Py3.12, you need to install virtualenv with pipx, then create a Py3.12 environment, install virtualenv-tools3 in there and run fpm in this environment.
It is a bit finicky, but that would need solving in virtualenv-tools, I guess. Atleast that enables fpm to build virtualenvs for different Python versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant