Print

Print


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 <[log in to unmask]> on behalf of Eric Lease Morgan <[log in to unmask]>
Sent: Wednesday, March 7, 2018 3:14:23 PM
To: [log in to unmask]
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