Skip to main content

A library for several purposes, including javascript i18n and stuff for the Pyramid web framework.

Project description

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.burla – Powerful URL generation independent of web frameworks, working in Python and in the client (Javascript) too. Also provided is Pyramid integration for it.

  • bag.web.flash_msg – Advanced flash messages for any web framework. Also provided is Pyramid integration.

  • 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

If you use SQLAlchemy

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.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.memoizeMemoize 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.

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

bag-1.1.0.tar.gz (116.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bag-1.1.0-py2.py3-none-any.whl (140.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file bag-1.1.0.tar.gz.

File metadata

  • Download URL: bag-1.1.0.tar.gz
  • Upload date:
  • Size: 116.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bag-1.1.0.tar.gz
Algorithm Hash digest
SHA256 06090ada6d952c678646789b731a3be30520bfb534de4b2930c7c96424c41b57
MD5 2f92abc193f91da32d9d5c182450a7b6
BLAKE2b-256 080bb54f0fe10e1fe8db87253b5cbb46906042049620fdfe553a2e07b4579f55

See more details on using hashes here.

File details

Details for the file bag-1.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: bag-1.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 140.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bag-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9a5cfe3936701f380aebb620656d6aff25e35063535a53bc275ea5c818271324
MD5 ff3fea6a4667276487a5f05914d843f2
BLAKE2b-256 89c51eefbb95c2e8f2debf1384a81474e0688ad6f6530a6e2da89be57b3ba599

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page