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

chmod +x; requirements.txt #1

Closed
sbrl opened this issue Apr 18, 2022 · 3 comments
Closed

chmod +x; requirements.txt #1

sbrl opened this issue Apr 18, 2022 · 3 comments

Comments

@sbrl
Copy link

sbrl commented Apr 18, 2022

By marking the script as executable (chmod +x quad.py), this enables one to do ./quad.py blah instead of python quad.py blah.

Additionally, I strongly recommend adding a requirements.txt file, with 1 pip package name per line. By defining one's dependencies this way, others can simply install them like so:

sudo pip3 install -r requirements.txt

(of course it varies slightly by platform, but the principle is the same)

@AlexEidt
Copy link
Owner

Thanks for the feedback. The shebang at the top of the file #!/usr/bin/env python3 marks the script as executable, so you should be able to run quad.py directly.

The requirements.txt point you make is valid, and reminded me that the command to install all required packages is actually just

pip install numpy tqdm imageio imageio-ffmpeg

Which is already a one-liner. Since this is just a simple Python file and won't change much in the future, I feel a requirements.txt is a bit overkill.

@sbrl
Copy link
Author

sbrl commented May 1, 2022

No, the shebang is only half of the puzzle. You need to ensure that the file is marked executable too, otherwise you get a permission denied error when you attempt to execute it like that.

Since this is just a simple Python file and won't change much in the future, I feel a requirements.txt is a bit overkill.

True, but for the uninitiated its easier to tell them to pip3 install -r requirements.txt rather than specify a like of dependencies and potentially have an obscure spelling mistake.

@AlexEidt
Copy link
Owner

AlexEidt commented May 1, 2022

Marking the file as executable is up to the person who downloads the file. I have no control over that.

Concerning the pip install, it's very easy to copy and paste the requirements from the README into the terminal.

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

No branches or pull requests

2 participants