Installation¶
Python Version¶
This library has been tested with Python 2.7 and 3.6 We recommend using the latest version of Python 3 or Python 2
Dependencies¶
The core functionality of OKComputer requires
- NetworkX builds graphs for tracking dependancies
Optional dependencies¶
For certain features additional dependancies may be required. These can be installed using the Pip Extras feature.
- PyGraphviz generates images based on dependancy graph
- Jinja2 used to generate documentation based on the OKCompute application
- Sphinx documentation generation library
Virtual environments¶
Use a virtual environment to manage the dependencies for your project, both in development and in production.
What problem does a virtual environment solve? The more Python projects you have, the more likely it is that you need to work with different versions of Python libraries, or even Python itself. Newer versions of libraries for one project can break compatibility in another project.
Virtual environments are independent groups of Python libraries, one for each project. Packages installed for one project will not affect other projects or the operating system’s packages.
Python 3 comes bundled with the venv
module to create virtual
environments. If you’re using a modern version of Python, you can continue on
to the next section.
Create an environment¶
Create a project folder and a venv
folder within:
mkdir myproject
cd myproject
python3 -m venv venv
On Windows:
py -3 -m venv venv
Activate the environment¶
Before you work on your project, activate the corresponding environment:
. venv/bin/activate
On Windows:
venv\Scripts\activate
Your shell prompt will change to show the name of the activated environment.
Install OKCompute¶
Within the activated environment, use the following command to install OKCompute:
pip install okcompute
To install the extras you can run one of the following commands:
pip install okcompute[doc]
pip install okcompute[appdoc]
pip install okcompute[plot]
pip install okcompute[plot,doc,appdoc]
Specifying “doc” lets you generate documentation from your application, and “plot” is for generating images of the dependancy graphs
OKCompute is now installed. Check out the Quickstart or go to the Documentation Overview.
Installing from Source¶
If you want to install the latest commit directly, you can run:
pip install git+ssh://git@github.com/swift-nav/okcompute.git#egg=okcompute
If you have the code checked out locally you can install the pinned dependancies with:
pip install -r requirements.txt
pip install -r requirements-extras.txt
pip install -r requirements-test.txt
pip install -r requirements-doc.txt
and create an Editable Install with
pip install -e .