Skip to main content

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, 3.4 and 3.5.

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

Download files

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

Source Distribution

bag-0.8.0.tar.gz (116.2 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for bag-0.8.0.tar.gz
Algorithm Hash digest
SHA256 2c0a2e22d394e45be1fd4c88518645f38947129f3def7993109c58e7fa0c379c
MD5 dcf118977d6f4385fe81bef8d333d569
BLAKE2b-256 f01c9426e2d12f3b36858dc4014c117c2f77268b52fcd5c7c7a2a4040d879aa4

See more details on using hashes here.

Release history Release notifications | RSS feed

5.0.1

2 files

5.0.0

2 files

4.0.0

2 files

3.1.0

2 files

3.0.0

2 files

2.1.0

2 files

2.0.0

2 files

1.3.0

2 files

1.2

2 files

1.1.0

2 files

1.0.0

2 files

0.9.0

2 files

This release

0.8.0 This release

1 file

0.7.0

1 file

0.6.1

1 file

0.6.0

1 file

0.5.0

1 file

0.4.5

1 file

0.4.4

1 file

0.4.3

1 file

0.4.2

1 file

0.4.1

1 file

0.4.0

1 file

0.3.12

1 file

0.3.11

1 file

0.3.10

1 file

0.3.9

1 file

0.3.8

1 file

0.3.7

1 file

0.3.6

1 file

0.3.5

1 file

0.3.4

1 file

0.3.3

1 file

0.3.2

1 file

0.3.1

0.3

0.2.0

0.1.2

0.1.1

0.1.0

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