Platform based dependencies in poetry

DateReadtime 1 minutes Tags

Problem

I have a small django project that I develop on both linux and mac. I deploy this project using the alpine version of the python docker image.

Originally, I had installed the psycopg2-binary package on my mac for local development, but once started to package up the app, I …

more ...

Tracing Functions in Python

DateReadtime 2 minutes Tags

Sometimes I want to debug the inputs and outputs of function calls to visualize flow or to follow execution passively.

Rather than adding logging statements and littering them around the code, a single decorator can be crafted to show the life cycle of a function:

def trace_args(f):
    def wrapper …
more ...

Pushing to pypi

DateReadtime 1 minutes Tags

Instructions

  1. Make setup.py in your project

    from setuptools import setup
    
    setup(name='project',
          version='1.0',
          description='thing do-er',
          author='Your Name',
          url='http://path.to.website',
          py_modules=[''],
          classifiers=['Environment :: Console',
                       'Intended Audience :: Developers',
                       'License :: OSI Approved :: MIT License',
                       'Programming Language :: Python :: 3.4',
                       'Operating System :: POSIX :: Linux',
                       'Topic …
more ...

Setting up kippo on Raspberry Pi

DateReadtime 1 minutes Tags

Downloading Kippo

  1. Download tarball from Google code.
wget https://code.google.com/p/kippo/downloads/detail?name=kippo-0.8.tar.gz
note:the project has since moved to github

2. In my case most of the traffic was attempting a sftp connection. The version of kippo that I acquired from …

more ...

Digital Ocean API Wrapper

DateReadtime 3 minutes Tags

I found myself wanting to take snapshots of my digital ocean droplets. I wrote a quick python script that wraps the api and allows me to snapshot my droplet on a regular basis.

#! /usr/bin/env python

import requests
import time

API_KEY=''
CLI_ID=''

def fetch(path, opts={}):
    opts['api_key'] = API_KEY …
more ...