Skip to main content

Build shippable virtualenvs

Project description

GoPythonGo creates Python deployment artifacts

You can go to many conferences and watch many talks on Youtube about Python deployment and they invariably
include a slide with a diagram that looks something like this:

Developer -push-> GitHub/GitLab/BitBucket -webhook-> SomeBuildServer -magic-> Fabulous cloud stuff

GoPythonGo is a opinionated, extensible, well-structured and highly configurable implementation of the arrow
that says "magic".

GoPythonGo is built around 4 ideas:

1. Python applications should always be run from a virtual environment.
2. Builds should be as fast as possible, so Python Wheels should be used and should be cached.
3. Applications should be deployed using manageable binary artifacts, like DEBs, RPMs or Docker containers and it
should be easy to switch between their type.
4. The binary artifacts should be as small as possible.

**This is still under very active development.** Currently you can use it to build .deb packages to deploy virtual
environments using Apt. It will use pbuilder or Docker to do so, it can auto-increment your version strings or integrate
with other tools that do that, it can integrate with aptly to publish your packages to your server or Amazon S3. It
includes tools to integrate with Hashicorp Vault for secure package signing using GPG and implementing build server
SSL credential management. BUT, it's still changing all the time. That said, GoPythonGo is used to distribute
GoPythonGo, so there.

Basic philosophy
GoPythonGo is built to allow you to put build configuration where it makes the most sense. In practice, this means
that the command-line tool takes it's parameters from three sources: a configuration file, environment variables and
command-line parameters. This way, keep the configuration for *how to build* with your code in a checked-in config
file, but the configuration for *assembling* your build on your build server server in environment variables or on
the command-line or a second configuration file that will be merged.

Getting started
On Debian:

1. Install the GoPythonGo and Aptly distribution keys

apt-key adv --keyserver hkp:// --recv-key DDB131CF1DF6A9CF8200799002CBD940A78049AF
apt-key adv --keyserver --recv-keys 9E3E53F19C7DE460

2. Install GoPythonGo, [aptly](, pbuilder and fpm. As `root`:

echo "deb gopythongo main" > /etc/apt/sources.list.d/gopythongo.list
echo "deb squeeze main" > /etc/apt/sources.list.d/aptly.list
apt-get update
apt-get --no-install-recommends install gopythongo aptly pbuilder ruby ruby-dev
gem install fpm

3. create a simple example project:

mkdir -p /tmp/helloworld/helloworld
cat > /tmp/helloworld/helloworld/ <<EOF
# -* encoding: utf-8 *-

def main():
print("hello world!")

if __name__ == "__main__":

cat > /tmp/helloworld/ <<EOF
#!/usr/bin/env python -u
import os
from setuptools import setup

"console_scripts": [
"helloworld = helloworld:main"

4. Create a GoPythonGo configuration:

cd /tmp/helloworld
/opt/gopythongo/bin/gopythongo --init pbuilder_deb
sed -e 's/mypackage/helloworld/g' .gopythongo/config > .gopythongo/config.1
mv .gopythongo/config.1 .gopythongo/config
sed -e 's/PACKAGENAME/helloworld/g' .gopythongo/fpm_opts > .gopythongo/fpm_opts.1
mv .gopythongo/fpm_opts.1 .gopythongo/fpm_opts

5. Create a Debian repository managed by aptly

aptly repo create helloworld

6. Build the helloworld package (-v enables verbose output):

/opt/gopythongo/bin/gopythongo -v /opt/helloworld /tmp/helloworld

7. You know what? Build it again and watch how the version number changes as GoPythonGo appends a revision number!
Also, the second build will go much faster now that the initial setup is out of the way.

8. Now install your creation

dpkg -i helloworld_1.0~dev1-1.deb

9. And run it:


10. Go party!

[Authserver]( is a full project that I'm building using gopythongo. Just look in
the .gopythongo folder and its README.

Next steps
If you create an aptly configuration file, you can use GoPythonGo to sign and push the package to, for example,
Amazon S3. Just look at GoPythonGo's own `.gopythongo` folder for examples. You should also have a look at the output
of `--debug-config` to see how GoPythonGo loads configuration from the different sources (config file, environment
variables and command-line parameters).

Future features

* Potentially add an additional class of plug-ins "composers" which execute even before the creation of the
build environment to prepare the source tree for building. These might do things like: clean up temp files,
request/download/install stuff or clone submodules.
* Add Docker Store support to build, tag and upload Docker containers
* Create integration and unittests
* Add RPM and createrepo support


GoPythonGo, meaning:

1. It's source code as published on
2. It's documentation as published on

is wholly subject to the Mozilla Public License v. 2.0 as published by the Mozilla Foundation and included with this
source code in the file "LICENSE". You can also find a copy of the full license at

"Grant of license" PGP signature.

Version: GnuPG v2


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

gopythongo-0.7.4.dev0-py3-none-any.whl (108.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page