-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
chg: dev: add main module. #2453
Conversation
Hi! Thanks for the contribution. This change seems fine, but can you perhaps explain a little more about why you want it? What situations is this useful for? Also, please take a look at the style checker. Please add the standard license header and future imports to the new file. Finally, I'm not thrilled about hard-coding the name "beets" in there. Maybe we can just leave that part unmodified? It seems unlikely to bother anyone that the program name will look a little weird... |
before i explain here is this related SO question http://stackoverflow.com/questions/4042905/what-is-main-py, and docs from python https://docs.python.org/3/library/__main__.html for myself, i have to use several python version and keep alias to those python. so if i have to run on python3, where the default is python2.7, i have to add python -m package rather than using the command line given by the package.
i can't think any other better way. after install the package for testing on virtual env ( note: and i just realize that on this is maybe one of the error when i try on those different python environment. |
I see—you'd like to distinguish between About the executable name: let's just leave it as it is. I actually think using |
i have tried, but due to confusion between python, virtual env and
the help actually print but i will leave leave the |
OK, thanks for explaining. As I mentioned above, can you please add the standard license comment and future imports to the top of the new file? Also, the docstring "main module" is not terribly helpful by itself. Could you please write a full sentence or two about the purpose there, or else just delete it? Finally, we'll need a changelog entry. Thanks! |
add license comments and future import. is the changelog entry corect? |
Thank you! Merged. ✨ |
add main file for module. with this program can be run from module. e.g.
python -m beets
. but this require fix onSubcommandOption
, because it will print__main__.py
instead of program name. so i add another method to inherit parent class and add exception for that word.i don't know how to test this with unittest, but if threre is introduction for testing this program, that would be helpful and i will add another commit for test.
python version: Python 3.5.2+
Distributor ID: Ubuntu
Description: Ubuntu 16.10
Release: 16.10
Codename: yakkety