bag library
Functions and classes for many purposes, that I use all the time in multiple programs.
I use SQLAlchemy and Pyramid a lot.
The library is hosted at https://github.com/nandoflorestan/bag
Previously, this library was hosted at http://code.google.com/p/bag
The library is tested on Python 2.6, 2.7, 3.3 and 3.4.
For documentation on each module, please refer to its own docstrings.
This version was published with releaser.
Most important library contents
bag.csv2 – The infamous csv Python module does not support unicode; problem solved.
bag.csv3 – In web apps, uploaded files come as byte streams, so we provide a decoding generator. If you’d like the order of the CSV columns not to matter, there is a header-based reader. There is also a buffered CSV writer for outputting CSV in a web app.
bag.email_validator – The ultimate functions for email validation and domain validation, as well as an email address harvester.
bag.web.transecma – Complete solution for javascript internationalization. Compatible with jquery templates. Includes transecma.js.
bag.web.web_deps – Ensure your javascript libraries and CSS stylesheets appear in the right order, and require them from different parts of your code.
If you use the Pyramid web framework
bag.web.pyramid.angular_csrf – Make Pyramid play ball with AngularJS to achieve CSRF protection.
bag.web.pyramid.flash_msg – Advanced flash messages scheme for Pyramid.
bag.web.pyramid.locale – Easily enable and disable locales, let users switch languages, and use the browser’s languages by default.
bag.web.pyramid.nav – Simple web menu system (navigation).
bag.web.pyramid.plugins_manager – Make your Pyramid app extensible through plugins.
bag.web.exceptions – The Problem exception is good for throwing from a service layer, then caught in the view layer to be shown to the user. – Functions and base resources for context objects (Pyramid traversal).
bag.web.pyramid.routes – Make Pyramid routes and the route_path() function available to JS in the client.
bag.web.pyramid.genshi – Use the Genshi templating language with the Pyramid web framework. Though perhaps one might prefer Kajiki.
If you use SQLAlchemy
bag.sqlalchemy.context – Convenient SQLAlchemy initialization, at last.
bag.sqlalchemy.mediovaigel – Complete solution for database fixtures using SQLAlchemy.
bag.sqlalchemy.testing – Fake objects for unit testing code that uses SQLAlchemy.
bag.sqlalchemy.tricks – Various SQLAlchemy gimmicks, including a great base model class.
Commands
delete_old_branches – Deletes git branches that have already been merged onto the current branch. Optionally, filter the branches by age (in days).
reorder_po – Reorders .po files (usually after transifex messes up the order of the translations in them) so the diff is always readable.
Less important library contents
bag.bytes_box – Wraps an Image in another object that can instantiate it from a number of sources (bytes, files etc.) and then copy, resize or write it. The interface is experimental but seems to be very convenient.
bag.check_rst – Verifies reStructuredText content for correctness.
bag.console – Functions for user interaction at the console.
bag.corrupt_image – Read image files and do something if they are corrupt.
bag.file_existence_manager – Tools for finding duplicate files using hashes.
bag.file_watcher – Watches a bunch of files and when one of them is modified, runs a callback. Also useful for reloading Python modules when they are altered.
bag.log – Convenient logging initialization.
bag.html – Encode and decode HTML and XML entities.
bag.memoize – Memoize decorator with a LRU (least recently used) cache, which can take a keymaker function as an argument.
bag.more_codecs – Got text in some weird encoding that Python doesn’t know? OK, use iconv to decode it.
bag.show_progress – Don’t leave your user wondering if your program is hanging; print the progress every few seconds.
bag.streams – Functions that use streams (open files).
bag.text – Functions for working with unicode strings.
bag.time – Functions to make it easier to work with datetimes. Includes a JSON encoder that supports time, datetime and Decimal.
Metadata
Release files for bag 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bag-0.6.1.tar.gz | 92.6 kB | Details |
Release files / bag-0.6.1.tar.gz
| Download URL | bag-0.6.1.tar.gz |
|---|---|
| Size | 92.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d422ab261398f708765cf062a944a18bd18fae3799ac1a6b9f58522700e4900f
|
|
BLAKE2b-256 checksum How to use checksums |
98356e04503bbc4f1bcb42321c3c6abfb4af289356b094cc2f4563fdd27794be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |