Skip to main content

2Style4You upgrade framework

Project description

This package implements a very minimal upgrade framework for use in Python applications. Its design consists of three parts:

  1. context providers, which are responsible for setting up the context required for an upgrade step. For example establishing a connection to a SQL server or configuring SQLALchemy.

  2. upgrade steps, which are functions that perform the actual upgrade steps.

  3. a commandline tool to run the upgrade steps and required context providers.

In order to keep the framework minimal there are a few things which are deliberately not supported:

  • No versioning of the environment is done; the tool will always run all all upgrade steps. Each step must support being run multiple times without unexpected results.

  • Downgrades are not supported.

  • Depdendencies between upgrade steps are not supported.

Here is a basic context provider which configures SQLAlchemy:

@upgrade_context('sql')
def setup_sqlalchemy(options):
    engine = create_engine('postgresql:///projectA')
    return {'sql-engine': engine}

Here is an example upgrade step to add missing tables and indices in a project using SQLALchemy:

@upgrade_step(require=['sql'])
def add_missing_tables(environment):
    meta.metadata.create_all(environment['sql-engline'])

And this is how you run the upgrade:

$ bin/upgrade --scan my.package

Project details


Download files

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

Source Distribution

s4u.upgrade-1.3.tar.gz (11.7 kB view details)

Uploaded Source

File details

Details for the file s4u.upgrade-1.3.tar.gz.

File metadata

  • Download URL: s4u.upgrade-1.3.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for s4u.upgrade-1.3.tar.gz
Algorithm Hash digest
SHA256 8064f7724c93f35658c17103eae2d4be2159b3254a44c501a27d5f1e3c422d66
MD5 fe0eae21f00cea6a4f60270b6faf4b8a
BLAKE2b-256 e01f052a553d3192189bee513260d549a586c593c77eea602912033801efd78b

See more details on using hashes here.

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