# Melanin
Melanin is a command-line utility that reformats Python files with the uncompromising [Black](https://github.com/psf/black) formatter. However, it only reformats code that has changed compared to the last [Git](https://git-scm.com/) commit, much like only skin exposed to sunlight gets darker.
> In humans, [melanin](https://wikipedia.org/wiki/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](https://pypi.org/project/melanin), 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](https://github.com/psf/black#configuration). No need for duplicates!
Raw data
{
"_id": null,
"home_page": "https://github.com/francois-rozet/melanin",
"name": "melanin",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "formatter,black,pep8,git",
"author": "Fran\u00e7ois Rozet",
"author_email": "francois.rozet@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/56/f8/d8f2b80e99196ed641897700560df3fb85c9d42db7f3b22885bde27c04d4/melanin-0.1.1.tar.gz",
"platform": null,
"description": "# Melanin\n\nMelanin is a command-line utility that reformats Python files with the uncompromising [Black](https://github.com/psf/black) formatter. However, it only reformats code that has changed compared to the last [Git](https://git-scm.com/) commit, much like only skin exposed to sunlight gets darker.\n\n> In humans, [melanin](https://wikipedia.org/wiki/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.\n\n## Installation\n\nThe `melanin` package is available on [PyPi](https://pypi.org/project/melanin), which means it is installable via `pip`.\n\n```\npip install melanin\n```\n\nAlternatively, if you need the latest features, you can install it using\n\n```\npip install git+https://github.com/francois-rozet/melanin\n```\n\n## Getting started\n\nMelanin 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.\n\nFor example, the following command reformats all Python code in the current directory (`.`) that has changed compared to the penultimate commit of the `master` branch.\n\n```\ntan --commit master~1 .\n```\n\nAnd that's it. Enjoy and don't forget to put on sunscreen!\n\n### Configuration\n\nMelanin does not implement its own configuration system, but instead steals [Black's configuration](https://github.com/psf/black#configuration). No need for duplicates!\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Darken Python code exposed to sunlight",
"version": "0.1.1",
"split_keywords": [
"formatter",
"black",
"pep8",
"git"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5118f073a217eaa76cea843065765dc37195ceb3a7603e2d4b52ab121191c3ee",
"md5": "f0ec025e6d6ad66c499bda696038accf",
"sha256": "59ce5d645afc842d22e8c475508435e7c2bd0216bb408dec608dcb8d0cc63713"
},
"downloads": -1,
"filename": "melanin-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f0ec025e6d6ad66c499bda696038accf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 6166,
"upload_time": "2023-03-19T17:11:47",
"upload_time_iso_8601": "2023-03-19T17:11:47.900374Z",
"url": "https://files.pythonhosted.org/packages/51/18/f073a217eaa76cea843065765dc37195ceb3a7603e2d4b52ab121191c3ee/melanin-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "56f8d8f2b80e99196ed641897700560df3fb85c9d42db7f3b22885bde27c04d4",
"md5": "1f1eb53fd6db25187aa658b0e2ca35ab",
"sha256": "ffb676a4946a1905de241a6bdee5192ee292f87718c4ba2f00d762ee68ba3769"
},
"downloads": -1,
"filename": "melanin-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "1f1eb53fd6db25187aa658b0e2ca35ab",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 5660,
"upload_time": "2023-03-19T17:11:48",
"upload_time_iso_8601": "2023-03-19T17:11:48.954752Z",
"url": "https://files.pythonhosted.org/packages/56/f8/d8f2b80e99196ed641897700560df3fb85c9d42db7f3b22885bde27c04d4/melanin-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-19 17:11:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "francois-rozet",
"github_project": "melanin",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "black",
"specs": [
[
">=",
"22.1.0"
]
]
},
{
"name": "GitPython",
"specs": [
[
">=",
"3.1.23"
]
]
}
],
"lcname": "melanin"
}