Medikit

Your automated release engineer assistant

Medikit automates keeping your projects' boilerplate files and directory sane and up to date.

It (optionally) generates and maintains a bunch of files, updating them according to rules you define.

It's not a dependency. All changes are commited in your source tree.

You write amazing code, Medikit focuses on keeping it clean and ordered.

Install Documentation Features

What is Medikit?

Medikit generates and updates all non-business related files in your python or polyglot projects.

It's based on a extensible features set that combines to build the exact right files (like Makefile, setup.py, MANIFEST.in, .gitignore, Dockerfile, tests directory structure, package directory structure, etc.)

Want to update your project? Run make update.

First time in a new project? Run make help.


Not a dependency

Medikit is an “eventual” dependency, meaning that developpers won't need it to actually use the project. All results of its execution are commited in your git repository.

One config file

The only configuration file required is a Projectfile, which contains regular Python code. It describes the feature you use (i.e Python, Make, Git, Docker and Pytest), the custom choices you took about them and eventually some project-specific features (wanna add a make sandwich command? Three lines in there).

One entry point

Once you run medikit update, you'll get a Makefile that contains everything a developper needs to use this project. Whatever you have, it is the exposed interface, and all newcomers can run make help to understand their possibilities.


Features

The base building blocks of a Medikit-managed projects are combinable features.

To add a feature, you need a Projectfile at your project's root (which is written in python), and require(...) the feature:

from medikit import require
python = require('python')

python.setup(
    name='acme'
)

You then need to run medikit update to apply changes to your project's codebase (or make update).

List of builtin features

Feature Description Artifacts Maturity
 Documentation Git Git SCM support (always enabled)
Files: .git/, .gitignore
Core
 Documentation Make Makefile generation support (always enabled)
Files: Makefile
Targets: make help, make install, make install-dev, make update, make update-requirements
Core
 Documentation Format Code formatting, using various tools ("black" and "isort" are the default)
Targets: make format
Stable
 Documentation Pytest Tests, using pytest (requires python)
Files: tests/*
Targets: make test
Requirements (dev): coverage, pytest, pytest-cov, pytest-sugar
Stable
 Documentation Python Python 3.5+ package using setuptools
Files: $(PACKAGE)/*, MANIFEST.in, classifiers.txt, requirements*.txt, setup.cfg, setup.py
Stable
 Documentation Sphinx Sphinx documentation generator
Targets: make docs
Stable
 Documentation Django Django project (requires python)
Files: manage.py, settings.py, urls.py, wsgi.py
Targets: make runserver
Requirements: django
Requirements (prod): gunicorn
Alpha
 Documentation Docker Docker packaging support
Files: .dockerignore, Dockerfile/Rockerfile, docker-compose.yml
Targets: make docker-build, make docker-push, make docker-run, make docker-shell
Alpha
 Documentation Nodejs Nodejs package, using Yarn
Files: package.json
Pre-Alpha
 Documentation Webpack Webpack web assets builder (requires nodejs)
Files: config/webpack.json
Pre-Alpha
 Documentation Kube Kubernetes deployment support
Targets: make kube-rollback, make kube-rollout
Dev
 Documentation Pylint Linting, using pylint (requires python)
Targets: make lint
Requirements (dev): pylint
Deprecated
 Documentation Yapf Code formatting, using yapf (requires python)
Targets: make format
Requirements (dev): yapf
Deprecated

Brew your own!

To extend medikit, you have two options.

Extend inline

If you only need a "local" extension, that is only valid in a given project, you can extend it inline in the Projectfile, most probably by listening to an event sent either by medikit, or a medikit feature.

Here is an example that extends the make feature to add an environment variable and a target:

from medikit import listen, require

make = require('make')

@listen(make.on_generate)
def on_make_generate(event):
    event.makefile['HELLO_NAME'] = 'World'
    event.makefile.add_target('hello', '@echo "Hello, $(HELLO_NAME)"', phony=True, doc="Say Hello")

All future medikit update calls will update your project with your customization.

Write a feature

The second option is to write a feature class, which is mostly a bunch of event listeners and a mechanism to autoregister into medikit.

Have a look at the builtin features source code, and write a similar class in your own package. Then, you'll just need to add it as a medikit.feature entrypoint and install your package. See medikit's own Projectfile.

As the mechanism for both inline extension and packaged features are the same, it's usually a good idea to test an idea / feature locally within a project, and only refactor it as a feature once you're satisfied enough.


License

Medikit and the surrounding material (like this website) is licensed under the Apache License, version 2.0.

The dependencies and other tools used by the features have their own licenses, please have a look at their websites if you're unsure about what's allowed.