Is Biopython a Package or Library?
Entering edit mode
21 days ago

I am confused between libraries and packages of python. Modules are python files with .py extension and when we combine different modules in some folder then it becomes a package. A combination of packages will make a library.

Pypi is python package manager so as the name suggests it contains packages, not libraries. But as I saw on the internet many people saying that biopython is a library although it is present in PyPi.

Can anyone solve my query?

Python Data Biopython • 265 views
Entering edit mode

These terms are generally used by the public interchangeably and one would be called pedantic for correcting others one way or another, so there's no strict definition IMO.

My thinking is that unless you can import Biopython, it is a library (collection) of individual packages that you import.

I think this is a question for the Stack Exchange community though, as it concerns software architecture nomenclature.

Entering edit mode
20 days ago

"Library" is a generic term that describes a type of software that you make use of within your programs rather than running the software alone.

Libraries can be implemented in different ways, in Python a library could be a module or one or more packages.

A module is a python file.

A package is a collection of modules (files) in a directory.

Biopython is a package, though the naming is somewhat confusing. When you do a

from Bio.Seq import Seq

you are importing the Seq class (the word listed last) of the Seq module located in the Bio package.

So, on your computer somewhere there will be a folder and file called:


then inside that there is a line like so:

class Seq

Biopython stands out in the oddness of its naming scheme, it precedes most modern naming schemes hence inherits quite the baggage here.

Entering edit mode

If we were to rename the py file to, would the import statement change to from Bio.Seq2 import Seq?

Entering edit mode


in the more "modern" naming schemes we recommend lowercasing modules and title-case classes to better communicate their type, if biopython were rewritten to that scheme the import would look like this:

from bio.seq import Seq

in addition, since some platforms are case insensitive (Windows and MacOS) and would be the same file, thus mixing cases in filenames can lead to all kinds of bugs and potential unintended consequences. hence best to stick with all lower case.


Login before adding your answer.

Traffic: 2383 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6