Fattura Elettronica per la PA v0.2.1

Ho appena pubblicato su NuGet l’ultimo aggiornamento di FatturaElettronicaPA, il package .NET per la compilazione e convalida delle fatture elettroniche per la Pubblica Amministrazione. Si tratta della versione 0.2.1 che fa proprie le novità annunciate il 9 Maggio scorso:

A partire dal 9 maggio 2016 sono introdotti nuovi controlli sui file trasmessi al Sistema di Interscambio. Per consentire il necessario adeguamento al nuovo regime di verifiche, fino al 31 luglio 2016 il mancato superamento di uno o più di questi nuovi controlli non comporterà lo scarto del file ma solo una segnalazione che verrà riportata all’interno della Ricevuta di consegna o della Notifica di mancata consegna. Dal 1 agosto 2016 i file che non dovessero superare uno o più di questi controlli verranno scartati.

Se per ora i nuovi controlli non sono vincolanti, lo saranno a partire dal 1 agosto. Poiché si tratta di una serie di convalide sui conteggi consiglio di passare alla versione 0.2.1 al più presto, così da verificare che in effetti le vostre fatture elettroniche siano in linea con le aspettative della PA: potreste avere qualche sorpresa.

Nel nostro caso, per esempio, abbiamo dovuto prendere atto che gli importi imponibili relativi alle aliquote IVA, così come le corrispondenti imposte, devono essere indicati al lordo degli eventuali sconti generali del documento, pena il rifiuto dello stesso da parte del sistema di interscambio. Date una occhiata al changelog per l’elenco completo delle novità.

Voglio aggiungere un commento sulle modalità di pubblicazione degli aggiornamenti tecnici da parte di Agenzia Entrate/Sogei. Sebbene siano dotati di data e numero di versione, questi sono da considerarsi, ad essere buoni, puramente indicativi. Per esempio l’attuale versione 1.2 dell’elenco controlli è stata aggiornata “silenziosamente” un paio di giorni dopo la pubblicazione (hanno aggiunto una tolleranza di 1 Euro al controllo 00422). Così lo sviluppatore incauto che si limiti a controllare la data e il numero di versione del documento rischia di vedersi respingere fatture per lui del tutto corrette, a meno che non di prenda la briga di verificare, riga per riga, la corrispondenza tra la documentazione in suo possesso e quella disponibile sul sito in quel momento. Chiaramente in PA non hanno idea di cosa sia il Semantic Versioning.

Un ringraziamento al mio collega Stefano Gardini. Il suo nome non compare nelle commit ma, quando si stratta di fatturazione e contabilità, è come se ci fosse.

If you want to get in touch, I am @nicolaiarocci on Twitter.

My Crazy Speaking Month

April was definitely my crazy Speaking Month. After an almost one year long self-imposed conference hiatus, I was challenged to deliver four different talks, attend two discussion panels, give one live demo and release one interview. All in a three weeks period span. First I went to PyCon Sette in Florence. A few days later a plane took me to St. Petersburg, Russia, for PiterPy. Finally, the next weekend I was in Rome for the Western Europe Microsoft MVP Community Day. In the meantime several Channel 9 TecHeroes episodes were due for release. This was of course super exciting. And challenging.

This post is not much (or only) about my talks or performance, but hopefully more around the different communities I got a chance to interact with.

PyCon Sette, Florence

PyCon Italy is like home to me. Here, back in 2012, I gave my first Python talk which also happened to be my first English talk ever. Back then Italy was hosting EuroPython 2012, the general assembly of the European Python community, so we had people flying in from all over the continent (and beyond). And I was there all alone, a .NET guy who knew no one, pretending to teach pythonistas how to properly build a REST API powered by MongoDB and Flask. Talk about putting myself out of my comfort zone. That talk was important for many reasons, I won’t go into them, suffice to say that, without it, the Eve project would not exist now.

The following years I went back with more talks. After the three booming EuroPython years we saw the number of PyCon attendees drop from the 700s to the about 150 at PyCon Cinque. Following that first post-EuroPython event however the numbers started to raise. Fast. So fast, in fact, that this year we ended up celebrating the all-time high of 575 attendees. An impressive result, as it almost tops EuroPython numbers. We owe a lot to the skill, expertise and braveness of the PyCon Italy organizers. They are simply awesome, and tireless. Such a result, however, also a is a testimony of how strong, vibrant and resilient the Italian community around Python is.

This year I was there to give my first Cerberus talk. The room was packed full, everything went smoothly (at least from my perspective) and when all was done and said I was left with the impression that the project was well received. My only regret is that I totally forgot to submit the talk for the English track. I also took part in the Python Web Framework Royal Rumble, a panel in which Django, Flask, Pyramid and TurboGear champions were to fight each other. I was defending the Flask flag, and it was a lot of fun.

The Italian Python community is cozy and friendly as always, stronger than ever. PyCon in Florence keeps improving its already high standard. My only suggestion would be to reverse the English/Italian tracks ratio. I would go for an all-English conference with just one track for Italian language. I am sure a lot of guests would flock in from nearby countries. I mean who would not want to visit Florence, and Tuscany Plus, many pythonistas already have very fond memories from the Italian EuroPython years and I am sure they would love to come back.

PiterPy, St. Petersburg

PiterPy is an important and very well organized Python event which gathers attendees not only from St. Petersburg, but also from other Russian cities and nearby countries.

I was invited by the conference organizers to talk about project Eve. I was honoured, excited and curious to meet fellow pythonistas from the Eastern Europe. Other headliners were Chris Ewing, Gael Varoquaux, Hynek Schlawack, Simone Soldateschi and Fabio Natali. As you can tell, we all have different backgrounds and specialize on different things, as it should be when you want to present your audience with different interesting aspects of your stack of choice.

I did my Eve talk and then even managed to sneak in lightening talk on Cerberus. I was also interviewed by Vladimir Filonov (I think the recording is due out soon) and to my surprise the interview was not on my open source activity but rather on the Italian Python community. It turns out that in Russia they care a lot about the community, and they are eager to know more about other Python communities scattered all around Europe. Freaking awesome, if you ask me.

Organizers were professional and friendly all the time, letting me feel comfortable right from the start. In fact I was just off the plane when I met with Maxim Klymyshyn, who took me from the Airport to the conference location. The venue itself (Original Sokos Olympia Garden, conveniently located close to St. Petersburg’s city center) was probably one of the best, if not the best, conference venue I ever been at. And what about the attendees? They were very welcoming with their international guests and language barrier was not an issue as many of them speak very good English (often better than mine). Be warned however, when given the opportunity they will not hesitate to challenge the unwary speaker with the hardest of questions. I am told (by the attendees themselves) that this is in fact a trait of the Russian people. They won’t be shy when they have something to say. As a speaker, I really appreciated the attitude!

The day after the conference a cultural trip to Catherine Palace in Pushkin was planned for both speakers and attendees. That was terrific. Should you go to St. Petersburg, on a business trip or just as a tourist, make sure you visit Catherine Palace. You won’t regret it.

My eternal gratitude goes to Vladimir Shulyak and Dmitry Nazarov for taking me and my new buddy Chris Ewing out for diner and then on a super nice walk around the city center. Special thanks to Serge Matveenko, Diana Lyubavskaya and the rest of the team for inviting us and, most importantly, for putting up such a great event. I am sure PiterPy will soon become a relevant event within the international community.

Western Europe MVP Community Day, Rome

This was my first time as a MVP to a Microsoft event. Not only that. This was actually a MVP-only event and I was there to give a talk to experienced MVPs who, for the most part, have been in the program for years. Kind of intimidating, although I was reassured by the fact that my proposal had been voted by the MVP community itself.

Like at my first Python conference years ago I knew no one there, not personally at least, so it took some balls win my shyness and introduce myself to the first person I recognized, that one being Alessandro Del Sole, a long time MVP veteran. He and his pals were super nice and only moments after introducing myself to them I was already feeling part of the community. A very empowering feeling. Later during the evening and even more so the following day, at the conference, I got to meet and know a lot of new friends, all very knowledgeable in their craft, which is awesome.

I would say that the focus of the event was about Microsoft’s new openness toward other stacks and communities, which also helped in making me feel comfortable. I gave my Real Life .NET Cross Platform talk, with good feedback. SimpleCache, which was used as an example project and wasn’t really the main topic, got a lot of interest so I may actually release it on NuGet soon (blog post coming). My highlight for the event though, would be Karen Juhl keynote during which I suddenly realized that a picture of me, along with quotes from one of my articles, was being shown on stage. It took me a few seconds to realize what was going on, as it was totally unexpected. That was crazy, and mesmerizing. Later, when I got to talk with Karen, I learned that that very same slide has been used at several MVP events across Europe. So exciting!

The conference was closed by an Open Source Communities Panel, to which I was invited as a member of multiple communities.

The next day I was at the OpenDomus.net event, where I got a chance to repeat my cross platform talk (this time in Italian), and then to give a live demo of Ubuntu Bash on Windows. That one was interesting, and surprising I think, for many attendees. A few days later, with Lorenzo Barbieri, we recorded a Best of Build 2016 episode on the same topic (link below).

TecHeroes Interlude

April and March were also the months in which I and Lorenzo Barbieri recorded and released a few MSDN TecHeroes Italy episodes:

Wrapping it up

As I mentioned at the OSS panel I am lucky to have an active role in more than one community and to work every day with diverse technologies. Now, most of the times the problems tackled by these stacks are, in fact, the same. Besides the obvious differences in semantics, what really changes and is most interesting to me is the approach, the path if you will, taken by each individual stack. For me, being exposed to multiple approaches and therefore getting a chance to appreciate the differences, the pros and cons of each one (which tend to vary depending on the situation at hand) has been invaluable. I could (and probably should) fill a blog post with the things I learned working on Python that I am now using, with profit, in C#. And vice-versa.

And what about the communities? Different communities, again, expose me to different cultures. That is a good thing. Being rooted into a community is great but being active in multiple communities is even better, in essence for the same reasons you’d want to become a polyglot programmer.

So my invite is to get involved once again, no matter how active and fit you are into a stack and its community. Try something totally new, even if it doesn’t really sound like something immediately useful to you. Because you know, cross-pollination is a good thing. And you get to party twice the time, too.

If you want to get in touch, I am @nicolaiarocci on Twitter.

Eve REST API Framework v0.6.2 is out

Today I released Eve 0.6.2. It includes many fixes and improvements over the previous releases. Areas addressed are CORS management, soft deletes, token authentication, oplog, data validation, and others. Please see the changelog for details.

Work on v0.7 is also ongoing. It will include new features such as support for the MongoDB Aggregation Framework (docs) and a few breaking changes, so you might want to check it out in advance.

Special thanks to Arnau Orriols, Cyril Bonnard, Hamdy, Luca Di Gaspero, Manquer, Nick Park, Patrick Decat, Prayag Verma, Ralph Smith, Stratos Gerakakis, Valerie Coffman and Wei Guan who contributed to this release.

Real Life .NET Cross Platform

There is a new episode up at Channel9 TecHeroes. It is called Real Life .NET Cross Platform and it is about developing production-ready, cross-platform applications with today’s .NET. In the interview we talk about SimpleCache, an asynchronous, permanent and cross-platform key-value object cache powered by SQLite3. The project is still a work in progress so there is no NuGet package available yet, but it is quite usable already. The talk slides are also available.

Look mum, I’m a MVP

A few hours ago I was notified that I have been awarded with the Microsoft MVP Award for Development Technologies.

This came totally unexpected. Especially so considering that during the last few years I have been splitting my time between Microsoft and other open source technologies. My public work has mostly been on Python and MongoDB. Yes I also released .NET open source projects in the meantime (more are coming soon) and yes, I wrote a few articles here and on the MSDN Blog, attended Microsoft events and did interviews. But really, I did not expect these activities to have an impact. This is probably why only a couple minutes from learning about the award I was suffering Impostor Syndrome symptoms.

Now however, as I ponder on the whole issue a little bit, I start to realise how this could probably make (at least some sort of) sense. New Microsoft has been eager to catalyse attention and interest from the open source community and, in a broader sense, from people not yet accustomed to the brand. In light of this, people who have been active in communities other than Microsoft’s and have also been exposed to different technologies, mindsets and approaches to common IT problems could indeed offer some value. Or at least that’s how I am reading it right now.

So a new chapter is unfolding in my twenty-five years long love/hate relationship with Microsoft. It is my intent to live up to this award, for which I am very grateful.

My talk at Percona Live 2015

The slides of my talk at Percona Live 2015 (Amsterdam) are online. It was titled “MongoDB and REST APIs a Match Made in Heaven” and it was meant as an introduction to Mongo, REST principles and the Eve python framework.

Overall it has been a pleasant experience, although I found that splitting 300 attendees through seven concurrent tracks ultimately led to too much fragmentation. People often found themselves with 2-3 interesting talks all happening simultaneously, and just had to pick one.

I could only stay one day so I missed all side events, speakers dinner included, which was a bummer.

Custom endpoint handlers with Eve

On Stack Overflow and the Eve mailing list, but also in my mailbox and even on Twitter, I get a lot of enquiries on how to build custom endpoints within a Eve-powered RESTful application. Now, since within Eve all endpoints are fully customizable, what they really mean is:

How do I setup endpoints without any binding to a data entity, just connected to a custom method?

They would like to call something like /mycustomendpoint and get the response from a method they have defined somewhere in the Python sources. The standard endpoint-entity mapping provided by Eve covers 90% of their needs, but sometimes they just need endpoints that have nothing to do with data entities.

This is very easy to achieve. I’m writing it down so I can point people to this post in the future.

Eve is Flask

Eve is a Flask application and I really mean it since it is, in fact, a Flask subclass. Eve adds out-of-the-box RESTful capabilities to the Flask micro-framework. Most of the time you will be happy with just Eve’s own features but remember, the full Flask (and Werkzeug at a lower level) features set is also part of your arsenal.

Whatever you can do with Flask, you can do with Eve

So yes, of course you can easily set some functions to be invoked when a custom endpoint is hit with a request. The following snippet is a slightly modified version of Flask’s very own Quickstart tutorial:

By decorating the hello_world method with the route decorator we added a new endpoint to the application. Each time a request to /hello comes in, it will be routed to our custom method. Of course the regular API endpoints (either defined in settings.py, passed as a dict at launch, or registered live by calling the register_resource method) will also be available.

If you have an Eve authentication class securing regular API endpoints, you can apply it to your custom endpoint too. Just add a requires_auth decorator:

Say that you saved the above snippet as run.py and also have your RESTful endpoints properly configured. Launch the script:

You can now point your browser to http://localhost:5000/hello/ and enjoy the application greeting. Or you can consume any other configured API endpoint.

As all of Flask features are at your fingertips you might as well opt for registering a blueprint, which is what the awesome Eve-Docs extension is doing in order to provide a static HTML /docs endpoint on top of any Eve powered API.