Before I begin I'm going to apologise for two things: Firstly, this isn't a mod but rather a peripheral framework. So if you were looking for some way to shrink peripherals then I'm sorry. Secondly, I'm rubbish at writing (as you may have already gathered :)/>) and so am going to write this in a Q&A format rather than just a massive wall of text.

What?
I hate writing IPeripheral implementations. It isn't that the API is bad, but I just get buried with switch statements and validation and can't focus on the important bit: the code. I was reading a blog post by ElvishJerricco where he has the same problem and did something odd with enums. It was all very clever but I did think to myself 'I can do better'.

Why not OpenPeripheral?
OpenPeripheral and theoriginalbit's Peripheral-Framework try to achieve a similar thing to Petit - abstracting away the peripheral interface so you can get on with writing code. However they both use reflection instead, adding another layer of overhead to method calls. They both are required libraries at run-time, another thing for your user to install. I think both libraries are wonderful but also 'I can do better'. (Also I suffer from not invented here syndrome).

Zero-dependency you say?
Petit approaches the task of a peripheral framework in a different way. It also generates wrappers for your peripheral, but this is done entirely at compile time instead. This means your wrapper is only generated once, and then doesn't need to depend on any of Petit's libraries.

What's this I head about minimal-overhead?
As everything is done at compile time Petit can spend a bit more time generating code. Petit aims to generate conversion code that is just as efficient as the code you would have to write manually. That, and the lack of reflection, means the only overhead you will achieve is that of an additional method call.

But how can I extend it if everything is done at compile time?
This is where Petit falls down slightly. You can register custom converters using the @Inbound and @Outbound annotations which solves 90% of problems. However if you want to add custom transformers or backends then your probably better of sending a pull request.

Backends?
Petit does have support enabled for multiple backends - whilst only ComputerCraft is supported I am looking into OpenComputers support.

What isn't implemented yet?
Lots of things. Have a todo list of what you can get excited about in the future:
  • Documentation generator - generate documentation from Javadoc and allow you to get it through the peripheral
  • Extending peripherals - have another peripheral you want to extend? Simples!
  • Overloading - method overloading is always fun.
So yeah, this is still very much a work in progress.

So, how do I get started?
You can download the latest version. Or add http://maven.bonzodandd.co.uk/ to your build.gradle along with compile "org.squiddev:petit-peripheral:0.1". There currently isn't any documentation (sorry), but having a read through the tests directory should give you an idea. Basically any peripheral annotated with @Peripheral("myawesomeperipheral") will generate a class with the same name and "_Peripheral" appended to the end. You can then use that class (or get it through reflection) to create new peripheral instances.

If you really like me, then feel free to post an issue on the GitHub (or this topic) with some feedback, suggestions or even some code.