Skip to main content

Melanin

Melanin is a command-line utility that reformats Python files with the uncompromising Black formatter. However, it only reformats code that has changed compared to the last Git commit, much like only skin exposed to sunlight gets darker.

In humans, melanin is the pigment responsible for the skin color and serves as protection against UV radiation. The production of melanin or melanogenesis is initiated by exposure to sunlight, causing the skin to darken. Also, melanin comes from the ancient Greek word for black.

Installation

The melanin package is available on PyPi, which means it is installable via pip.

pip install melanin

Alternatively, if you need the latest features, you can install it using

pip install git+https://github.com/francois-rozet/melanin

Getting started

Melanin shamelessly plagiarizes Black's command-line interface. The tan command replicates most options provided by black, such as --line-length, --diff, --fast and so on. The only but essential addition is the --commit option, which selects the commit to which the working tree is compared. By default, the latter is the current commit (HEAD) but any git checkout pointer (e.g. 86ccd137, HEAD~1, dev or origin/master) works.

For example, the following command reformats all Python code in the current directory (.) that has changed compared to the penultimate commit of the master branch.

tan --commit master~1 .

And that's it. Enjoy and don't forget to put on sunscreen!

Configuration

Melanin does not implement its own configuration system, but instead steals Black's configuration. No need for duplicates!

Release files for melanin 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for melanin 0.1.1
File Size Uploaded
melanin-0.1.1.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for melanin 0.1.1
File Interpreter ABI Platform
melanin-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / melanin-0.1.1.tar.gz

Download URL melanin-0.1.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ffb676a4946a1905de241a6bdee5192ee292f87718c4ba2f00d762ee68ba3769
BLAKE2b-256 checksum
How to use checksums
56f8d8f2b80e99196ed641897700560df3fb85c9d42db7f3b22885bde27c04d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / melanin-0.1.1-py3-none-any.whl

Download URL melanin-0.1.1-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59ce5d645afc842d22e8c475508435e7c2bd0216bb408dec608dcb8d0cc63713
BLAKE2b-256 checksum
How to use checksums
5118f073a217eaa76cea843065765dc37195ceb3a7603e2d4b52ab121191c3ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page