Entry_points
are used in a lot of my projects as they’re a fairly simple way of adding plugin points.
Recently I was wondering if there was a tool or site that maps them to PyPI
though I am not aware of any of them.
I spent a little time prototyping with an idea to see how much of it might be feasable.
Read More →
Django
has a System check framework
that is useful for doing automatic checks.
I wanted something similar that I could use as I update some PyPI projects
.
Thanks to asking a question on Mastodon
, I was introduced to Scientific Python’s repo-review
tool.
Read More →
Python projects support a list of URLs when creating your pyproject.toml, however I often forget the specific categories.
Similar to my add-classifiers
project, I have created uvx add-url as a helper.
Read More →
Python uses a list of “Trove classifiers
” to add some structured meta data to projects.
It can be a bit tedius to add these manually.
Combining the ease of uvx with a Python package, we can simplify this.
Read More →
I have been using salt
for quite a while (oldest commit in my personal salt states repo is 2010), but have usually taken the old approach to distributing modules.
By setting the file_roots you can automatically sync all your modules with the saltutil.sync_all command.
file_roots:
base:
- /srv/salt
- /srv/salt-kafka
- /srv/salt-forgejo
With our file_roots defined, our plugin repo looks like this
tree /srv/salt-kafka
├── LICENSE
├── README.md
└── _engines
└── kafka_consumer.py
This is useful, but for maintainability, I finally sat down to look at how to package things up more properly.
Read More →
While updating my PowerPlug ( pypi
) project, I implemented a pattern I have started using in a few other places that I use entry-points
.
By creating a custom enum using one of Django’s enumeration-types
, you can make it much easier to load these modules.
from importlib import metadata
from django.db import models
from django.utils.translation import gettext_lazy as _
class EntryPoints(models.TextChoices):
APPS = "powerplug.apps", _("Installed Apps")
REST = "powerplug.rest", _("Installed APIs")
SIGNAL = "powerplug.signal", _("Installed Signals")
TASK = "powerplug.task", _("Installed Tasks")
URLS = "powerplug.urls", _("Installed URLs")
CONTEXT = "powerplug.context", _("Installed context processor")
def group(self) -> metadata.EntryPoints:
return metadata.entry_points(group=self.value)
Using an enum like this, makes it very easy to load one of our entry points, while keeping all the
definitions for our app in a single place.
Read More →