Skip to content

Commit

Permalink
chore(dev): use extend options for isort
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Mar 29, 2022
1 parent a075857 commit 24c8b73
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 136 deletions.
2 changes: 1 addition & 1 deletion dev/poetry2setup
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell --pure -p python3Packages.black -p python3Packages.tomli -p python3Packages.poetry-core -p bash -i bash
#!nix-shell --pure -p python3Packages.black -p python3Packages.poetry-core -p bash -i bash
# vim: filetype=sh

set -euo pipefail
Expand Down
19 changes: 9 additions & 10 deletions dev/poetry2setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import argparse
import re
import subprocess
import sys
from pathlib import Path

import black
import tomli
from poetry.core.factory import Factory
from poetry.core.masonry.builders.sdist import SdistBuilder

Expand All @@ -23,16 +22,16 @@ def main(args: argparse.Namespace) -> None:
code = sdist_builder.build_setup().decode("UTF-8")

# pull out black config
config = tomli.loads(input_dir.joinpath("pyproject.toml").read_text())
black_config = config["tool"]["black"]
black_config["string_normalization"] = black_config.pop(
"skip_string_normalization", False
out = subprocess.run(
["black", "--quiet", "-"],
input=code.encode("UTF-8"),
stdout=subprocess.PIPE,
)
black_config.pop("exclude", None)
out = black.format_file_contents(
code, fast=False, mode=black.Mode(**black_config)
print(
DOUBLE_PIPE_REGEX.sub("|", out.stdout.decode("UTF-8")),
file=args.output_file,
end="",
)
print(DOUBLE_PIPE_REGEX.sub("|", out), file=args.output_file, end="")


if __name__ == "__main__":
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ line_length = 79
multi_line_output = 3
include_trailing_comma = true
profile = "black"
skip_glob = ["result*", ".direnv/*"]
extend_skip = [".direnv"]
extend_skip_glob = ["result*"]
skip_gitignore = true

[tool.pydocstyle]
inherit = false
Expand Down
248 changes: 124 additions & 124 deletions setup.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 24c8b73

Please sign in to comment.