Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
🟤 A best practice Python code formatter
This is the "black" formatter but with some improvements:
--config
option supports setup.cfg
format.
single-quotes
option enables single quotes as the preferred.--single-quotes
option to make single quotes the preferred.pip install brunette
Use in the same way you would the 'black' formatter.
brunette **/*.py
brunette *.py --config=setup.cfg
brunette *.py --line-length=79 --single-quotes
Example setup.cfg
:
[tool:brunette]
line-length = 79
verbose = true
single-quotes = false
# etc, etc...
This can also be combined with Flake8's configuration:
[flake8]
# This section configures `flake8`, the python linting utility.
# See also https://flake8.pycqa.org/en/latest/user/configuration.html
ignore = E201,E202,E203
# E201 - whitespace after ‘(‘
# E202 - whitespace before ‘)’
# E203 - whitespace before ‘:’
# Exclude the git directory and virtualenv directory (as `.env`)
exclude = .git,.env
[tool:brunette]
line-length = 79
# etc, etc...
The current maintainer of Black, refuses to allow a single-quotes option. Due to his own personal preference (a preference which most of the Python community do not share).
The current maintainer of Black, refuses to add setup.cfg support. Setup.cfg is the most widely used configuration file for Python projects. The maintainer of that library prefers "pyproject.toml" few people use at this time due to it's inflexibility and it requiring you to use Poetry, whatever that is.
The current configuration file format as adopted by Black may conflict with the new build isolation context with pip
. To avoid this, the use of a setup.cfg
file is preferred but the policy is under review by the maintainers (https://github.com/pypa/pip/issues/8437#issuecomment-644196428).
which brunette
(Linux)where brunette
(Windows)In my case this looks like /home/work/.pyenv/shims/brunette
. On Windows thats more like C:\Python39\Scripts\brunette.exe
. Now copy whatever that value is.\
Open the setttings UI.
Search for black.
black
as the Python Formatting Provider.--single-quotes
you like to the Black ArgsRun pip install pre-commit
to install
Add a local repo option for brunette in .pre-commit-config.yaml
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/odwyersoftware/brunette
rev: 0.2.7
hooks:
- id: brunette
# Drop-in replacement for black with brunette
# - repo: https://github.com/psf/black
# rev: stable
# hooks:
# - id: black
# language_version: python3.6
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.1
hooks:
- id: flake8
Run pre-commit install
to install the Git pre-commit hook
Run pre-commit run
to validate all files
22.1.0
+.black.find_project_root
.--single-quotes
CLI option.normalize_string_quotes
from black.__main__
for CLI exec.FAQs
A best practice Python code formatter
We found that brunette demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.