"import me" to display some summary of the current python installation

On the same theme with "import this" and "import antigravity", "import me" I think can be both some fun way to introduce Python and also offer a helpful functionality when troubleshooting python installation with someone new to the language. Currently, we have to use some myriad approach like "show me the output of `which python`" to know the basic info of the python installation someone having trouble or asking question.

python -m site https://github.com/python/cpython/blob/master/Lib/site.py - _script() On Tuesday, April 11, 2017, Kamal Mustafa <kamal.mustafa@gmail.com> wrote:

On Tue, Apr 11, 2017 at 09:28:22PM -0500, Wes Turner wrote:
Wes, I have no idea what that code snippet is supposed to do, or even whether it is supposed to be working code. Remember that we can't read your mind. If you're experimenting with code and trying things out, please don't waste the time of everyone else by doing it on the mailing list. -- Steve

On 12/04/2017 04:04, Steven D'Aprano wrote:
https://docs.python.org/3/library/site.html -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence

Steven, I had intended to answer the question. If I did not answer this question, I must have misunderstood the question.
Never mind. site._script() as pointed out by Wes Turner is what I need:
These commands could also be helpful for the inferred use case: $(which pip) --version $(which python) -m pip freeze python -m pip freeze --user python -m pip freeze --l python -m pip freeze -r ./requirements.txt conda --version conda config --show conda env export # .yaml dotfiles_status() # westurner/dotfiles/develop/etc/bash/ 05-bashrc.dotfiles.sh echo $VIRTUAL_ENV echo $CONDA_ENVS_PATH $WORKON_HOME In terms of printing the actual versions of {Python, pkgs, } for reproducibility, for Jupyter Notebook, there's: a %version_information magic command extension: https://github.com/jrjohansson/version_information/blob/master/version_infor... and also %watermark: https://github.com/rasbt/watermark/blob/master/watermark/watermark.py A way to print all this environment information from the CLI (as e.g. JSON and/or YAML) would indeed be useful (e.g. for CI build logs / as a build artifact). On Tue, Apr 11, 2017 at 10:04 PM, Steven D'Aprano <steve@pearwood.info> wrote:

...except it would break everybody who has a module named `me` (which admittedly isn't too common...). Something like `import this.what` or something like that would be cool, though. -- Ryan (ライアン) Yoko Shimomura > ryo (supercell/EGOIST) > Hiroyuki Sawano >> everyone else http://refi64.com On Apr 11, 2017 9:04 PM, "Kamal Mustafa" <kamal.mustafa@gmail.com> wrote:

On Wed, Apr 12, 2017 at 09:56:40AM +0800, Kamal Mustafa wrote:
If your Python installation isn't working, how are you supposed to run "import me"? You're a bit vague about what this "import me" is actually going to do. Can you show a mock-up of the output you expect? Both import this and antigravity are Easter eggs. I'm not entirely sure I like the idea of having a non-joke module run as a script on import. At the very least, it makes testing harder. But having said that, I like the idea of a standard, simple way of getting a good set of diagnostic information.
What's wrong with that? Apart from not working on Windows. If you are trouble-shooting calling Python from the shell, you need to see what the shell thinks is your Python executable, which may be an alias. For example, I might have: [steve@ando ~]$ which python3.5 alias python3.5='env -u PYTHONSTARTUP python3.5' /usr/bin/env Now, if I forget and wonder why Python 3.5 doesn't run my startup file, I can't troubleshoot that from inside Python 3.5 since the problem is in the shell, not Python. -- Steve

I actually did have `me` defined, but changed it to `my` recently. I use it in my shell to store my personal details, like my mobile number, API keys etc. It's handy being able to do `my.mobile` when I need that info quickly. Either way, the default banner should, and generally does, point new users to the help they need. -- Carl Smith carl.input@gmail.com On 12 April 2017 at 04:18, Steven D'Aprano <steve@pearwood.info> wrote:

Never mind. site._script() as pointed out by Wes Turner is what I need:- Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information.
On 12 April 2017 at 09:56, Kamal Mustafa <kamal.mustafa@gmail.com> wrote:

python -m site https://github.com/python/cpython/blob/master/Lib/site.py - _script() On Tuesday, April 11, 2017, Kamal Mustafa <kamal.mustafa@gmail.com> wrote:

On Tue, Apr 11, 2017 at 09:28:22PM -0500, Wes Turner wrote:
Wes, I have no idea what that code snippet is supposed to do, or even whether it is supposed to be working code. Remember that we can't read your mind. If you're experimenting with code and trying things out, please don't waste the time of everyone else by doing it on the mailing list. -- Steve

On 12/04/2017 04:04, Steven D'Aprano wrote:
https://docs.python.org/3/library/site.html -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence

Steven, I had intended to answer the question. If I did not answer this question, I must have misunderstood the question.
Never mind. site._script() as pointed out by Wes Turner is what I need:
These commands could also be helpful for the inferred use case: $(which pip) --version $(which python) -m pip freeze python -m pip freeze --user python -m pip freeze --l python -m pip freeze -r ./requirements.txt conda --version conda config --show conda env export # .yaml dotfiles_status() # westurner/dotfiles/develop/etc/bash/ 05-bashrc.dotfiles.sh echo $VIRTUAL_ENV echo $CONDA_ENVS_PATH $WORKON_HOME In terms of printing the actual versions of {Python, pkgs, } for reproducibility, for Jupyter Notebook, there's: a %version_information magic command extension: https://github.com/jrjohansson/version_information/blob/master/version_infor... and also %watermark: https://github.com/rasbt/watermark/blob/master/watermark/watermark.py A way to print all this environment information from the CLI (as e.g. JSON and/or YAML) would indeed be useful (e.g. for CI build logs / as a build artifact). On Tue, Apr 11, 2017 at 10:04 PM, Steven D'Aprano <steve@pearwood.info> wrote:

...except it would break everybody who has a module named `me` (which admittedly isn't too common...). Something like `import this.what` or something like that would be cool, though. -- Ryan (ライアン) Yoko Shimomura > ryo (supercell/EGOIST) > Hiroyuki Sawano >> everyone else http://refi64.com On Apr 11, 2017 9:04 PM, "Kamal Mustafa" <kamal.mustafa@gmail.com> wrote:

On Wed, Apr 12, 2017 at 09:56:40AM +0800, Kamal Mustafa wrote:
If your Python installation isn't working, how are you supposed to run "import me"? You're a bit vague about what this "import me" is actually going to do. Can you show a mock-up of the output you expect? Both import this and antigravity are Easter eggs. I'm not entirely sure I like the idea of having a non-joke module run as a script on import. At the very least, it makes testing harder. But having said that, I like the idea of a standard, simple way of getting a good set of diagnostic information.
What's wrong with that? Apart from not working on Windows. If you are trouble-shooting calling Python from the shell, you need to see what the shell thinks is your Python executable, which may be an alias. For example, I might have: [steve@ando ~]$ which python3.5 alias python3.5='env -u PYTHONSTARTUP python3.5' /usr/bin/env Now, if I forget and wonder why Python 3.5 doesn't run my startup file, I can't troubleshoot that from inside Python 3.5 since the problem is in the shell, not Python. -- Steve

I actually did have `me` defined, but changed it to `my` recently. I use it in my shell to store my personal details, like my mobile number, API keys etc. It's handy being able to do `my.mobile` when I need that info quickly. Either way, the default banner should, and generally does, point new users to the help they need. -- Carl Smith carl.input@gmail.com On 12 April 2017 at 04:18, Steven D'Aprano <steve@pearwood.info> wrote:

Never mind. site._script() as pointed out by Wes Turner is what I need:- Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information.
On 12 April 2017 at 09:56, Kamal Mustafa <kamal.mustafa@gmail.com> wrote:
participants (7)
-
Carl Smith
-
Kamal Mustafa
-
Mark Lawrence
-
Paul Moore
-
Ryan Gonzalez
-
Steven D'Aprano
-
Wes Turner