Skip to main content

A library to parse MT940 files and returns smart Python collections for statistics and manipulation.

Project description

=====
MT940
=====


.. image:: https://travis-ci.org/WoLpH/mt940.svg?branch=master
:alt: MT940 test status
:target: https://travis-ci.org/WoLpH/mt940

.. image:: https://badge.fury.io/py/mt-940.svg
:alt: MT940 Pypi version
:target: https://pypi-hypernode.com/pypi/mt-940

.. image:: https://coveralls.io/repos/WoLpH/mt940/badge.svg?branch=master
:alt: MT940 code coverage
:target: https://coveralls.io/r/WoLpH/mt940?branch=master

.. image:: https://img.shields.io/pypi/pyversions/mt-940.svg
:alt: Supported Python versions
:target: https://crate.io/packages/mt-940?version=latest

``mt940`` - A library to parse MT940 files and returns smart Python collections
for statistics and manipulation.

Links
-----

* Documentation
- http://mt940.readthedocs.org/en/latest/
* Source
- https://github.com/WoLpH/mt940
* Bug reports
- https://github.com/WoLpH/mt940/issues
* Package homepage
- https://pypi-hypernode.com/pypi/mt-940
* My blog
- http://wol.ph/

Install
-------

To install the latest release:

.. code-block:: bash

pip install mt-940

Or if `pip` is not available:

.. code-block:: bash

easy_install mt-940

To install the latest development release:

.. code-block:: bash

git clone --branch develop https://github.com/WoLpH/mt940.git mt940
cd ./mt940
virtualenv .env
source .env/bin/activate
pip install -e .

To run the tests you can use the `py.test` command or just run `tox` to test
everything in all supported python versions.

Usage
-----

Basic parsing:

.. code-block:: python

import mt940
import pprint

transactions = mt940.parse('tests/jejik/abnamro.sta')

print 'Transactions:'
print transactions
pprint.pprint(transactions.data)

print
for transaction in transactions:
print 'Transaction: ', transaction
pprint.pprint(transaction.data)

Set opening / closing balance information on each transaction:

.. code-block:: python

import mt940
import pprint

mt940.tags.BalanceBase.scope = mt940.models.Transaction

# The currency has to be set manually when setting the BalanceBase scope to Transaction.
transactions = mt940.models.Transactions(processors=dict(
pre_statement=[
mt940.processors.add_currency_pre_processor('EUR'),
],
))

with open('tests/jejik/abnamro.sta') as f:
data = f.read()

transactions.parse(data)

for transaction in transactions:
print 'Transaction: ', transaction
pprint.pprint(transaction.data)

Contributing
------------

Help is greatly appreciated, just please remember to clone the **development**
branch and to run `tox` before creating pull requests.

Travis tests for `flake8` support and test coverage so it's always good to
check those before creating a pull request.

Development branch: https://github.com/WoLpH/mt940/tree/development

Info
----

============== ==========================================================
Python support Python 2.7, >= 3.3
Blog http://wol.ph/
Source https://github.com/WoLpH/mt940
Documentation http://mt940.rtfd.org
Changelog http://mt940.readthedocs.org/en/latest/history.html
API http://mt940.readthedocs.org/en/latest/modules.html
Issues/roadmap https://github.com/WoLpH/mt940/issues
Travis http://travis-ci.org/WoLpH/mt940
Test coverage https://coveralls.io/r/WoLpH/mt940
Pypi https://pypi-hypernode.com/pypi/mt-940
Ohloh https://www.ohloh.net/p/mt-940
License `BSD`_.
git repo .. code-block:: bash

$ git clone https://github.com/WoLpH/mt940.git
install dev .. code-block:: bash

$ git clone https://github.com/WoLpH/mt940.git mt940
$ cd ./mt940
$ virtualenv .env
$ source .env/bin/activate
$ pip install -e .
tests .. code-block:: bash

$ py.test
============== ==========================================================

.. _BSD: http://opensource.org/licenses/BSD-3-Clause
.. _Documentation: http://mt940.readthedocs.org/en/latest/
.. _API: http://mt940.readthedocs.org/en/latest/modules.html


=========
Changelog
=========

Here you can find the recent changes to MT940..

A complete list of changes can be read through the commit log:
https://github.com/WoLpH/mt940/commits/develop

.. changelog::
:version: dev
:released: Ongoing

.. change::

Added mt940 transaction detail parser.

Just look at the commits and you'll see :)

.. changelog::
:version: 3.2
:released: 2015-08-15

.. change::
:tags: project, tests

Added support for final and intermediate opening/closing balance

.. changelog::
:version: 3.1
:released: 2015-08-12

.. change::
:tags: project, tests

Fixed bug that allowed non-tags (for example, timestamps)
to be recognized as tags.

.. changelog::
:version: 3.0
:released: 2015-07-11

.. change::
:tags: project, docs, tests, coverage, python 3

Pretty large rewrite with Python 3 support, 100% test coverage,
coveralls support and more

.. changelog::
:version: 2.1
:released: 2015-05-24

.. change::
:tags: project, docs, tests, coverage

Enabled coveralls, added more docs, improved tests

.. changelog::
:version: 2.0
:released: 2015-05-24

.. change::
:tags: project, docs, tests, coverage

Large rewrite and 100% test coverage

.. changelog::
:version: 1.0
:released: 2014-04-09

.. change::
:tags: project

First release on PyPi.

.. todo:: vim: set filetype=rst:

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

mt-940-4.8.1.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

mt_940-4.8.1-py2.py3-none-any.whl (21.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file mt-940-4.8.1.tar.gz.

File metadata

  • Download URL: mt-940-4.8.1.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mt-940-4.8.1.tar.gz
Algorithm Hash digest
SHA256 1dadaf0b7b25ddc9a08bb2f686f80190e385fb1d0e0fbb210478d2d6b025274f
MD5 d205f8a70b4a6eadea6f398db4976541
BLAKE2b-256 2c9f4fe62f7877c931ec9c9c9a486d3e520ca51f2fa771d5e276257052ed65e9

See more details on using hashes here.

File details

Details for the file mt_940-4.8.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for mt_940-4.8.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5a5abab9271a30b5220b276546363f92d1ab4cf485f2c0dc95c8428d84cf453d
MD5 f1a403e6e0c628127c136b3ccd521589
BLAKE2b-256 7fd8a53299367b01391a756199032e0d2b70d17b4035cef7bb81a4fdb13f25c6

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