Skip to main content

A very simple blogging library.

Project description

Minumtium

A minimal blogging library.

What can I use it for?

The purpose of minumtium is to be embedded inside simple projects like landing pages or personal portfolio pages where it is not needed to have a lot of features. The objective is to:

  • Provide a simple way to add and list posts inside a page
  • Provide a summary of the most recent posts
  • Provide (very) basic user management

It is not meant to provide a full-fledged blogging platform. Features like comments, profiles, view counters, social-network integrations and even configuration files are out of scope.

Why minimal?

The idea behind minumtium is that it should do the bare minimum: provide you the code to create posts, as well as provide a way to control who can post. That's it:

  • There are no user profiles, it accepts whatever value you pass as an author
  • There is no UI, you have to create your own or use a library that provides it
  • There are no endpoints, but there are implementations for fastapi

It is just a library that creates and lists blog posts, you can add other features by using external libraries, like building lego (a very minimal lego, though).

Why embedable?

Minumtium has been created so that it can be a library inside a bigger project. By default, it won't even provide you a UI or even REST API endpoints. The user should encapsulate minumtium inside its own code and integrate it inside its project. It is expected that you implement your own authentication adapters to allow it to integrate to your auth system and so on.

Why extensible?

Being so bare minimal would mean that minumtium is almost useless, as it is quite simple to implement its core functionality. Minumtium has been built from ground up to be extensible with custom adapters and extension libraries. Those can:

  • Provide you alternative authentication methods
  • Provide integration with different databases
  • Provide you API endpoints using libraries like Flask or FastAPI
  • Provide you Front-End endpoints using Jinja or Mako rendering

Usage

Install it using pip, or you favorite venv manager:

# Using pip
pip install minumtium
# Using pipenv
pipenv install minumtium
# Using poetry
poetry install minumtium

Always interact with the service by providing its dependencies:

from modules.posts import PostRepository, PostService
from minumtium.infra.implementations.sqlalchemy_database import SqlAlchemyAdapter

db_adapter = SqlAlchemyAdapter({'engine': 'sqlite_memory'}, 'posts')
post_repository = PostRepository(db_adapter)
post_service = PostService(post_repository)

summary = post_service.get_latest_posts_summary(count=10)

Extensions and Adapters

You may not want to write a bunch of code, and for that reason you will very likely want to use plugins. Here are some of the standard plugins:

You can refer to their repositories for more information on how to use them.

Integrating with other things

There are two things you will want to integrate:

  • The posts service at minumtium.modules.posts.PostService
  • The idm service at minumtium.modules.idm.IdmService

Integrating those services mean you will need to inject a few dependencies into them:

  • The posts service depends on the PostRepository.
  • The PostRepository depends on a DatabaseAdapter implementation.

Having a dependency injection system definitely helps out. You can take a look at the FastAPI Plugin code that is very simple and shows how this integration can be done.

Creating your own adapters

Adding support for other kinds of databases or authentication methods will consist on implementing the adapter interfaces:

  • minumtium.infra.database.adapter.DatabaseAdapter
  • minumtium.infra.authentication.adapter.AuthenticationAdapter

Those custom adapters are provided as dependencies when creating the services and the repositories.

Creating your own application

Applications are the actual implementation of something usable. An example is the Fast API REST API application. Applications are supposed to provide you a way to actually use minumtium without having to reinvent the wheel.

Applications are provided as extension libraries, that will encapsulate minumtium something like FastAPI, for example. It is up to the user to register the minumtium client inside your main client so that you have all of its routes available.

You can create your own application and distribute it as a library. Those extension libraries are supposed to wrap minumtium into something else.

Rationale

I have created this while working on my personal portfolio page. It was supposed to be much more minimal, like a single python file. As I started developing it I have decided to use it to practice both TDD and layered architectures. It is mostly a crud, so it was a good exercise and it is easy to read the source code.

Maybe it will not be so minimal as I wanted, but I learned some nice stuff along the way 😁.

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

minumtium-1.1.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

minumtium-1.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file minumtium-1.1.0.tar.gz.

File metadata

  • Download URL: minumtium-1.1.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for minumtium-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5007b1b8eb233977b0c7a43aafeca98b96a2f6e5e284201029af9f745f94fb07
MD5 26f6e0b3734d714efe9c31ad272ce691
BLAKE2b-256 88ef6b78a839409652344250012f71bd459437295ebd3c20d6c5b66a5e5d5aef

See more details on using hashes here.

File details

Details for the file minumtium-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: minumtium-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for minumtium-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 319df44ba1517427a7777bf9710022de29a7f56c9b0067a57a7bc4950356a639
MD5 1caf065ae095f1c97eab45f72ebea9fa
BLAKE2b-256 af948ef74bcb0faa81303d7ddf7e54df4fc15f35897659545bc96b5ee0796b2d

See more details on using hashes here.

Supported by

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