Some PEP‘s have revolved around the problem of software versioning and dependency tracking.
So, in addition to having some blueprints such as those proposed by the Semantic Versioning guidelines, one needs specifics on how to integrate those practices in our day to day work with version control systems.
Setuptools saves the day by introducing versioning via git tags. In a post by Douglas Creager a strategy to use setuptools with git tags is devised. The workflow for tagging a new version results in:
- Tag your release via git tag if the changes are significant.
- Run python setup.py install, to bump the version on the filesystem.
- git push.
The following code makes it happen:
# Fetch version from git tags, and write to version.py.
# Also, when git is not available (PyPi package), use stored version.py.
version_py = os.path.join(os.path.dirname(__file__), 'version.py')
version_git = subprocess.check_output(["git", "describe"]).rstrip()
with open(version_py, 'r') as fh:
version_git = open(version_py).read().strip().split('=')[-1].replace('"','')
version_msg = "# Do not edit this file, pipeline versioning is governed by git tags"
with open(version_py, 'w') as fh:
fh.write(version_msg + os.linesep + "__version__=" + version_git)
As an addition to the git tags workflow proposed by Douglas, the ‘__version__’ attribute will be stored in version.py file. This allows the versions to be tracked even when our git repository is not available (i.e, via PyPi package installation), or when such a version needs to be queried from inside your own package.
Thanks Guillermo and Brad for the feedback and suggestions on this strategy.
This post is intended to be shortened over time, eventually becoming an automated procedure… a wiki-post from dahlo’s magic until upstream patches settle down. All commands are issued on the cluster, unless otherwise stated.
Please report any issues via comments !
- Firsly, follow my earlier post on how to setup your own python virtual environment on UPPMAX.
- Once you have a prompt similar to: (devel) hostname ~$, you can continue, else, jump to 1.
- pip install drmaa Mercurial PyYAML
- Add the following env variables to your .bashrc:
- Create a file ~/.slurm_drmaa.conf with the contents:
default: "-A <your project_account> -p devel"
- hg clone http://bitbucket.org/brainstorm/galaxy-central
- Edit universe_wsgi.ini from the provided sample so that it contains:
admin_users = <your_admin_user>@example.com
enable_api = True
start_job_runners = drmaa
default_cluster_job_runner = drmaa://-A <your project_account> -p devel
- On your local machine: ssh -f <your_user>@<uppmax> -L 8080:localhost:8080 -N
- On your local machine: Fire up your browser and connect to http://localhost:8080
As a betatester you may expect some issues when running galaxy in that way. Firstly, keep in mind that it’ll not perform as fast as a production-quality setup, it’s just a developer instance. Furthermore the node you’re in might have time limit restrictions, meaning that your instance will be killed in 30 minutes if you don’t reserve a slot beforehand as Martin recommended on the section “Run galaxy on a node”.
This documentation below has been superseeded by a much simpler, generalized and automated alternative: VirtualEnv-burrito.
Continue reading →