1.1.1. Installing

1.1.1.1. Dependencies

1.1.1.1.1. Python 3

Python 3 is an absolute no-if-ands-or-buts-about-it requirement for Century, and it is probably safe to assume you have used it before (otherwise, why would you be reading this?), but just to play it safe:

Warning

python3 is different than the command-line python included with some systems, which typically refers to Python version 2.x for compatiblity reasons.

Windows Users
will need to perform a manual install, for which instructions can be found on the Python download page. Alternatively, Portable Python can be used if one does not wish to, or does not have permissions to install Python on a machine.
Mac OS X Users
should upgrade to the newest version of Python 3, preferably through macports or homebrew. Instructions on installing packages through those tools can be found on their respective webpages.
Ubuntu and Debian Linux Users

probably already have a version of Python 3 installed. Ubuntu includes it by default as of 11.10. If not, this can easily be resolved by running sudo aptitude install python3, or, if the system does not have aptitude installed, sudo apt-get install python3.

Notably, (as of writing) the CISE department servers do not have Python 3 installed (as they are on the 10.04 LTS). This issue can be resolved by copying a version of StaticPython (preferably renamed to python3) to a bin folder in your home directory. (Unfortuately the later recommended LXML dependency is not so easily resolved)

Fedora and RedHat Linux Users
Again, most users will probably already have Python 3 installed. If not, one can run yum install python3 as root.

1.1.1.1.2. LXML

The core of Century has no required dependencies besides Python 3, and so one can run Century with no extra packages. That said, almost all of the modules in lib.tasks need LXML in order to quickly perform their complex html processing and transformations.

Unfortunately, installing LXML is typically not as easy as installing Python 3. Some instructions for Windows and Mac users can be found on the LXML installation webpage. OS X users should additionally consult their package manager’s documentation and repositories.

Ubuntu and Debian users can install LXML just like they did Python 3, by running sudo aptitude python3-lxml, or sudo apt-get python3-lxml. Fedora and RedHat users can install LXML with sudo yum python-lxml (which actually contains both Python 2 and 3 versions).

1.1.1.1.3. Sphinx

Sphinx is only needed to build the documentation, and considering that you’re reading it right now, you probably don’t need to build it. However, if you do, it is installable on Debian and Ubuntu with sudo aptitude install python3-sphinx or sudo apt-get install python-sphinx.

Note

It is possible that the package is unavailable on your system, because (as of writing) the package is very new. In fact, Century 1.0’s documentation had to be built using virtualenv and Sphinx from the pypi (easy_install). If this is the case, you can either try to install it through apt-pinning or by manually downloading and installing the ‘deb’ package from the Debian Sid package page.

1.1.1.2. Century

Now that you have the dependencies out of the way, you can get onto installing Century. Being a pure-python library, installing and using it is rather trivial. One can download the latest version of Century from the github page, or alternatively (if git is installed, clone the latest bleeding-edge version from github with:

$ git clone https://github.com/CenturyDeveloper/Century.git century

The lib folder can then be lifted directly from the repository directory, and placed into a project folder. Alternatively, instead of moving over the lib directory, the library can be placed relative to a project directory, and then sys.path can be manipulated to make Python search for Century in an alternative location, like so:

# This code should execute before Century is imported for the first time.
import sys
sys.path.append(os.path.abspath("../relative/path/to/century"))

Now you’re ready to make your first program with Century!

1.1.1.2.1. Building Documentation

As an aside, if you wish to build a copy of this documentation, so that you can have have a local copy of it, or so that you can be sure to have the exact version matching your installation, this can be done by cd‘ing into the doc directory, and (on Linux or OS X) running:

$ make html

or on Windows:

$ make.bat html

The results will show up in doc/_build/html/index.html.

Alternatively, if you only want an offline copy of the documentation, it can be downloaded from the Century gh-pages branch.