Another Uncompromising Code Formatter for Python.
Project description
StraitJacket: Another Uncompromising Code Formatter for Python
StraitJacket is a wrapper around black which implements post processing to perform automatic code alignment.
Project/Repo:
Code Quality/CI:
Name | role | since | until |
---|---|---|---|
Manuel Barkhau (mbarkhau@gmail.com) | author/maintainer | 2018-10 | - |
Alignment
Example of automatic alignment.
class TokenType(enum.Enum): # class TokenType(enum.Enum):
INDENT = 0 # INDENT = 0
SEPARATOR = 1 # SEPARATOR = 1
CODE = 2 # CODE = 2
Indent = str # Indent = str
RowIndex = int # RowIndex = int
ColIndex = int # ColIndex = int
OffsetWidth = int # OffsetWidth = int
TokenTable = typ.List[TokenRow] # TokenTable = typ.List[TokenRow]
Usage
Usage is exactly the same as for black
, except that the command is named sjfmt
.
$ pip install straitjacket
$ sjfmt --help
Usage: sjfmt [OPTIONS] [SRC]...
Another uncompromising code formatter.
Options:
-l, --line-length INTEGER How many characters per line to allow.
[default: 88]
--py36 Allow using Python 3.6-only syntax on all
Editors
Plugins for your editor usually support setting a custom path to black. You can simply point to sjfmt instead.
Unix
$ which sjfmt
/home/user/miniconda3/envs/py36/bin/sjfmt
$ which sjfmtd
/home/user/miniconda3/envs/py36/bin/sjfmtd
Windows
C:\Users\Username>where sjfmt
C:\Python37\Scripts\sjfmt.exe
or
PS C:\Users\ManuelBarkhau> (gcm sjfmt).Path
C:\Python37\Scripts\sjfmt.exe
[sublack]:
{
"black_command": "C:/Python37/Scripts/sjfmt.exe",
"black_line_length": 100,
// ...
}
Changelog for straitjacket
v201812.0007-alpha
TLDR: more bugfixes and updated documentation
v201812.0006-alpha
TLDR: no major changes, just bug fixes.
- Fixed #1: Disable right alignment of numbers when not preceded by a number.
- Fixed #3: Disable alignment when preceded by a multiline string.
- Fixed #4: Excessive whitespace in non aligned context.
- Fixed #8: Double and single quotes around strings not consistent
v201810.0004-alpha
- Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file straitjacket-201812.7a0.tar.gz
.
File metadata
- Download URL: straitjacket-201812.7a0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4aa85764a55d57b61f6beb6280c359b919e7f7bafd33f77ef5eb2f2a944dbb64 |
|
MD5 | 53fcda9ea5df9d251ec6082672940424 |
|
BLAKE2b-256 | 059b0f1f2a09872ac9fb48575c92d190360e64ffe5afbcf8b73084ac9600ae9f |
File details
Details for the file straitjacket-201812.7a0-py36.py37-none-any.whl
.
File metadata
- Download URL: straitjacket-201812.7a0-py36.py37-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3.6, Python 3.7
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd50d56197e73fdbbab6388916508ab37d9d68ea231ab310efce040ad831a3a3 |
|
MD5 | 2ffebf98d4d8395814270ba034dae2c7 |
|
BLAKE2b-256 | 7b379e13c1e464e93a102814f5e31cd4b7af638ae7a94be362eb94ac9b2282f2 |