Giter Club home page Giter Club logo

publicanus's Introduction

publicanus

This is the code base behind Publican, a prototype small business accounting application for the web.

I have just written this Publican prototype as my entry in the Django Dash 2012. You can currently see a demonstration here:

http://publican.rhodesmill.org

I have tried to direct my effort towards creating a beautiful and extensible core for further development. There were three main ideas that I wanted this prototype to illustrate.

  • The idea of the timeline that lives on the main page is the vision that first popped into my head, several months ago, and that eventually led to my choosing this project. It is, in miniature, exactly what I need: a view that lets me step back and look at the big picture of what tax obligations are approaching and what I will need to do to satisfy them. Of course, in the vision, there are more than two supported tax forms; but at least this prototype let me assemble all of the working pieces for the first time!

  • The interface that tax-form code uses to traverse business data was another major focus of attention. The last thing I want is to burden the authors of future Publican tax-form modules with a finicky and fragile interface; instead, I want to hide the database from them completely, and give them an easy way to view its data without getting tangled up in ORM details. I also wanted tax-form computation logic to be strongly decoupled from the rest of the application — you will note, if you review the Python code for Form 940 and Form 941, that the interface is completely functional, and persists no state at all between calls. Tax form modules do not even define any classes; they simply define functions, along with a few data structures to support HTML and PDF rendering!

  • The most exciting stunt that I had been looking forward to was filling out and rendering the PDF tax forms themselves. It really surprised me that my scheme worked, on its first try, without any complaint. Some day the process might fall over if we try giving it some obscure state tax form produced by a poor PDF export program, but for federal forms it is a staggeringly clean process. The trick is that it took two separate PDF libraries to make the process so elegant: ReportLab is the expert at producing PDF, but pyPdf is the king when it comes to assembling documents out of other pieces.

You can run the project tests — which currently ignore the web interface and instead exercise the tax form computation logic — by checking the project out and running:

$ python -m unittest publican.forms.us.tests

Finally, a note on terminology: a publican was the Roman term for a tax collector. You can think of Publican as an old patrician, well versed in all of the details of tax law, looking over your situation and helping you figure out what needs to be filed next.

Thanks for reading, and let me know if you have any questions!

publicanus's People

Contributors

brandon-rhodes avatar

Stargazers

Daniel Okey-Okoro avatar Don Onwunumah avatar Chris Chang avatar  avatar Jonathan Chu avatar Luiz Boaretto avatar

Watchers

 avatar Vladimir Ulupov avatar James Cloos avatar  avatar

publicanus's Issues

Can this be used of an example of a "Clean Architecture"?

Hi @brandon-rhodes !

I've watched your talk about The Clean Architecture in Python and it's a great idea but I can't imagine how to apply this to a Django project...

The problem is that Django heavily relies on Models through all layers of the application.
If I can't use models in my "functional core" and consider the Django ORM as I/O I can achieve this kind of architecture of course by making "adapters" that transform the ORM queries into suitable data structures to pass into the "core". But this way I'll be adding overhead and can't use a lot of the Django benefits like Generic Views, Model Forms, etc...

Does it mean that Django is not really made for this kind of architecture?

I've been trying to find any examples of Django projects built using this or any other similar architecture (hexagonal, ports&adapters...) and can't find any mentions of it...

So my only hope was to look for your own projects or ask you directly...
Do you think this repository (publicanus) can be considered a good example of such architecture?

Thanks! :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.