Skip to content

Commit

Permalink
Fork into Tan
Browse files Browse the repository at this point in the history
  • Loading branch information
jleclanche authored and sciyoshi committed Aug 10, 2023
1 parent 193ee76 commit 800ce65
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 51 deletions.
17 changes: 0 additions & 17 deletions .github/dependabot.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- id: black
name: black
description: "Black: The uncompromising Python code formatter"
entry: black
entry: tan
language: python
minimum_pre_commit_version: 2.9.2
require_serial: true
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def make_pypi_svg(version: str) -> None:

# Autopopulate version
# The version, including alpha/beta/rc tags, but not commit hash and datestamps
release = get_distribution("black").version.split("+")[0]
release = get_distribution("tan").version.split("+")[0]
# The short X.Y version.
version = release
for sp in "abcfr":
Expand Down
2 changes: 1 addition & 1 deletion docs/usage_and_configuration/black_as_a_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ formatting requests.
`blackd` provides even less options than _Black_. You can see them by running
`blackd --help`:

```{program-output} blackd --help
```{program-output} tand --help
```

Expand Down
46 changes: 23 additions & 23 deletions docs/usage_and_configuration/the_basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Note that all command-line options listed above can also be configured using a
Format the code passed in as a string.

```console
$ black --code "print ( 'hello, world' )"
$ tan --code "print ( 'hello, world' )"
print("hello, world")
```

Expand All @@ -57,7 +57,7 @@ versions that your code supports. If you support Python 3.7 through 3.10, you sh
write:

```console
$ black -t py37 -t py38 -t py39 -t py310
$ tan -t py37 -t py38 -t py39 -t py310
```

In a [configuration file](#configuration-via-a-file), you can write:
Expand All @@ -72,17 +72,17 @@ after `*args` in a function call was added in Python 3.5, so _Black_ will add th
only if the target versions are all Python 3.5 or higher:

```console
$ black --line-length=10 --target-version=py35 -c 'f(a, *args)'
$ tan --line-length=10 --target-version=py35 -c 'f(a, *args)'
f(
a,
*args,
)
$ black --line-length=10 --target-version=py34 -c 'f(a, *args)'
$ tan --line-length=10 --target-version=py34 -c 'f(a, *args)'
f(
a,
*args
)
$ black --line-length=10 --target-version=py34 --target-version=py35 -c 'f(a, *args)'
$ tan --line-length=10 --target-version=py34 --target-version=py35 -c 'f(a, *args)'
f(
a,
*args
Expand Down Expand Up @@ -134,20 +134,20 @@ Passing `--check` will make _Black_ exit with:
- code 123 if there was an internal error

```console
$ black test.py --check
$ tan test.py --check
All done! ✨ 🍰 ✨
1 file would be left unchanged.
$ echo $?
0

$ black test.py --check
$ tan test.py --check
would reformat test.py
Oh no! 💥 💔 💥
1 file would be reformatted.
$ echo $?
1

$ black test.py --check
$ tan test.py --check
error: cannot format test.py: INTERNAL ERROR: Black produced code that is not equivalent to the source. Please report a bug on https://github.com/psf/black/issues. This diff might be helpful: /tmp/blk_kjdr1oog.log
Oh no! 💥 💔 💥
1 file would fail to reformat.
Expand All @@ -163,7 +163,7 @@ would've made. They are printed to stdout so capturing them is simple.
If you'd like colored diffs, you can enable them with `--color`.

```console
$ black test.py --diff
$ tan test.py --diff
--- test.py 2021-03-08 22:23:40.848954+00:00
+++ test.py 2021-03-08 22:23:47.126319+00:00
@@ -1 +1 @@
Expand Down Expand Up @@ -192,20 +192,20 @@ of _Black_ may format code a little differently. This option can be set in a
configuration file for consistent results across environments.

```console
$ black --version
$ tan --version
black, 23.7.0 (compiled: yes)
$ black --required-version 23.7.0 -c "format = 'this'"
$ tan --required-version 23.7.0 -c "format = 'this'"
format = "this"
$ black --required-version 31.5b2 -c "still = 'beta?!'"
$ tan --required-version 31.5b2 -c "still = 'beta?!'"
Oh no! 💥 💔 💥 The required version does not match the running version!
```

You can also pass just the major version:

```console
$ black --required-version 22 -c "format = 'this'"
$ tan --required-version 22 -c "format = 'this'"
format = "this"
$ black --required-version 31 -c "still = 'beta?!'"
$ tan --required-version 31 -c "still = 'beta?!'"
Oh no! 💥 💔 💥 The required version does not match the running version!
```

Expand Down Expand Up @@ -255,7 +255,7 @@ Passing `-q` / `--quiet` will cause _Black_ to stop emitting all non-critical ou
Error messages will still be emitted (which can silenced by `2>/dev/null`).

```console
$ black src/ -q
$ tan src/ -q
error: cannot format src/black_primer/cli.py: Cannot parse: 5:6: mport asyncio
```

Expand All @@ -266,7 +266,7 @@ were not changed or were ignored due to exclusion patterns. If _Black_ is using
configuration file, a blue message detailing which one it is using will be emitted.

```console
$ black src/ -v
$ tan src/ -v
Using configuration from /tmp/pyproject.toml.
src/blib2to3 ignored: matches the --extend-exclude regular expression
src/_black_version.py wasn't modified on disk since last run.
Expand All @@ -284,8 +284,8 @@ Oh no! 💥 💔 💥
You can check the version of _Black_ you have installed using the `--version` flag.

```console
$ black --version
black, 23.7.0
$ tan --version
tan, 23.7.0
```

#### `--config`
Expand Down Expand Up @@ -316,7 +316,7 @@ _Black_ supports formatting code via stdin, with the result being printed to std
Just let _Black_ know with `-` as the path.

```console
$ echo "print ( 'hello, world' )" | black -
$ echo "print ( 'hello, world' )" | tan -
print("hello, world")
reformatted -
All done! ✨ 🍰 ✨
Expand Down Expand Up @@ -349,7 +349,7 @@ usefulness and conciseness. By default, _Black_ emits files modified and error m
plus a short summary.

```console
$ black src/
$ tan src/
error: cannot format src/black_primer/cli.py: Cannot parse: 5:6: mport asyncio
reformatted src/black_primer/lib.py
reformatted src/blackd/__init__.py
Expand Down Expand Up @@ -456,9 +456,9 @@ file hierarchy.

## Next steps

A good next step would be configuring auto-discovery so `black .` is all you need
instead of laborously listing every file or directory. You can get started by heading
over to [File collection and discovery](./file_collection_and_discovery.md).
A good next step would be configuring auto-discovery so `tan .` is all you need instead
of laborously listing every file or directory. You can get started by heading over to
[File collection and discovery](./file_collection_and_discovery.md).

Another good choice would be setting up an
[integration with your editor](../integrations/editors.md) of choice or with
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ requires = ["hatchling>=1.8.0", "hatch-vcs", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"

[project]
name = "black"
description = "The uncompromising code formatter."
name = "tan"
description = "The compromising code formatter."
license = { text = "MIT" }
requires-python = ">=3.8"
authors = [
Expand Down Expand Up @@ -85,12 +85,12 @@ jupyter = [
]

[project.scripts]
black = "black:patched_main"
blackd = "blackd:patched_main [d]"
tan = "black:patched_main"
tand = "blackd:patched_main [d]"

[project.urls]
Changelog = "https://github.com/psf/black/blob/main/CHANGES.md"
Homepage = "https://github.com/psf/black"
Changelog = "https://github.com/jleclanche/tan/blob/main/CHANGES.md"
Homepage = "https://github.com/jleclanche/tan"

[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
Expand Down
2 changes: 1 addition & 1 deletion src/black/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_cache_dir() -> Path:
repeated calls.
"""
# NOTE: Function mostly exists as a clean way to test getting the cache directory.
default_cache_dir = user_cache_dir("black", version=__version__)
default_cache_dir = user_cache_dir("tan", version=__version__)
cache_dir = Path(os.environ.get("BLACK_CACHE_DIR", default_cache_dir))
return cache_dir

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ setenv = PYTHONPATH = {toxinidir}/src
skip_install = True
commands =
pip install -e .[d]
black --check {toxinidir}/src {toxinidir}/tests
tan --check {toxinidir}/src {toxinidir}/tests

0 comments on commit 800ce65

Please sign in to comment.