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 virtualenv to ansible directory #1389

Closed
wants to merge 2 commits into from
Closed

Add virtualenv to ansible directory #1389

wants to merge 2 commits into from

Conversation

LucaLanziani
Copy link
Contributor

In my Linux distribution the default python is python3, thus
I was then having issues with the python scripts in the repo
where the shabang is #!/usr/bin/env python.

First idea was to change the shabang to ... python2 but I
realized that a virtual env can also help to pin the versions of
ansible and libraries eg. Jinja2 and make everyone env consistent.

In my Linux distribution the default python is python3, thus
I was then having issues with the python scripts in the repo
where the shabang is `#!/usr/bin/env python`.

First idea was to change the shabang to `... python2` but I
realized that a virtual env can also help to pin the versions of
ansible and libraries eg. Jinja2 and make everyone env consistent.
maclover7

This comment was marked as off-topic.

@LucaLanziani
Copy link
Contributor Author

@maclover7 comments addressed

refack

This comment was marked as off-topic.

@refack
Copy link
Contributor

refack commented Jul 11, 2018

I'd prefer the use of pipenv and PipFile. That would encapsulate both the need for python2, the requirements, and the setup.

P.S. I'm trying to estimate the effort needed to get the plugins python3 compatible

@mhdawson
Copy link
Member

Sorry if this is a dumb questions, but I assume that virtualenv support is consistent across platforms and available on all linux distros?

@refack
Copy link
Contributor

refack commented Jul 11, 2018

Sorry if this is a dumb questions, but I assume that virtualenv support is consistent across platforms and available on all linux distros?

Yes, and so is pipenv, both are pure python & a little bit of POSIX shell (they are kind of the equivalent to npm).
But since this is only required for the ansible host, it anyway should not affect the way we manage the "workers".

@maclover7
Copy link
Contributor

@refack What are the +/- of pipenv versus virtualenv (personally I'm not familiar with it) Would you be willing to file a pull request that implements pipenv, and then we can compare both options side by side?

@refack
Copy link
Contributor

refack commented Jul 12, 2018

What are the +/- of pipenv versus virtualenv (personally I'm not familiar with it) Would you be willing to file a pull request that implements pipenv, and then we can compare both options side by side?

Will do.

tl;dr:

  • pip is probably the most popular package manager for python (but defaults to global scope)
  • virtualenv is the conventional way to enable local scoped dependencies (a la node_modules)
  • pipenv is kind of new (~1 yo) and is the latest "blessed" incarnation of a wrapper for the last two. It's the most similar to npm in that by default it installs dependencies in local scope.

@refack
Copy link
Contributor

refack commented Jul 12, 2018

See seggestions in #1399

@LucaLanziani
Copy link
Contributor Author

Sorry I've should have asked before proceeding with the implementation.

The only reason I didn't go with pipenv is that imho it adds extra features like:

  • dev dependencies (do we have a dev/prod env definition? genuine question)
  • lock file (do we need this on releases? genuine question)
  • install packages and update requirements for you (for this I can see a use)

over something that works already well enough on simple cases like the one we have here (I might be underestimating the complexity of the repo).

That said, more than happy to use pipenv if you guys thinks it's better/we need this functionalities.

@refack
Copy link
Contributor

refack commented Jul 12, 2018

Sorry I've should have asked before proceeding with the implementation.

No worries. I mostly like it because it's newer and is more npm like. Only two features it has that make a difference are newer PEP508 dependency URIs, and it captures the required python engined needed.

What I really wanted to do is get the code to be 2/3 compatible (2b5e063).
With a formal python2 EOL date, we need to start moving...

@mhdawson
Copy link
Member

@refack good point about this only affecting the ansible host.

@sam-github
Copy link
Contributor

stale, and not what we are doing ATM.

@sam-github sam-github closed this Jan 28, 2020
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.

5 participants