Skip to main content

Darken Python code exposed to sunlight

Project description

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!

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

melanin-0.0.3.tar.gz (5.2 kB view hashes)

Uploaded source

Built Distribution

melanin-0.0.3-py3-none-any.whl (6.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page