Improve doc and prepare for 0.1 release.

This commit is contained in:
Albert Cervera i Areny 2013-09-24 19:19:54 +02:00
parent 29ee5cbe8c
commit ba58ee049c
14 changed files with 102 additions and 34 deletions

View file

@ -1 +1,2 @@
Version 0.1 - 2013-09-24
* Initial release

18
README
View file

@ -2,8 +2,11 @@ retrofix
========
RetroFix is a python library for reading and writing fixed-size field text file
and more specifically for managing files from Spanish banks and public
institutions, including Norma 19, 32, 34, 43 & 58.
and more specifically for managing files from Spanish banks and public
institutions, including:
- CSB 19, 32, 34 (several versions), 43 & 58
- AEAT 303, 340, 347 & 349
Installing
----------
@ -13,17 +16,13 @@ See INSTALL
Package Contents
----------------
bin/
Script for startup.
doc/
sphinx documentation in reStructuredText.
To generate the HTML:
documentation in reStructuredText. To generate the HTML:
sphinx-build doc/ doc/
make html
retrofix/
retrofix sources.
retrofix sources
Support
-------
@ -37,4 +36,3 @@ Copyright
---------
See project files for the complete list of Copyright owners.

View file

@ -2,6 +2,76 @@ RetroFix documentation
======================
RetroFix is a python library for reading and writing fixed-size field text file
and more specifically for managing files from Spanish banks and public
institutions, including Norma 19, 32, 34, 43 & 58.
and more specifically for managing files from Spanish banks and public
institutions, including:
- CSB 19, 32, 34 (several versions), 43 & 58
- AEAT 303, 340, 347 & 349
Defining record structures
--------------------------
RetroFix allows an easy way to define the structure of fixed size records by
creating a tuple which contains a tuple of size 4 for each field, containing:
start position, length, name and type.
Start position and length are numeric fields which define where the field is
located in a given record. The name is the internal name of the field and type
is a class or instance of a class inheriting retrofix.fields.Field.
RetroFix provides the following field types (new ones can also be created):
Char
This is the simplest one and stores the content in a string.
Const
This one inherits Char but ensures that the record contains the exact
characters defined as parameter of the constructor.
Account
Inherits Char but checks that the value of the field is a valid bank account
number as defined by Spanish bank number format.
Numeric
Used for numeric fields. You can get and set the value using Decimals.
Integer
Just like Numeric but with integers.
Date
Ensures the field matches the date format supplied to the constructor.
Selection
Only allows a given set of string values supplied to the constructor.
Boolean
Similar to selection but only two values are accepted (supplied to the
constructor) and you can set and get the values using a boolean.
Take a look at the following example:
::
from retrofix import record
from retrofix.fields import *
RECORD = (
( 1, 2, 'record_type', Const('XX')),
( 3, 10, 'name', Char),
( 33, 15, 'amount', Number(sign=SIGN_N)),
( 38, 17, 'date', Date('%d%m%y')),
)
def read(data):
lines = data.splitlines()
records = []
current_line = lines.pop(0)
records.append(record.Record.extract(current_line, RECORD))
return records
lines = read(open('myfile.txt', 'r').read())
f = open('newfile.txt')
try:
f.write(record.write(lines))
finally:
f.close()

View file

@ -1,7 +1,7 @@
# encoding: utf8
##############################################################################
#
# Copyright (C) 2011-2012 NaN Projectes de Programari Lliure, S.L.
# Copyright (C) 2011-2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
#
# This program is free software: you can redistribute it and/or modify

View file

@ -1,7 +1,7 @@
# encoding: utf8
##############################################################################
#
# Copyright (C) 2011-2012 NaN Projectes de Programari Lliure, S.L.
# Copyright (C) 2011-2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
#
# This program is free software: you can redistribute it and/or modify

View file

@ -1,7 +1,7 @@
# encoding: utf8
##############################################################################
#
# Copyright (C) 2011-2012 NaN Projectes de Programari Lliure, S.L.
# Copyright (C) 2011-2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
#
# This program is free software: you can redistribute it and/or modify

View file

@ -1,7 +1,7 @@
# encoding: utf8
##############################################################################
#
# Copyright (C) 2011-2012 NaN Projectes de Programari Lliure, S.L.
# Copyright (C) 2011-2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
#
# This program is free software: you can redistribute it and/or modify

View file

@ -1,7 +1,7 @@
# encoding: utf8
##############################################################################
#
# Copyright (C) 2011-2012 NaN Projectes de Programari Lliure, S.L.
# Copyright (C) 2011-2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
#
# This program is free software: you can redistribute it and/or modify

View file

@ -1,7 +1,7 @@
# encoding: utf8
##############################################################################
#
# Copyright (C) 2011-2012 NaN Projectes de Programari Lliure, S.L.
# Copyright (C) 2011-2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
# Copyright (c) 2013 Zikzakmedia S.L. (http://zikzakmedia.com)
#

View file

@ -1,7 +1,7 @@
# encoding: utf8
##############################################################################
#
# Copyright (C) 2011-2012 NaN Projectes de Programari Lliure, S.L.
# Copyright (C) 2011-2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
#
# This program is free software: you can redistribute it and/or modify

View file

@ -1,7 +1,7 @@
# encoding: utf8
##############################################################################
#
# Copyright (C) 2011-2012 NaN Projectes de Programari Lliure, S.L.
# Copyright (C) 2011-2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
#
# This program is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
##############################################################################
#
# Copyright (C) 2011-2012 NaN Projectes de Programari Lliure, S.L.
# Copyright (C) 2011-2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
#
# This program is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
##############################################################################
#
# Copyright (C) 2011-2012 NaN Projectes de Programari Lliure, S.L.
# Copyright (C) 2011-2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
#
# This program is free software: you can redistribute it and/or modify
@ -18,8 +18,7 @@
#
##############################################################################
PACKAGE = "retrofix"
VERSION = "1.0"
LICENSE = "GPL-3"
WEBSITE = "http://www.NaN-tic.com/"
PACKAGE = 'retrofix'
VERSION = '0.1'
LICENSE = 'GPL-3'
WEBSITE = 'http://www.NaN-tic.com/'

View file

@ -2,7 +2,7 @@
# encoding: utf8
##############################################################################
#
# Copyright (C) 2011-2012 NaN Projectes de Programari Lliure, S.L.
# Copyright (C) 2011-2013 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
#
# This program is free software: you can redistribute it and/or modify
@ -29,6 +29,7 @@ execfile(os.path.join('retrofix', 'version.py'))
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name=PACKAGE,
version=VERSION,
description='retrofix',
@ -36,13 +37,12 @@ setup(name=PACKAGE,
author='NaN·tic',
author_email='info@nan-tic.com',
url=WEBSITE,
download_url="http://www.nan-tic.com/" + \
VERSION.rsplit('.', 1)[0] + '/',
download_url='http://www.nan-tic.com/' + VERSION.rsplit('.', 1)[0] + '/',
packages=find_packages(),
package_data={
'retrofix.tests': ['c19.txt', 'c32.txt', 'c34.txt', 'c43.txt',
'retrofix.tests': ['c19.txt', 'c32.txt', 'c34.txt', 'c43.txt',
'c58.txt'],
},
},
scripts=[],
classifiers=[
'Development Status :: 5 - Production/Stable',
@ -53,7 +53,7 @@ setup(name=PACKAGE,
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Software Development :: Libraries',
],
],
license=LICENSE,
install_requires=[
'banknumber >= 1.0',
@ -61,4 +61,4 @@ setup(name=PACKAGE,
extras_require={},
zip_safe=False,
test_suite='retrofix.tests',
)
)