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 example /usr/bin/env python as Python interpreter #280

Merged
merged 2 commits into from
Aug 24, 2023

Conversation

PierreBeucher
Copy link
Contributor

I was looking for a way to use Python interpreter from an environment variable or directly from PATH rather than specifying absolute path as ansible_python_interpreter. For instance, I'm creating NixOS instance in Cloud and path to Python is hard to know in advance, I'd rather use the one from PATH.

Found out via ansible/ansible#6345 (comment) one could use

ansible_python_interpreter: '/usr/bin/env python'

And though it would be worth adding an example in doc :)

@github-actions github-actions bot added the needs_triage Needs a first human triage before being processed. label Aug 10, 2023
@gotmax23 gotmax23 added the new_contributor This PR is the first contribution by a new community member. label Aug 10, 2023
@gotmax23
Copy link
Collaborator

Thanks for your Ansible docs contribution! We talk about Ansible documentation on matrix at #docs:ansible.im and on libera IRC at #ansible-docs if you ever want to join us and chat about the docs! We meet there on Tuesdays (see the Ansible calendar) and welcome additions to our weekly agenda items - scroll down to find the upcoming agenda and add a comment to put something new on that agenda.

@gotmax23
Copy link
Collaborator

I''m not sure python_3_support.rst is the right place for this note. Interpreter discovery has its own doc. This point isn't specifically related to python3.

@gotmax23 gotmax23 added the techreview needs technical review label Aug 11, 2023
@PierreBeucher
Copy link
Contributor Author

I looked around a bit before adding an example here as it also contains other example usage of ansible_python_interpreter. Why would the sub-section Using Python 3 on the managed machines with commands and playbooks not be suitable? It's related to using a specific Python interpreter for a managed machine.

Another candidate would be https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html but it clearly references the Python 3 support page for ansible_python_interpreter, hence putting it here.

What would you think is a better page for this? I can update MR accordingly

@oraNod oraNod removed the needs_triage Needs a first human triage before being processed. label Aug 14, 2023
@oraNod
Copy link
Contributor

oraNod commented Aug 14, 2023

@PierreBeucher Thanks for the docs contribution. I added a comment with some minor wording suggestions. As far as where this should go in the docs, my 2c is that it might fit ok after the last sentence in reference_appendices/interpreter_discovery.html. It is a bit tricky to find the best spot though. 😄

@PierreBeucher PierreBeucher force-pushed the python-interpreter-usr-bin-env branch 2 times, most recently from 133881b to 3bd4c8d Compare August 17, 2023 15:08
Sometime users will want to use the first Python interpreter available on PATH and/or can't know in advance the Python interpreter absolute path on managed hosts (such as NixOS where path might change in Nix store).

Method found from this comment: ansible/ansible#6345 (comment)
@PierreBeucher
Copy link
Contributor Author

added a comment with some minor wording suggestions.

Thanks, I updated with your proposed change.

How about a seealso:: to python_3_support.rst from interpreter_discovery.rst for details and example about ansible_python_interpreter ? (it already exists the other way around so I guess it makes sense) This way all ansible_python_interpreter examples can be found at the same place, it will be less confusing for users and both "good" places are used. I changed accordingly

Copy link
Contributor

@oraNod oraNod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a commit to add a sphinx anchor for the Python 3 Support section. LGTM now. Thanks for the docs contribution @PierreBeucher

@samccann samccann merged commit 07c5009 into ansible:devel Aug 24, 2023
6 checks passed
@PierreBeucher
Copy link
Contributor Author

PierreBeucher commented Aug 25, 2023

Thanks @oraNod @samccann ! Glad this contribution made its way in :)

s-hertel added a commit to s-hertel/ansible-documentation that referenced this pull request Jun 21, 2024
samccann pushed a commit that referenced this pull request Jun 21, 2024
patchback bot pushed a commit that referenced this pull request Jun 21, 2024
patchback bot pushed a commit that referenced this pull request Jun 21, 2024
samccann pushed a commit that referenced this pull request Jun 21, 2024
…#1629) (#1630)

This reverts commit 07c5009.

(cherry picked from commit c8403c7)

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
samccann pushed a commit that referenced this pull request Jun 21, 2024
…#1629) (#1631)

This reverts commit 07c5009.

(cherry picked from commit c8403c7)

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new_contributor This PR is the first contribution by a new community member. techreview needs technical review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants