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.

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.transecma – Complete solution for javascript internationalization. Compatible with jquery templates. Includes transecma.js.

  • bag.web.flash_msg has been removed in favor of a better module in the kerno library. It defines a rich class for UI messages to be stored in the HTTP session.

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.

  • replace_text – A simple command to replace text in many files, without worrying about regular expressions.

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

Release files for bag 5.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bag 5.0.0
File Size Uploaded
bag-5.0.0.tar.gz 102.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bag 5.0.0
File Interpreter ABI Platform
bag-5.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 217.2 kB

Release files / bag-5.0.0.tar.gz

Download URL bag-5.0.0.tar.gz
Size 102.0 kB
Tags Source
SHA-256 checksum
How to use checksums
54d1577088e31dee04c2888c96cb9aa6953f6b4274c1930d3752a9aea0eb6a93
BLAKE2b-256 checksum
How to use checksums
00317b16197d5309a99c9b86dac371e0bb7d0a9a50df0e6e18750faefcd46163
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.10.1

Release files / bag-5.0.0-py3-none-any.whl

Download URL bag-5.0.0-py3-none-any.whl
Size 115.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d876209a8206a36590f1a797069d6a183c90f0a1f39a75ad8550fb46af161c47
BLAKE2b-256 checksum
How to use checksums
babf90e58b0fb909986a8f26eb0b63c208d4e5d0aa59036cfb39799e1f0b327b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.10.1

Release history Release notifications | RSS feed

5.0.1

2 release files

This release

5.0.0 This release

2 release files

4.0.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.3.0

2 release files

1.2

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.9.0

2 release files

0.8.0

1 release file

0.7.0

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.5

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.12

1 release file

0.3.11

1 release file

0.3.10

1 release file

0.3.9

1 release file

0.3.8

1 release file

0.3.7

1 release file

0.3.6

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release 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