Tuesday, October 25, 2016

Installing the SFC Models Python Package

sfc_models package at https://pypi.python.org/pypi/sfc_models

The Stock-Flow Consistent modelling package I have developed is now available in the Python Package Index (PyPi) as "sfc_models". It is now straightforward to install (you can use pip install sfc_models). I discuss installation options below.

Easiest Option: PyCharm Edu




PyCharm Edu is the free educational development environment that is published by JetBrains. (Link: https://www.jetbrains.com/pycharm-edu/).  There is a course which acts as an introduction to Python (pictured above).

PyCharm Edu is a full development environment, with a simplified interface when compared to the (also free) PyCharm Community Edition (which I use for Python development), or the paid professional edition. (It is unlikely a new programmer would need the features of the professional edition.)


To install the sfc_models package, go to the File->Settings menu option, and then go to the "Project Interpreter" option. You press the "+" button (highlighted above) to choose and install the package. (It is already installed on my machine, and shows up in the list of packages.

If installed correctly, you should be able to run "import sfc_models" on the Python console without an error message.

In order to get my plotting function, you will need to install the matplotlib package as well (can be installed the same way as sfc_models).

Second Easiest: Pip

If you are somewhat familiar with Python, the second way to install sfc_models is to run
pip install sfc_models
on a command console. (You may need to find the full path to "pip", which will be in the "Scripts" directory below your Python executable.

There is a lot of help available on Python package installation; it would be better to find up-to-date information than for me to reproduce it here.

Clone Source Code From GitHub

If you wish to look at the source code, the best way would be to "clone the repository" which is found on GitHub. I discuss GitHub further in this article.

The source code is available at: https://github.com/brianr747/SFC_models

If you want to look at the source, learning a bit about Git would be worthwhile. At the time of writing, there is a lot of functionality to add to the sfc_models package, and so you probably want to use Git to make updating easier. Using a development environment like PyCharm will also help, as it has tools to deal with things like changing function names safely.

(c) Brian Romanchuk 2016

No comments:

Post a Comment