Skip to content

Added hashbang#100

Open
denilsonsa wants to merge 1 commit intoKalanyr:mainfrom
denilsonsa:patch-1
Open

Added hashbang#100
denilsonsa wants to merge 1 commit intoKalanyr:mainfrom
denilsonsa:patch-1

Conversation

@denilsonsa
Copy link
Copy Markdown

This allows directly calling the script as executable under any Unix-like system.

This allows directly calling the script as executable under any Unix-like system.
@Kalanyr
Copy link
Copy Markdown
Owner

Kalanyr commented Jan 22, 2024 via email

@Kalanyr
Copy link
Copy Markdown
Owner

Kalanyr commented Jan 22, 2024 via email

@denilsonsa
Copy link
Copy Markdown
Author

py version management command on Windows

What is that? Why is that? I never heard of it, but also I never wrote Python code under Windows anyway.


As a side note, you may want to drop Python 2.x support (it's been four years since it ended official support, and over a decade since Python 3.x was available). It can potentially simplify some code.

And, after that, you could write a pyproject.toml file, to make this repository a proper Python package (even if you don't plan on publishing it on PyPI). This way, it can be easily installed together with all the dependencies using pip.

Going pyproject.toml is the easiest solution regarding creating a separate module and then a launcher script, as it's natively supported as Entry points.

@Kalanyr
Copy link
Copy Markdown
Owner

Kalanyr commented Jan 22, 2024 via email

@denilsonsa
Copy link
Copy Markdown
Author

I see, it's mentioned in the official docs. I know it is also possible to use git smudge and clean filters to automatically modify files before committing. This way it would be possible to keep a local shebang different from what is stored in the repository.

Anyway, if it's too troublesome, feel free to close this. I know I can add the shebang myself on my local copy. (Although running it first without a shebang tries to run the script as a shell script, and bad stuff happens.)

Oh, I just noticed this PR tries to fix #65.

@v1ckxy
Copy link
Copy Markdown

v1ckxy commented Apr 24, 2025

Just saw this topic lol.

@denilsonsa Instead of using this:
#!/bin/env python

You should use:

#!/usr/bin/env python3

"python" can be reference any version, "python3" will always reference python3 default version.

Regards

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.

3 participants