Skip to main content

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 code is 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.

  • bag 1.3.0 is the last version that supported Python 3.4.

  • bag 2.0 requires Python 3.5’s “typing” module for gradual typing.

  • bag 2.1.0 is the last version that supported Python 3.5.

This version of bag was published with releaser.

Most important library contents

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

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.

Compiling the documentation

Install make, activate your virtualenv, and then:

pip install sphinx sphinx-autodoc-typehints
./build_sphinx_documentation.sh

Download files

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

Source Distribution

bag-3.0.0.tar.gz (111.7 kB view details)

Uploaded Source

Built Distribution

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

bag-3.0.0-py2.py3-none-any.whl (133.8 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: bag-3.0.0.tar.gz
  • Upload date:
  • Size: 111.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.8

File hashes

Hashes for bag-3.0.0.tar.gz
Algorithm Hash digest
SHA256 d84160e8955035597d59db5d2fd1803a2e7895784f6c6dcc431a83fec1801cd3
MD5 263b3b4169d8c009aa8a115a7f384aa4
BLAKE2b-256 0f6ffafb556bfdd801c432f0f41049c36fccf5aecd353f6c172912ebee1d146e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bag-3.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 133.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.8

File hashes

Hashes for bag-3.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 392ec652d843bc989bfd4dcb05b3d11cc832eaa0ee1cb5b4ffd2ed9a594cbab1
MD5 c4562d9f2464f61f46faaf8b3a4deff1
BLAKE2b-256 7e81c1912a8124c43693141ad34e0ee30a40b5a46e58de184525024050c4eafb

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

This release

3.0.0 This release

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

0.8.0

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