Skip to main content

A library for parsing Talk Quote Work Get-Paid (TQWGP) text-based compliant sales and accounting documents.

Project description

Talk Quote Work Get-Paid (aka TQWGP) proposal and invoice parser

Build Status PyPI version

Your text base sales and accounting toolkit, especially designed for freelancers, by freelancers

Installing

pip install tqwgp-parser

Usage

Parsing proposals

First, declare your quote data:

my_proposal = {
    "title": "Tesla Model 3 Configurator",
    "date": "29 novembre 2016",
    "place": "Philadelphie",
    "version": "v1",
    "sect": {
        "email": "bf@bf-printer.com",
        "logo": "tests/samples/tesla_logo.png",
        "name": "BF Printer \\& Co",
    },
    "legal": {
        "address": {
            "city": "Philadelphie",
            "line1": "E Thompson Saint",
            "zip": "19125",
        },
        "siret": "999999999 00099",
    },
    "author": {
        "civility": "M.",
        "mobile": "07.73.35.51.00",
        "name": "Benjamin Franklin",
        "role": "membre",
    },
    "client": {
        "contact": {
            "civility": "M.",
            "name": "Elon Musk",
            "role": "CEO",
            "sason": "son",
        },
        "legal": {
            "address": {
                "city": "Chambourcy",
                "line1": "103 Route de Mantes",
                "zip": "78240",
            },
            "siret": "524335262 00084",
        },
        "name": "Tesla",
    },
    "object": "The current proposal includes ...\n",
    "prestations": [
        {
            "description": "Files for describing the steps of product configuration, their prices, etc.",
            "price": 5000,
            "title": "Definition of configurations",
        }
    ],
}

Note: your can look at more complete and various samples in tests/samples.

You can then process this proposal data using tqwgp_parser.parse_quote:

import pprint
from tqwgp_parser import parse_quote

my_parsed_proposal = parse_quote(my_proposal)
pprint.pprint(my_parsed_proposal)

Pro-tip: the data can be declared in flat files, for eg. using Yaml or Json formats. It could also be loaded from a database: this is your choice!

Parsing invoices

Declare your invoices data:

my_invoices = {
    "sect": {"email": "bf@bf-printer.com", "name": "BF Printer \\& Co"},
    "legal": {
        "address": {
            "city": "Philadelphie",
            "line1": "E Thompson Saint",
            "zip": "19125",
        },
        "siret": "999999999 00099",
    },
    "author": {
        "civility": "M.",
        "mobile": "07.73.35.51.00",
        "name": "Benjamin Franklin",
        "role": "membre",
    },
    "client": {
        "contact": {
            "civility": "M.",
            "name": "Elon Musk",
            "role": "CEO",
            "sason": "son",
        },
        "legal": {
            "address": {
                "city": "Chambourcy",
                "line1": "103 Route de Mantes",
                "zip": "78240",
            },
            "siret": "524335262 00084",
        },
        "name": "Tesla",
    },
    "invoices": [
        {
            "date": "5 janvier 2017",
            "lines": [{"price": 12000, "title": "Acompte devis 16-TESLA-01"}],
            "number": "17001",
            "vat_rate": 20,
        }
    ],
}

And process it with the help of tqwgp_parser.parse_invoices:

import pprint
from tqwgp_parser import parse_invoices

my_parsed_invoices = parse_invoices(my_invoices)
pprint.pprint(my_parsed_invoices)

Going further

You could then feed the processed data to your own document edition toolchain to create PDFs from it. This could include using Pandoc and LaTeX to edit the PDF (see for eg. mrzool's invoice-boilerplate setup) ; or sending it to an online PDF compiler with your own template (for eg. with a LaTeX template and LaTeX-on-HTTP), or using HTML/CSS based template (with tooks like WeasyPrint or ReLaXed).

You may also use the parsed data in a web application.


TQWGP text-base documents specification

The format of the TQWGP text-base documents is not finalized.

We'll use this repository as a working specification, through the samples and tests.


Contributing

Tests

To contribute to the parser and specification, please wrote test samples for your modifications.

The tests are written for being runned with pytest:

pipenv run pytest -vv

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

tqwgp-parser-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distributions

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

tqwgp_parser-0.1.0-py3.9.egg (7.6 kB view details)

Uploaded Egg

tqwgp_parser-0.1.0-py2.py3-none-any.whl (19.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file tqwgp-parser-0.1.0.tar.gz.

File metadata

  • Download URL: tqwgp-parser-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for tqwgp-parser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 749642ed593a0faf6da414706ad2101a886fbe9e0274690f45c257d075f83461
MD5 f05e202088eb9ce116d4e787964f70ef
BLAKE2b-256 18643a89bceeb046847a8e4039f442bd5aaf354732af6dbc71648ff5c6c64630

See more details on using hashes here.

File details

Details for the file tqwgp_parser-0.1.0-py3.9.egg.

File metadata

  • Download URL: tqwgp_parser-0.1.0-py3.9.egg
  • Upload date:
  • Size: 7.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for tqwgp_parser-0.1.0-py3.9.egg
Algorithm Hash digest
SHA256 f7e00ab378b15ab8a72b12c375a4dccab8fa521f6201707d0bae09956e5acc59
MD5 628e2c43495ff1f8debb53db20b2bb1f
BLAKE2b-256 f9b54df04dcf332d98d70d668eee4181bcb565b02aec794e7dcedfa20da89161

See more details on using hashes here.

File details

Details for the file tqwgp_parser-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: tqwgp_parser-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for tqwgp_parser-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 de31354ebb72091afda19f60ef4490eae2b826ec4e813f0955d5aaddd1f5bea0
MD5 beb7b950958b5244ec62b96557877a63
BLAKE2b-256 2d5c2d2b2d5a57cf4f2749aa0aa8908faef7390c8427164112fbd447c7f05890

See more details on using hashes here.

Supported by

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