Skip to main content

A lightweight library for working with Akoma Ntoso Act documents

Project description

https://badge.fury.io/py/cobalt.svg https://travis-ci.org/OpenUpSA/cobalt.svg

Cobalt is a lightweight Python library for working with Akoma Ntoso Act documents. It makes it easy to work with Akoma Ntoso metadata, FRBR URIs and generate Tables of Contents for a document.

It is lightweight because most operations are done on the XML document directly without intermediate objects. You still need to understand how Akoma Ntoso works.

Read the full documentation at cobalt.readthedocs.org.

Quickstart

Install using:

$ pip install cobalt

Use it like this:

>>> from cobalt import Act
>>> act = Act()
>>> act.title = "Act 10 of 1980"
>>> act.frbr_uri = "/za/act/1980/10"
>>> act.year
'1980'
>>> act.number
'10'
>>> print act.to_xml()
[ lots of xml ]

Contributing

  1. Clone the repo

  2. Install development dependencies:

    pip install -e .[dev]
  3. Make your changes

  4. Run tests:

    nosetests && flake8 cobalt
  5. Send a pull request

Releasing a New Version

  1. Run the tests!

  2. Update VERSION appropriately

  3. Update the Change Log section in README.rst

  4. Commit and push to github

  5. Release to PyPI:

    python setup.py sdist bdist_wheel upload

Change Log

0.2.1

  • When rendering HTML, ensure primary container elements and schedules have appropriate ids

0.2.0

  • When rendering HTML, scope component/schedule ids to ensure they’re unique

0.1.11

  • Render ref elements as HTML a elements

  • Optionally prepend a resolver URL before a elements

0.1.10

  • Convert EOL elements to BR when changing XML to HTML

0.1.9

  • Support dates before 1900. Contributed by rkunal.

0.1.8

  • lifecycle and identification meta elements now have a configurable source attribute

0.1.7

  • TOCElement items now include a best-effort title

0.1.6

  • Use HTML5 semantic elements section and article when generating HTML for acts

0.1.5

  • FIX use schedule FRBRalias as heading

0.1.4

  • Transforming XML to HTML now includes all attributes as data- attributes

0.1.3

  • Refactor TOC helpers into own file

  • Fix .format in FrbrUri

0.1.1

  • first release

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

cobalt-0.2.1.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

cobalt-0.2.1-py2-none-any.whl (18.1 kB view details)

Uploaded Python 2

File details

Details for the file cobalt-0.2.1.tar.gz.

File metadata

  • Download URL: cobalt-0.2.1.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cobalt-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b930a019ba2534d22f59d59f88ef7b6597cdca72e610c5c2713cc07e8a3828e8
MD5 476b70d46b72f5e1813618525a9adc7a
BLAKE2b-256 61f87d76d5f72f1aadd56459c46355b10969afe7c20b33c0393179bfe961a3cb

See more details on using hashes here.

File details

Details for the file cobalt-0.2.1-py2-none-any.whl.

File metadata

File hashes

Hashes for cobalt-0.2.1-py2-none-any.whl
Algorithm Hash digest
SHA256 6272ec98a5ea560d1db7c664d76b676a2b3779510354a53f5d9e869d9ef45fa2
MD5 bc41af66fa017f921621022a9a130633
BLAKE2b-256 440c04922260ef4bb16d3df7dfc738053fdd5160f496eb325e07be3a5368faf9

See more details on using hashes here.

Supported by

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