datacarpentry / python-ecology-lesson

Data Analysis and Visualization in Python for Ecologists
https://datacarpentry.org/python-ecology-lesson
Other
160 stars 310 forks source link

added instructions on shebang #417

Closed echism closed 4 years ago

echism commented 5 years ago

fixes #311

maxim-belkin commented 5 years ago

Thanks for the PR, @echism! Could you please justify the need for adding this note to the "Short introduction to Python"?

echism commented 5 years ago

It’s not strictly necessary, but it is easier to invoke a script this way. It’s more of a tip, one suggested in the issues.

Elizabeth Prout Analyst/Programmer UITS Advanced Visualization Lab https://showcase.avl.iu.edu/projects

Indiana University University Information Technology Services 535 West Michigan Street Indianapolis, IN 46202 317-278-3647

The Advanced Visualization Lab at Indiana University is a unit of the Research Technologies division of UITS; Research Technologies is a PTI Cyberinfrastructure and Service Center.

From: Maxim Belkin notifications@github.com Sent: Wednesday, August 21, 2019 4:36 PM To: datacarpentry/python-ecology-lesson python-ecology-lesson@noreply.github.com Cc: Prout, Elizabeth Ellen echism@iu.edu; Mention mention@noreply.github.com Subject: [External] Re: [datacarpentry/python-ecology-lesson] added instructions on shebang (#417)

This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources.

Thanks for the PR, @echismhttps://github.com/echism! Could you please justify the need for adding this note to the "Short introduction to Python"?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/datacarpentry/python-ecology-lesson/pull/417?email_source=notifications&email_token=ABTFQRT4BYOSECKSVZTPEETQFWRJVA5CNFSM4IONNB5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD43BLOA#issuecomment-523638200, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABTFQRV2HW3DHUP77L3EPULQFWRJVANCNFSM4IONNB5A.

wrightaprilm commented 5 years ago

If they followed the installation instructions, they should have Anaconda Python in their path. If they followed the install instructions, for example:

import sys
print(sys.version)

will return:

3.6.8 |Anaconda custom (64-bit)| (default, Dec 29 2018, 19:04:46) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]

Or similar without the shebang. You'll note this in _includes/scripts, for example. This PR straddles the line of what ought to be in the lesson, and not. I don't really want to put us in a position of maintaining instruction sets for multiple Python versions. If we want to include this, I think the best course of action would be to make a callout box noting that self-study students or instructors using custom Python installs should check the instructor guide. Then, this information could go in _extras/guide.md.

maxim-belkin commented 5 years ago

@wrightaprilm, @echism is talking about something else: one can "execute" Python scripts (as in./my-script.sh) if they:

  1. add #!/usr/bin/env python3 as the first line in the script and
  2. give this file executable permissions.

There shouldn't be be any burden on the maintainers. I was more concerned with the fit of this material to the lesson in its current state. While I agree that it might be convenient -- personally, I don't use it that much (I prefer to python3 script.py to be on a safe side in terms of which python interpreter I use). Therefore, I'm not even sure about the callout box. Perhaps, we could add this info to the page with additional information for instructors.

maxim-belkin commented 4 years ago

Unfortunately, I'm going to pass on this, @echism. Shebangs are convenient but they would be a better fit for a final episode on Python (a cherry on top sort of thing) rather than the first one. Thank you for your contribution anyway! I'm glad your PR stimulated this discussion -- it will help myself and future maintainers of the lesson.