Commit Graph

27 Commits

Author SHA1 Message Date
Alexandr Artemyev
07b68e2425
add preview option support for blackd (#3217)
Fixes #3195

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2022-08-12 20:23:02 -07:00
onescriptkid
b0eed7c6bd
Fix typo in config docs for --extend-exclude (#3170)
The old regex in the example was invalid and caused an error on startup.
2022-07-14 19:51:18 -04:00
Nimrod
8900e3ac8a
Add warning to not run blackd publicly in docs (#3167)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-07-14 15:22:29 -04:00
Richard Si
f6c139c521
Prepare docs for release 22.6.0 (#3139) 2022-06-27 20:33:35 -04:00
Yusuke Nishioka
9fe788d870
Add more examples to exclude files in addition to the defaults (#3070)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-26 07:44:26 -07:00
JiriKr
8ed3e3d07e
Updated Black Docker Hub link in docs (#3023)
Fixes #3022
2022-04-21 12:55:56 -07:00
Jelle Zijlstra
96bd428524
Quote black[jupyter] and black[d] in installation docs (#3006)
We just got someone on Discord who was confused because the command as
written caused their shell to try to do command expansion.

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2022-04-11 19:25:46 -04:00
Gunung P. Wibisono
3dea6e3635
Convert index.rst and license.rst to markdown (#2852)
Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2022-03-30 13:43:46 -07:00
Jelle Zijlstra
ae2c0758c9
Prepare release 22.3.0 (#2968) 2022-03-28 12:08:29 -07:00
Laurent Lyaudet
07a2e6f678
Fix typo in file_collection_and_discovery.md (GH-2860)
"you your" -> "your"

Co-authored-by: Felix Hildén <felix.hilden@gmail.com>
2022-02-10 20:32:55 -05:00
Richard Si
d038a24ca2
Prepare docs for release 22.1.0 (GH-2826) 2022-01-29 14:30:25 -05:00
Felix Hildén
73cb6e7734
Make SRC or code mandatory and mutually exclusive (#2360) (#2804)
Closes #2360: I'd like to make passing SRC or `--code` mandatory and the arguments mutually exclusive. This will change our (partially already broken) promises of CLI behavior, but I'll comment below.
2022-01-24 07:35:56 -08:00
Perry Vargas
10677baa40
Allow setting custom cache directory on all platforms (#2739)
Fixes #2506

``XDG_CACHE_HOME`` does not work on Windows. To allow for users to set a custom cache directory on all systems I added a new environment variable ``BLACK_CACHE_DIR`` to set the cache directory. The default remains the same so users will only notice a change if that environment variable is set.

The specific use case I have for this is I need to run black on in different processes at the same time. There is a race condition with the cache pickle file that made this rather difficult. A custom cache directory will remove the race condition.

I created ``get_cache_dir`` function in order to test the logic. This is only used to set the ``CACHE_DIR`` constant.
2022-01-21 22:00:33 -08:00
Felix Hildén
668bace2ab
Improve CLI reference wording (#2753) 2022-01-07 18:19:03 +02:00
Richard Si
f1d4e742c9
Prepare for release 21.12b0 (GH-2673)
Let's do this!
2021-12-05 16:39:34 -05:00
Jelle Zijlstra
19f6aa8208
prepare release 2021.11b1 (#2622) 2021-11-17 19:51:49 -08:00
Jelle Zijlstra
d0b04d9f21
prepare release 21.11b0 (#2616) 2021-11-16 18:30:19 -08:00
pszlazak
1d7163957a
Docker image usage description (#2412)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-11-15 18:47:21 -08:00
Cooper Lees
64c8be01f0
Update CHANGES.md for 21.10b0 release (#2583)
* Update CHANGES.md for 21.10b0 release

* Update version in docs/usage_and_configuration/the_basics.md

* Also update docs/integrations/source_version_control.md ...
2021-10-31 17:59:39 -07:00
Jelle Zijlstra
911470a610
Update CHANGES.md for 21.9b0 release (#2494) 2021-09-13 19:23:11 -07:00
Richard Si
16275d24e3
Prepare CHANGES.md for release 21.8b0 (#2458)
Hopefully my first release doesn't end up in flames 🔥

Commit history before merge:

* Prepare CHANGES.md for release 21.8b0
* I need to add a check for this too.
2021-08-29 14:56:22 -04:00
Felix Hildén
a2b5ba2a3a
Add option to require a specific version to be running (#2300)
Closes #1246: This PR adds a new option (and automatically a toml entry, hooray for existing configuration management 🎉) to require a specific version of Black to be running.

For example: `black --required-version 20.8b -c "format = 'this'"`

Execution fails straight away if it doesn't match `__version__`.
2021-06-03 13:09:41 -07:00
Hassan Abouelela
7567cdf3b4
Code Flag Options (#2259)
Properly handles the diff, color, and fast option when black is run with
 the `--code` option.

Closes #2104, closes #1801.
2021-06-01 18:55:21 -07:00
Hadi Alqattan
b8450b9fae
Fix: black only respects the root gitignore. (#2225)
Commit history before merge:

Black now respects .gitignore files in all levels, not only root/.gitignore file
(apply .gitignore rules like git does).

* Fix: typo
* Fix: respect .gitignore files in all levels.
* Add: CHANGELOG note.
* Fix: TypeError: unsupported operand type(s) for +: 'NoneType' and 'PathSpec'
* Update docs.
* Fix: no parent .gitignore
* Add a comment since the if expression is a bit hard to understand
* Update tests - conver no parent .gitignore case.
* Use main's Pipfile.lock instead

  The original changes in Pipfile.lock are whitespace only. The changes
  turned the JSON's file indentation from 4 to 2. Effectively this
  happened: `json.dumps(json.loads(old_pipfile_lock), indent=2) + "\n"`.

  Just using main's Pipfile.lock instead of undoing the changes because
  1) I don't know how to do that easily and quickly, and 2) there's a
  merge conflict.

  Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>

* Merge remote-tracking branch 'upstream/main' into i1730 …
  
  conflicts for days ay?
2021-05-16 13:51:27 -04:00
Richard Si
7c851dfa2c
Cover more in the usage docs (#2208)
Commit history before merge:

* Cover more in the usage docs
* Minor fixes
* Even more corrections by Jelle
* Update docs/usage_and_configuration/the_basics.md

  Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-05-10 10:57:22 -04:00
Richard Si
3d96b7f10a
Autogenerate black(d|-primer)? help in usage docs (#2212)
So these won't go out of date. This does mean the environment has be
setup a bit more carefully so the right version of the tool is used,
but thankfully the build environment is rebuilt on change on RTD anyway.

Also since the HTML docs are known to build fine, let's provide
downloadable HTMLzips of our docs.

This change needs RTD and GH to install Black with the [d] extra so
blackd's help can generated. While editing RTD's config file, let's
migrate the file to a non-deprecated filename.

Also I missed adding AUTHORS.md to the files key in the doc GHA config.
2021-05-09 19:35:56 -07:00
Richard Si
62bfbd6a63
Reorganize docs v2 (GH-2174)
I know I know, this is the second reorganization of the docs. I'm not
saying the first one was bad or anything... but.. actually wait nah,
*it was bad*.

Anyway, welcome to probably my biggest commit. The main thing with this
reorganization was to introduce nesting to the documentation! Having
all of the docs be part of the main TOC was becoming too much. There
wasn't much room to expand either. Finally, the old setup required
a documentation generation step which was just annoying.

The goals of this reorganization was to:

1. Significantly restructure the docs to be discoverable and
   understandable

2. Add room for further docs (like guides or contributing docs)

3. Get rid of the doc generation step (it was slow and frustrating)

4. Unblock other improvements and also just make contributing to the
   docs easier

Another important change with this is that we are no longer using GitHub
as a documentation host. While GitHub does support Markdown based docs
actually pretty well, the lack of any features outside of GitHub Flavoured
Markdown is quite limiting. ReadTheDocs is just much better suited for
documentation. You can use reST, MyST, CommonMark, and all of their
great features like toctrees and admonitions.

Related to this change, we're adopting MyST as our flavour of Markdown.
MyST introduces neat syntax extensions to Markdown that pretty much
gives us the best of both worlds. The ease of use and simplicity of MD
and the flexibility and expressiveness of reST. Also recommonmark is
deprecated now. This switch was possible now we don't use GH as a docs
host. MyST docs have to be built to really be usable / pretty, so the MD
docs are going to look pretty bad on GH, but that's fine now!

Another thing that should be noted is that the README has been stripped
of most content since it was confusing. Users would read the README and
then think some feature or bug was fixed already and is available in a
release when in reality, they weren't. They were reading effectively
the latest docs without knowing.

See also: https://github.com/psf/black/issues/1759

FYI: CommonMark is a rationalized version of Markdown syntax

--

Commit history before merge:

* Switch to MyST-Parser + doc config cleanup

  recommonmark is being deprecated in favour of MyST-Parser. This change
  is welcomed, especially since MyST-Parser has syntax extensions for the
  Commonmark standard. Effectively we get to use a language that's powerful
  and expressive like ReST, but get the simplicity of Markdown.

  The rest of this effort will be using some MyST features.

  This reorganization efforts aims to remove as much duplication as possible.
  The regeneration step once needed is gone, significantly simplifing our
  Sphinx documentation configuration.

* Tell pipenv we replaced recommonmark for MyST-Parser

  Also update `docs/requirements.txt`

* Delete all auto generated content
* Switch prettier for mdformat (plus a few plugins)

  **FYI: THIS WAS EFFECTIVELY REVERTED, SEE THIRD TO LAST COMMIT**

  prettier doesn't support MyST's syntax extensions which are going to be
  used in this reorganization effort so we have to switch formatter.

  Unfortanately mdformat's style is different from prettier's so time to
  reformat the whole repo too.

  We're excluding .github/ISSUE_TEMPLATE because I have no idea whether
  its changes are safe, so let's play it safe.

* Fix the heading levels in CHANGES.md + a link

  MyST-Parser / sphinx's linkcheck complains otherwise.

* Move reference docs into a docs/contributing dir

  They're for contributors of Black anyway. Also added a note in the
  summary document warning about the lack of attention the reference has
  been dealing with.

* Rewrite and setup the new landing page + main TOC

  - add some more detail about Black's beta status
  - add licensing info
  - add external links in the main TOC for GitHub, PyPI, and IRC
  - prepare main TOC for new structure

* Break out AUTHORS into its own file

  Not only was the AUTHORS list quite long, this makes it easy to include
  it in the Sphinx docs with just a simple symlink.

* Add license to docs via a simple include

  Yes the document is orphaned but it is linked to in the landing page
  (docs/index.rst).

* Add "The Black Code Style" section

  This mostly was a restructuring commit, there has been a few updates but
  not many. The main goal was to split "current style" and "planned
  changes to the style that haven't happened yet" to avoid confusion.

* Add "Getting Started" page

  This is basically a quick start + even more. This commit is certainly
  one of most creatively involved in this effort.

* Add "Usage and Configuration" section

  This commit was as much restructuring as new content. Instead of being
  in one giant file, usage and configuration documentation can expand
  without bloating a single file.

* Add "Integrations" section

Just a restructuring commit ...

* Add "Guides" section

  This is a promising area of documentation that could easily grow in the
  future, let's prepare for that!

* Add "Contributing" section

  This is also another area that I expect to see significant growth in.
  Contributors to Black could definitely do with some more specific docs
  that clears up certain parts of our slightly confusing project (it's
  only confusing because we're getting big and old!).

* Rewrite CONTRIBUTING.md to just point to RTD
* Rewrite README.md to delegate most info to RTD
* Address feedback + a lot of corrections and edits

  I know I said I wanted to do these after landing this but given there's
  going to be no time between this being merged and a release getting
  pushed, I want these changes to make it in.

  - drop the number flag for mdformat - to reduce diffs, see also:
    https://mdformat.readthedocs.io/en/stable/users/style.html#ordered-lists
  - the GH issue templates should be safe by mdformat, so get rid of the
    exclude
  - clarify our configuration position - i.e. stop claiming we don't have
    many options, instead say we want as little formatting knobs as
    possible
  - lots and lots of punctuation, spelling, and grammar corrections (thanks
    Jelle!)
  - use RTD as the source for the CHANGELOG too
  - visual style cleanups
  - add docs about our .gitignore behaviour
  - expand GHA Action docs
  - clarify we want the PR number in the CHANGELOG entry
  - claify Black's behaviour for with statements post Python 3.9
  - italicize a bunch of "Black"s

  Thank you goes to Jelle, Taneli (hukkinj1 on GH), Felix
  (felix-hilden on GH), and Wouter (wbolster on GH) for the feedback!

* Merge remote-tracking branch 'upstream/master' into reorganize-docs-v2

  merge conflicts suck, although these ones weren't too bad.

* Add changelog entry + fix merge conflict resolution error

  I consider this important enough to be worthy of a changelog entry :)

* Merge branch 'master' into reorganize-docs-v2

  Co-authored-by: Łukasz Langa <lukasz@langa.pl>

* Actually let's continue using prettier

  Prettier works fine for all of the default MyST syntax so let's not
  rock the boat as much. Dropping the mdformat commit was merge-conflict
  filled so here's additional commit instead.

* Address Cooper's, Taneli's, and Jelle's feedback

  Lots of wording improvements by Cooper. Taneli suggested to disable the
  enabled by default MyST syntax not supported by Prettier and I agreed.
  And Jelle found one more spelling error!

* More minor fixes
2021-05-08 15:17:38 -04:00