Re: [Python-ideas] "import me" to display some summary of the current python installation

2017-04-12 Thread Wes Turner
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_information/version_information.py

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 
wrote:

> On Tue, Apr 11, 2017 at 09:28:22PM -0500, Wes Turner wrote:
>
> > python -m site
> > https://github.com/python/cpython/blob/master/Lib/site.py
> > - _script()
>
>
> 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
> ___
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] "import me" to display some summary of the current python installation

2017-04-12 Thread Paul Moore
On 12 April 2017 at 14:35, Kamal Mustafa  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.
 import site
 site._script()
> sys.path = [
> '',
> '/usr/lib/python3.4',
> '/usr/lib/python3.4/plat-x86_64-linux-gnu',
> '/usr/lib/python3.4/lib-dynload',
> '/usr/local/lib/python3.4/dist-packages',
> '/usr/lib/python3/dist-packages',
> ]
> USER_BASE: '/home/kamal/.local' (exists)
> USER_SITE: '/home/kamal/.local/lib/python3.4/site-packages' (doesn't exist)
> ENABLE_USER_SITE: True

Unless you have to get this information from within the Python
interactive prompt, you can just run "python -m site" from the shell
prompt to get the same information.

Paul
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] "import me" to display some summary of the current python installation

2017-04-12 Thread Kamal Mustafa
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.
>>> import site
>>> site._script()
sys.path = [
'',
'/usr/lib/python3.4',
'/usr/lib/python3.4/plat-x86_64-linux-gnu',
'/usr/lib/python3.4/lib-dynload',
'/usr/local/lib/python3.4/dist-packages',
'/usr/lib/python3/dist-packages',
]
USER_BASE: '/home/kamal/.local' (exists)
USER_SITE: '/home/kamal/.local/lib/python3.4/site-packages' (doesn't exist)
ENABLE_USER_SITE: True

On 12 April 2017 at 09:56, Kamal Mustafa  wrote:
> 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-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] "import me" to display some summary of the current python installation

2017-04-12 Thread Mark Lawrence via Python-ideas

On 12/04/2017 04:04, Steven D'Aprano wrote:

On Tue, Apr 11, 2017 at 09:28:22PM -0500, Wes Turner wrote:


python -m site
https://github.com/python/cpython/blob/master/Lib/site.py
- _script()


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.



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

___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] "import me" to display some summary of the current python installation

2017-04-12 Thread Carl Smith
Sorry. Ignore my last message. I thought this conversation was on the
IPython Dev list.

-- Carl Smith
carl.in...@gmail.com

On 12 April 2017 at 10:31, Carl Smith  wrote:

> 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.in...@gmail.com
>
> On 12 April 2017 at 04:18, Steven D'Aprano  wrote:
>
>> On Wed, Apr 12, 2017 at 09:56:40AM +0800, Kamal Mustafa wrote:
>>
>> > 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.
>>
>> 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.
>>
>>
>> > 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.
>>
>> 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
>> ___
>> Python-ideas mailing list
>> Python-ideas@python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] "import me" to display some summary of the current python installation

2017-04-12 Thread Carl Smith
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.in...@gmail.com

On 12 April 2017 at 04:18, Steven D'Aprano  wrote:

> On Wed, Apr 12, 2017 at 09:56:40AM +0800, Kamal Mustafa wrote:
>
> > 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.
>
> 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.
>
>
> > 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.
>
> 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
> ___
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] "import me" to display some summary of the current python installation

2017-04-11 Thread Steven D'Aprano
On Wed, Apr 12, 2017 at 09:56:40AM +0800, Kamal Mustafa wrote:

> 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.

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.


> 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.

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
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] "import me" to display some summary of the current python installation

2017-04-11 Thread Steven D'Aprano
On Tue, Apr 11, 2017 at 09:28:22PM -0500, Wes Turner wrote:

> python -m site
> https://github.com/python/cpython/blob/master/Lib/site.py
> - _script()


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
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] "import me" to display some summary of the current python installation

2017-04-11 Thread Kamal Mustafa
Cool ! I don't know this.

On 12 April 2017 at 10:28, Wes Turner  wrote:
> python -m site
> https://github.com/python/cpython/blob/master/Lib/site.py
> - _script()
>
>
> On Tuesday, April 11, 2017, Kamal Mustafa  wrote:
>>
>> 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-ideas mailing list
>> Python-ideas@python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] "import me" to display some summary of the current python installation

2017-04-11 Thread Ryan Gonzalez
...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"  wrote:

> 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-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] "import me" to display some summary of the current python installation

2017-04-11 Thread Wes Turner
python -m site
https://github.com/python/cpython/blob/master/Lib/site.py
- _script()


On Tuesday, April 11, 2017, Kamal Mustafa  wrote:

> 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-ideas mailing list
> Python-ideas@python.org 
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] "import me" to display some summary of the current python installation

2017-04-11 Thread Kamal Mustafa
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-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/