bag contains code for many purposes, which I find myself reusing in multiple programs – so this code must be version-controlled. I use SQLAlchemy and Pyramid a lot.
Documentation is at http://docs.nando.audio/bag/latest/
The library, tested on Python 3.4 and 3.5, is hosted at https://github.com/nandoflorestan/bag where you can do your bug reports and pull requests.
- bag 0.8.0 is the last version that supported Python 2.6.
- bag 0.9.0 is the last version that supported Python 2.7. Many modules probably still work with Python 2.7, but I do not intend to bother testing on Python 2 anymore.
This version of bag was published with releaser.
Most important library contents
- bag.csv2 – The infamous csv Python module does not support unicode; problem solved.
- bag.spreadsheet – Import CSV and Excel spreadsheets based on headers on the first row. 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.pathlib_complement – A Path subclass that does what pathlib doesn’t do.
- bag.subcommand – Use argh to dispatch to subcommands with their command-line arguments.
- bag.web.flash_msg – Advanced flash messages for any web framework. Also provided is Pyramid integration.
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.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. Tests will run much faster because no database is accessed.
- bag.sqlalchemy.tricks – Various SQLAlchemy gimmicks, including a great base model class.
Less important library contents
- 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.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.text.words – Contains lists of nouns and adjectives and can generate a random combination words – good for generating funny test data.
- bag.time – Functions to make it easier to work with datetimes. Includes a JSON encoder that supports time, datetime and Decimal.
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|bag-1.3.0-py2.py3-none-any.whl (143.2 kB) Copy SHA256 hash SHA256||Wheel||3.5||Feb 7, 2018|
|bag-1.3.0.tar.gz (118.7 kB) Copy SHA256 hash SHA256||Source||None||Feb 7, 2018|