Skip to main content

About tgext.evolve

tgext.evolve is a TurboGears2 extension for generic migrations and evolutions.

tgext.evolve is safe to be used in multiprocessing and multithreading environments as it relies on a distributed lock on your database to perform evolutions.

During the evolution period the application will respond with a 503 status code, feel free to configure TurboGears to trap it and use your ErrorController to provide a custom page.

Installing

tgext.evolve can be installed from pypi:

pip install tgext.evolve

should just work for most of the users.

Enabling

To enable tgext.evolve put inside your application config/app_cfg.py the following:

import tgext.evolve
tgext.evolve.plugme(base_config, options={
    'evolutions': [
        # ... Your evolutions ...
    ]
})

or you can use tgext.pluggable when available:

from tgext.pluggable import plug
plug(base_config, 'tgext.evolve', evolutions=[
    # ... Your evolutions ...
])

tgext.evolve can then be disabled using the tgext.evolve.enabled = false option in your configuration files. This is often the case during test suites.

Using Evolutions

Evolutions are a subclass of tgext.evolve.Evolution that must provide an evolution_id property and an evolve() method.

Here is a sample evolution that does not much apart waiting for 10 seconds:

import time
from tgext.evolve import Evolution

class TestEvolution1(Evolution):
    evolution_id = 'test_evolution_1'

    def evolve(self):
        time.sleep(10)

Please note that in case you modify data or touch the database through model.DBSession or other manners you must flush and commit your UnitOfWork and Transaction yourself as evolutions are performed outside the transaction manager in a separated thread.

Then you can register your evolution with something like:

from tgext.pluggable import plug
plug(base_config, 'tgext.evolve', evolutions=[
    TestEvolution1
])

In case your evolution requires parameters you can register an instance of it instead of registering the class.

ChangeLog

0.0.5

  • small bugfix and deprecation gardening

0.0.4

  • small Python3 compatibility fixes

0.0.3

  • Experimental support for SQLAlchemy, tested on SQLite and MySQL.

0.0.2

  • Allow disabling tgext.evolve using tgext.evolve.enabled = False in .ini files.

0.0.1

  • First release with only MongoDB/Ming support.

Release files for tgext.evolve 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tgext.evolve 0.0.5
File Size Uploaded
tgext.evolve-0.0.5.tar.gz 5.3 kB Details

Release files / tgext.evolve-0.0.5.tar.gz

Download URL tgext.evolve-0.0.5.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d6dc8f03999df622572a2f617359e87e296de79d6734bc3fcc963a318b6b913b
BLAKE2b-256 checksum
How to use checksums
8385d28be8baac973968add302e5ca3379747b8ca74d42ca479c0d8a16d2e3a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/2.7

Release history Release notifications | RSS feed

This release

0.0.5 This release

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page