Re: [CODE4LIB] python 2 versus python 3

2018-03-08 Thread Adam Constabaris
... which is what Charles already pointed out (sorry about that)!

cheers,

AC

On Thu, Mar 8, 2018 at 8:14 AM, Adam Constabaris 
wrote:

> Although we've answered Eric's original question to over the hills and far
> away and all the way back, I feel compelled to point out that python 2.7's
> end-of-life support is on the horizon:
>
> https://pythonclock.org/
>
> While existing python 2.x installations won't turn into pumpkins in 2020,
> you won't be getting the benefit of updates.
>
> cheers,
>
> AC
>
> On Wed, Mar 7, 2018 at 3:35 PM, Bryan Brown  wrote:
>
>> Hi Eric,
>>
>>
>> Unless you are specifically working on a legacy project written in Python
>> 2 that is to large to update, I would strongly recommend working with 3 as
>> its the future. Staying with 2 means you won't have access to cool new
>> features in 3.
>>
>>
>> I ran into issues when I started working in Python 3 as it would
>> sometimes conflict with whatever the default system version of Python was,
>> whether that be 2 or even an older version of 3 than what I prefer. My
>> solution has been to work with a tool called "Anaconda", which is a
>> self-contained Python distribution that you can download into your user
>> account instead of the system itself, which avoids conflicts with the
>> system Python. Anaconda also has an extended package index, so you can
>> quickly install data sciencey modules much easier than with default Python.
>> I highly recommend checking it out.
>>
>>
>> https://www.anaconda.com/download/
>>
>>
>> Bryan J. Brown
>>
>> Repository Developer
>>
>> Technology & Digital Scholarship Division
>>
>> Florida State University Libraries
>>
>> 
>> From: Code for Libraries  on behalf of Eric
>> Lease Morgan 
>> Sent: Wednesday, March 7, 2018 3:14:23 PM
>> To: CODE4LIB@LISTS.CLIR.ORG
>> Subject: [CODE4LIB] python 2 versus python 3
>>
>> I need some advice regarding writing in Python 2 versus Python 3.
>>
>> I have been trying to write more of my software in Python because
>> everybody around me is speaking French (Ruby), Italian (R), or Spanish
>> (Javascript) when I’m speaking in Latin (Perl). My latest example is a set
>> of command-line tools (Bash as well as Python) designed to do scalable
>> reading against HathiTrust content. [1] I originally wrote the tools in
>> Python 2. Since then I learned more about the HathiTrust Research Center
>> “capsules” (on-demand virtual machines), and there Python 3 is the default
>> environment. So, I tweaked my code and it works out-of-the-box and as
>> expected.
>>
>> On the other hand, my kewl tools no longer work in my local environment
>> because I use Python 2, and I don’t feel like installing YAVoP (Yet Another
>> Version of Python) on my server(s).
>>
>> What’d do you suggest? Do you suggest writing in: 1) Python 2 or 2)
>> Python 3 or 3) a combination of both?
>>
>> [1] HathiTrust Research Center Workset Browser -
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.
>> com_ndlib_text-2Danalysis-2Dhtrc&d=DwIFaQ&c=HPMtquzZjKY31rtk
>> yGRFnQ&r=FkFKSediiYRWi53Dc5NSDQ&m=zN3GlgstLlVZyTx8TpTmciwPYI
>> 1PKKXPdAnYA5KVZlY&s=oGhXqGrquStoMR-DYzbkkVBGqGe-em7LB3PAtVn9OEE&e=
>> [2] HathiTrust Research Center “capsules” -
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__analyti
>> cs.hathitrust.org_staticcapsules&d=DwIFaQ&c=HPMtquzZjKY31rtk
>> yGRFnQ&r=FkFKSediiYRWi53Dc5NSDQ&m=zN3GlgstLlVZyTx8TpTmciwPYI
>> 1PKKXPdAnYA5KVZlY&s=z3Y98jYwrJBscwfAvzxsz7-i4iiwalm2l2uq5EW2UNA&e=
>>
>> —
>> Eric Morgan
>>
>
>


Re: [CODE4LIB] python 2 versus python 3

2018-03-08 Thread Adam Constabaris
Although we've answered Eric's original question to over the hills and far
away and all the way back, I feel compelled to point out that python 2.7's
end-of-life support is on the horizon:

https://pythonclock.org/

While existing python 2.x installations won't turn into pumpkins in 2020,
you won't be getting the benefit of updates.

cheers,

AC

On Wed, Mar 7, 2018 at 3:35 PM, Bryan Brown  wrote:

> Hi Eric,
>
>
> Unless you are specifically working on a legacy project written in Python
> 2 that is to large to update, I would strongly recommend working with 3 as
> its the future. Staying with 2 means you won't have access to cool new
> features in 3.
>
>
> I ran into issues when I started working in Python 3 as it would sometimes
> conflict with whatever the default system version of Python was, whether
> that be 2 or even an older version of 3 than what I prefer. My solution has
> been to work with a tool called "Anaconda", which is a self-contained
> Python distribution that you can download into your user account instead of
> the system itself, which avoids conflicts with the system Python. Anaconda
> also has an extended package index, so you can quickly install data
> sciencey modules much easier than with default Python. I highly recommend
> checking it out.
>
>
> https://www.anaconda.com/download/
>
>
> Bryan J. Brown
>
> Repository Developer
>
> Technology & Digital Scholarship Division
>
> Florida State University Libraries
>
> 
> From: Code for Libraries  on behalf of Eric
> Lease Morgan 
> Sent: Wednesday, March 7, 2018 3:14:23 PM
> To: CODE4LIB@LISTS.CLIR.ORG
> Subject: [CODE4LIB] python 2 versus python 3
>
> I need some advice regarding writing in Python 2 versus Python 3.
>
> I have been trying to write more of my software in Python because
> everybody around me is speaking French (Ruby), Italian (R), or Spanish
> (Javascript) when I’m speaking in Latin (Perl). My latest example is a set
> of command-line tools (Bash as well as Python) designed to do scalable
> reading against HathiTrust content. [1] I originally wrote the tools in
> Python 2. Since then I learned more about the HathiTrust Research Center
> “capsules” (on-demand virtual machines), and there Python 3 is the default
> environment. So, I tweaked my code and it works out-of-the-box and as
> expected.
>
> On the other hand, my kewl tools no longer work in my local environment
> because I use Python 2, and I don’t feel like installing YAVoP (Yet Another
> Version of Python) on my server(s).
>
> What’d do you suggest? Do you suggest writing in: 1) Python 2 or 2) Python
> 3 or 3) a combination of both?
>
> [1] HathiTrust Research Center Workset Browser -
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.
> com_ndlib_text-2Danalysis-2Dhtrc&d=DwIFaQ&c=HPMtquzZjKY31rtkyGRFnQ&r=
> FkFKSediiYRWi53Dc5NSDQ&m=zN3GlgstLlVZyTx8TpTmciwPYI1PKKXPdAnYA5KVZlY&s=
> oGhXqGrquStoMR-DYzbkkVBGqGe-em7LB3PAtVn9OEE&e=
> [2] HathiTrust Research Center “capsules” - https://urldefense.proofpoint.
> com/v2/url?u=https-3A__analytics.hathitrust.org_staticcapsules&d=DwIFaQ&c=
> HPMtquzZjKY31rtkyGRFnQ&r=FkFKSediiYRWi53Dc5NSDQ&m=
> zN3GlgstLlVZyTx8TpTmciwPYI1PKKXPdAnYA5KVZlY&s=z3Y98jYwrJBscwfAvzxsz7-
> i4iiwalm2l2uq5EW2UNA&e=
>
> —
> Eric Morgan
>


Re: [CODE4LIB] python 2 versus python 3

2018-03-07 Thread Brian Wu
Definitely use a virtualenv when possible. It'll save you a ton of
headaches down the road. I was at a python conference in December, and this
speaker had a great segment about virtualenvs:
https://youtu.be/bxCp3Ciwjm0?t=3m50s

My personal preference is virtualenvwrapper. It gives you a lot of extra
options over the normal virtualenv, and streamlines it for command-line
usage.


On Wed, Mar 7, 2018 at 6:11 PM, Ray Voelker  wrote:

> I was just talking to a friend of mine about Python stuff, as we've both
> just started using it for some library-related projects.
>
> We we're looking into the environment stuff when it comes to python, and I
> didn't realize that there were so many ways to go!
>
> https://stackoverflow.com/questions/41573587/what-is-
> the-difference-between-venv-pyvenv-pyenv-virtualenv-virtualenvwrappe
>
> My two-cents is that virtualenv seems fairly easy to use, is fairly
> popular, and gives you a sandboxed python environment.
>
> --Ray
>
> On Mar 7, 2018 8:57 PM, "Peter Murray"  wrote:
>
> > For what it's worth, I recently ran across this article about setting up
> > sane Python development environments:
> >
> >   https://jacobian.org/writing/python-environment-2018/
> >
> >
> > Peter
> >
> > On Mar 7, 2018, 4:54 PM -0500, Jay Luker , wrote:
> > > I would add a recommendation for pyenv as a way to manage multiple
> > versions
> > > of python on a machine. Very helpful, particularly if you need to run
> > > tests under multiple versions with something like tox.
> > >
> > > https://github.com/pyenv/pyenv
> > >
> > > —jay
> > >
> > > On Wed, Mar 7, 2018 at 3:35 PM Ed Summers  wrote:
> > >
> > > > I agree. Third party support for Python3 is pretty good now. But if
> you
> > > > have any dependencies you know you're going to need it's a good idea
> to
> > > > check beforehand.
> > > >
> > > > There's also the six module if you want to be able to say you
> support 2
> > > > and 3, and want a nice way of papering over the differences.
> > > >
> > > > http://six.readthedocs.io/
> > > >
> > > > //Ed
> > > >
> > > > > On Mar 7, 2018, at 3:31 PM, Tod Olson  wrote:
> > > > >
> > > > > I'd suggest Python 3.
> > > > >
> > > > > There are mechanisms for managing virtual environments for Python,
> > like
> > > > penv, which make it easy to install and switch between versions
> without
> > > > confusing the system.
> > > > >
> > > > > -Tod
> > > >
> >
>



-- 
Brian Wu
Email: poen...@gmail.com


Re: [CODE4LIB] python 2 versus python 3

2018-03-07 Thread Ray Voelker
I was just talking to a friend of mine about Python stuff, as we've both
just started using it for some library-related projects.

We we're looking into the environment stuff when it comes to python, and I
didn't realize that there were so many ways to go!

https://stackoverflow.com/questions/41573587/what-is-the-difference-between-venv-pyvenv-pyenv-virtualenv-virtualenvwrappe

My two-cents is that virtualenv seems fairly easy to use, is fairly
popular, and gives you a sandboxed python environment.

--Ray

On Mar 7, 2018 8:57 PM, "Peter Murray"  wrote:

> For what it's worth, I recently ran across this article about setting up
> sane Python development environments:
>
>   https://jacobian.org/writing/python-environment-2018/
>
>
> Peter
>
> On Mar 7, 2018, 4:54 PM -0500, Jay Luker , wrote:
> > I would add a recommendation for pyenv as a way to manage multiple
> versions
> > of python on a machine. Very helpful, particularly if you need to run
> > tests under multiple versions with something like tox.
> >
> > https://github.com/pyenv/pyenv
> >
> > —jay
> >
> > On Wed, Mar 7, 2018 at 3:35 PM Ed Summers  wrote:
> >
> > > I agree. Third party support for Python3 is pretty good now. But if you
> > > have any dependencies you know you're going to need it's a good idea to
> > > check beforehand.
> > >
> > > There's also the six module if you want to be able to say you support 2
> > > and 3, and want a nice way of papering over the differences.
> > >
> > > http://six.readthedocs.io/
> > >
> > > //Ed
> > >
> > > > On Mar 7, 2018, at 3:31 PM, Tod Olson  wrote:
> > > >
> > > > I'd suggest Python 3.
> > > >
> > > > There are mechanisms for managing virtual environments for Python,
> like
> > > penv, which make it easy to install and switch between versions without
> > > confusing the system.
> > > >
> > > > -Tod
> > >
>


Re: [CODE4LIB] python 2 versus python 3

2018-03-07 Thread Peter Murray
For what it's worth, I recently ran across this article about setting up sane 
Python development environments:

  https://jacobian.org/writing/python-environment-2018/


Peter

On Mar 7, 2018, 4:54 PM -0500, Jay Luker , wrote:
> I would add a recommendation for pyenv as a way to manage multiple versions
> of python on a machine. Very helpful, particularly if you need to run
> tests under multiple versions with something like tox.
>
> https://github.com/pyenv/pyenv
>
> —jay
>
> On Wed, Mar 7, 2018 at 3:35 PM Ed Summers  wrote:
>
> > I agree. Third party support for Python3 is pretty good now. But if you
> > have any dependencies you know you're going to need it's a good idea to
> > check beforehand.
> >
> > There's also the six module if you want to be able to say you support 2
> > and 3, and want a nice way of papering over the differences.
> >
> > http://six.readthedocs.io/
> >
> > //Ed
> >
> > > On Mar 7, 2018, at 3:31 PM, Tod Olson  wrote:
> > >
> > > I'd suggest Python 3.
> > >
> > > There are mechanisms for managing virtual environments for Python, like
> > penv, which make it easy to install and switch between versions without
> > confusing the system.
> > >
> > > -Tod
> >


Re: [CODE4LIB] python 2 versus python 3

2018-03-07 Thread Charles Ed Hill
I know the decision has been made, but I'll just pile on and state the
official end of life for python 2 is in less than 2 years, so no more
security fixes or anything beyond that point.


On Mar 7, 2018 4:54 PM, "Jay Luker"  wrote:

I would add a recommendation for pyenv as a way to manage multiple versions
of python on a  machine. Very helpful, particularly if you need to run
tests under multiple versions with something like tox.

https://github.com/pyenv/pyenv

—jay

On Wed, Mar 7, 2018 at 3:35 PM Ed Summers  wrote:

> I agree. Third party support for Python3 is pretty good now. But if you
> have any dependencies you know you're going to need it's a good idea to
> check beforehand.
>
> There's also the six module if you want to be able to say you support 2
> and 3, and want a nice way of papering over the differences.
>
> http://six.readthedocs.io/
>
> //Ed
>
> > On Mar 7, 2018, at 3:31 PM, Tod Olson  wrote:
> >
> > I'd suggest Python 3.
> >
> > There are mechanisms for managing virtual environments for Python, like
> penv, which make it easy to install and switch between versions without
> confusing the system.
> >
> > -Tod
>


Re: [CODE4LIB] python 2 versus python 3

2018-03-07 Thread Ed Summers

> On Mar 7, 2018, at 4:53 PM, Eric Lease Morgan  wrote:
> 
>  4. Prefix scripts with  #!/usr/bin/env python

#!/usr/bin/env python3

if you want to be sure!


signature.asc
Description: Message signed with OpenPGP


Re: [CODE4LIB] python 2 versus python 3

2018-03-07 Thread Eric Lease Morgan
On Mar 7, 2018, at 3:35 PM, Bryan Brown  wrote:

>> On the other hand, my kewl tools no longer work in my local environment 
>> because I use Python 2, and I don’t feel like installing YAVoP (Yet Another 
>> Version of Python) on my server(s).
>> 
>> What’d do you suggest? Do you suggest writing in: 1) Python 2 or 2) Python 3 
>> or 3) a combination of both?
> 
> https://www.anaconda.com/download/


Okay. Based on the feedback provided here, as well as input from other places, 
here is my solution:

  0. Commit to Python 3
  1. Choose a distribution, and for better or for worse, I choose Anaconda
  2. Install distribution
  3. Make sure distribution is in my PATH
  4. Prefix scripts with  #!/usr/bin/env python
  5. Write software using Python 3

This way I can install libraries, modules, etc. using conda and not mess up my 
operating system’s version of Python. 

Thank you, and now my kewl HathiTrust distribution works locally to boot.

—
Eric M. 


Re: [CODE4LIB] python 2 versus python 3

2018-03-07 Thread Jay Luker
I would add a recommendation for pyenv as a way to manage multiple versions
of python on a  machine. Very helpful, particularly if you need to run
tests under multiple versions with something like tox.

https://github.com/pyenv/pyenv

—jay

On Wed, Mar 7, 2018 at 3:35 PM Ed Summers  wrote:

> I agree. Third party support for Python3 is pretty good now. But if you
> have any dependencies you know you're going to need it's a good idea to
> check beforehand.
>
> There's also the six module if you want to be able to say you support 2
> and 3, and want a nice way of papering over the differences.
>
> http://six.readthedocs.io/
>
> //Ed
>
> > On Mar 7, 2018, at 3:31 PM, Tod Olson  wrote:
> >
> > I'd suggest Python 3.
> >
> > There are mechanisms for managing virtual environments for Python, like
> penv, which make it easy to install and switch between versions without
> confusing the system.
> >
> > -Tod
>


Re: [CODE4LIB] python 2 versus python 3

2018-03-07 Thread Ed Summers
I agree. Third party support for Python3 is pretty good now. But if you have 
any dependencies you know you're going to need it's a good idea to check 
beforehand.

There's also the six module if you want to be able to say you support 2 and 3, 
and want a nice way of papering over the differences.

http://six.readthedocs.io/

//Ed

> On Mar 7, 2018, at 3:31 PM, Tod Olson  wrote:
> 
> I'd suggest Python 3.
> 
> There are mechanisms for managing virtual environments for Python, like penv, 
> which make it easy to install and switch between versions without confusing 
> the system.
> 
> -Tod


signature.asc
Description: Message signed with OpenPGP


Re: [CODE4LIB] python 2 versus python 3

2018-03-07 Thread Bryan Brown
Hi Eric,


Unless you are specifically working on a legacy project written in Python 2 
that is to large to update, I would strongly recommend working with 3 as its 
the future. Staying with 2 means you won't have access to cool new features in 
3.


I ran into issues when I started working in Python 3 as it would sometimes 
conflict with whatever the default system version of Python was, whether that 
be 2 or even an older version of 3 than what I prefer. My solution has been to 
work with a tool called "Anaconda", which is a self-contained Python 
distribution that you can download into your user account instead of the system 
itself, which avoids conflicts with the system Python. Anaconda also has an 
extended package index, so you can quickly install data sciencey modules much 
easier than with default Python. I highly recommend checking it out.


https://www.anaconda.com/download/


Bryan J. Brown

Repository Developer

Technology & Digital Scholarship Division

Florida State University Libraries


From: Code for Libraries  on behalf of Eric Lease 
Morgan 
Sent: Wednesday, March 7, 2018 3:14:23 PM
To: CODE4LIB@LISTS.CLIR.ORG
Subject: [CODE4LIB] python 2 versus python 3

I need some advice regarding writing in Python 2 versus Python 3.

I have been trying to write more of my software in Python because everybody 
around me is speaking French (Ruby), Italian (R), or Spanish (Javascript) when 
I’m speaking in Latin (Perl). My latest example is a set of command-line tools 
(Bash as well as Python) designed to do scalable reading against HathiTrust 
content. [1] I originally wrote the tools in Python 2. Since then I learned 
more about the HathiTrust Research Center “capsules” (on-demand virtual 
machines), and there Python 3 is the default environment. So, I tweaked my code 
and it works out-of-the-box and as expected.

On the other hand, my kewl tools no longer work in my local environment because 
I use Python 2, and I don’t feel like installing YAVoP (Yet Another Version of 
Python) on my server(s).

What’d do you suggest? Do you suggest writing in: 1) Python 2 or 2) Python 3 or 
3) a combination of both?

[1] HathiTrust Research Center Workset Browser - 
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ndlib_text-2Danalysis-2Dhtrc&d=DwIFaQ&c=HPMtquzZjKY31rtkyGRFnQ&r=FkFKSediiYRWi53Dc5NSDQ&m=zN3GlgstLlVZyTx8TpTmciwPYI1PKKXPdAnYA5KVZlY&s=oGhXqGrquStoMR-DYzbkkVBGqGe-em7LB3PAtVn9OEE&e=
[2] HathiTrust Research Center “capsules” - 
https://urldefense.proofpoint.com/v2/url?u=https-3A__analytics.hathitrust.org_staticcapsules&d=DwIFaQ&c=HPMtquzZjKY31rtkyGRFnQ&r=FkFKSediiYRWi53Dc5NSDQ&m=zN3GlgstLlVZyTx8TpTmciwPYI1PKKXPdAnYA5KVZlY&s=z3Y98jYwrJBscwfAvzxsz7-i4iiwalm2l2uq5EW2UNA&e=

—
Eric Morgan


Re: [CODE4LIB] python 2 versus python 3

2018-03-07 Thread Tod Olson
I'd suggest Python 3. 

There are mechanisms for managing virtual environments for Python, like penv, 
which make it easy to install and switch between versions without confusing the 
system.

-Tod

> On Mar 7, 2018, at 2:14 PM, Eric Lease Morgan  wrote:
> 
> I need some advice regarding writing in Python 2 versus Python 3.
> 
> I have been trying to write more of my software in Python because everybody 
> around me is speaking French (Ruby), Italian (R), or Spanish (Javascript) 
> when I’m speaking in Latin (Perl). My latest example is a set of command-line 
> tools (Bash as well as Python) designed to do scalable reading against 
> HathiTrust content. [1] I originally wrote the tools in Python 2. Since then 
> I learned more about the HathiTrust Research Center “capsules” (on-demand 
> virtual machines), and there Python 3 is the default environment. So, I 
> tweaked my code and it works out-of-the-box and as expected. 
> 
> On the other hand, my kewl tools no longer work in my local environment 
> because I use Python 2, and I don’t feel like installing YAVoP (Yet Another 
> Version of Python) on my server(s). 
> 
> What’d do you suggest? Do you suggest writing in: 1) Python 2 or 2) Python 3 
> or 3) a combination of both?
> 
> [1] HathiTrust Research Center Workset Browser - 
> https://github.com/ndlib/text-analysis-htrc
> [2] HathiTrust Research Center “capsules” - 
> https://analytics.hathitrust.org/staticcapsules
> 
> —
> Eric Morgan



Re: [CODE4LIB] python 2 versus python 3 [hathitrust]

2018-03-07 Thread Eric Lease Morgan
On Mar 7, 2018, at 3:14 PM, Eric Lease Morgan  wrote:

> [1] HathiTrust Research Center Workset Browser - 
> https://github.com/ndlib/text-analysis-htrc
> [2] HathiTrust Research Center “capsules” - 
> https://analytics.hathitrust.org/staticcapsules


On a different note, what have been your experiences with the HathiTrust and 
friends?

From my perspective, it offers a set of huge opportunities for both traditional 
librarianship (collection building) as well as scholarship (automated textual 
analysis). Yet I don’t get the feeling either the HathiTrust nor the associated 
Research Center are used/exploited to the appropriate degree. Are they too hard 
to use? Are the materials not apropos? Is there a general lack of awareness? 

'Just curious.

—
Eric M