-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
217 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Publish Python Package to PyPi | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.6' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,95 @@ | ||
 | ||
[](https://travis-ci.org/danie1k/python-black-configparser) | ||
[](https://codecov.io/gh/danie1k/python-black-configparser) | ||
[](https://pypi.org/project/black-configparser/) | ||
[](https://pypi.org/project/black-configparser/) | ||
[](https://github.com/danie1k/python-black-configparser/blob/master/LICENSE) | ||
|
||
# black-configparser | ||
|
||
Seamless proxy CLI for [black](https://pypi.org/project/black/) (The uncompromising code formatter) | ||
with support for `setup.cfg` & `tox.ini` config files. | ||
Seamless proxy CLI for [black](https://pypi.org/project/black/) *("The uncompromising code formatter")* | ||
with support for non-`pyproject.toml` config files. | ||
|
||
|
||
## Table of Contents | ||
|
||
1. [About the Project](#about-the-project) | ||
- [Why it is different?](#why-it-is-different) | ||
1. [Installation](#installation) | ||
1. [Usage](#usage) | ||
- [Example configuration](#) | ||
1. [Known issues](#known-issues) | ||
1. [License](#license) | ||
|
||
|
||
## About the Project | ||
|
||
The `black-configparser` ia yet another tool (next to [brunette](https://pypi.org/project/brunette/), | ||
[white](https://pypi.org/project/white/), and maybe a few more out there), | ||
which tries to fill [the gap of missing `setup.cfg`](https://github.com/psf/black/issues/688) | ||
(or just [any other non-`pyproject.toml`](https://github.com/psf/black/issues/683)) config file. | ||
|
||
|
||
### Why it is different? | ||
|
||
Unlike other tools, tries to stay **dumb simple** and add only minimum needed overhead to `black` usage. | ||
|
||
1. It is **seamless** - it works on the same CLI command - `black` - just passing logic through some extra code! | ||
1. There is no complex argument processing, if config file is present, the values set there are passed directly to `black`. | ||
1. Code of this tool is independent from `black` insides and will work properly | ||
as long as `black` won't make any braking changes in its command line options. | ||
|
||
|
||
## Installation | ||
|
||
``` | ||
pip install black-configparser | ||
``` | ||
|
||
|
||
## Usage | ||
|
||
- Supported configuration files: `setup.cfg`, `tox.ini`. | ||
- Configuration file section: `[black]` or `[tools:black]`. | ||
|
||
**Important!** :warning: | ||
> When you `black-configparser` finds black configuration in file, most command line arguments won't be available anymore, | ||
> except: `--check`, `--code`, `--diff`, `--help`, `--verbose` & `--version`. | ||
### Example configuration | ||
|
||
```ini | ||
[black] | ||
line-length = 120 | ||
target-version = | ||
py27 | ||
py33 | ||
py34 | ||
py35 | ||
py36 | ||
py37 | ||
py38 | ||
pyi = True | ||
skip-string-normalization = True | ||
color = True | ||
include = \.pyi?$ | ||
exclude = /(\.direnv|\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|\.svn|_build|buck-out|build|dist)/] | ||
force-exclude = lorem ipsum | ||
quiet = True | ||
verbose = True | ||
``` | ||
|
||
- Almost any option available for black (`black --help`) can be put onto config file. | ||
- Values for multi-value arguments must be one per line (separated by `\n` char). | ||
- Flags *(arguments without values)* must be set in config file as `= True`. | ||
|
||
|
||
## Known issues | ||
|
||
- Undefined behavior, when one of allowed CLI arguments will be also put inside config file. | ||
- After `black-configparser` package is uninstalled, the `black` command does not work anymore | ||
and [black](https://pypi.org/project/black/) package must be reinstalled. | ||
|
||
|
||
## License | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
#!/usr/bin/env python | ||
from setuptools import setup | ||
import collections | ||
import pathlib | ||
|
||
from setuptools import setup | ||
|
||
setup( | ||
name="black-configparser", | ||
version="0.0.5", | ||
version="0.1.0b2", | ||
author="Daniel Kuruc", | ||
author_email="[email protected]", | ||
license="MIT", | ||
url="https://github.com/danie1k/black_configparser", | ||
url="https://github.com/danie1k/python-black-configparser", | ||
project_urls=collections.OrderedDict( | ||
( | ||
("Code", "https://github.com/danie1k/python-black-configparser"), | ||
( | ||
"Issue tracker", | ||
"https://github.com/danie1k/python-black-configparser/issues", | ||
), | ||
) | ||
), | ||
description=( | ||
"Seamless Proxy CLI for black (The uncompromising code formatter) " | ||
"with support for setup.cfg & tox.ini config files" | ||
"Seamless Proxy CLI for black (\"The uncompromising code formatter\") " | ||
"with support for non-pyproject.toml config files" | ||
), | ||
long_description=(pathlib.Path(__file__).parent / "README.md").read_text("utf8"), | ||
long_description_content_type="text/markdown", | ||
|
@@ -43,4 +53,7 @@ | |
"Topic :: Software Development :: Libraries :: Python Modules", | ||
"Topic :: Software Development :: Quality Assurance", | ||
], | ||
entry_points={ | ||
"console_scripts": ["black=black_configparser.black_configparser:main"] | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.