Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release 0.1 #25

Merged
merged 9 commits into from
May 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ It was originally a rewrite of a `gist`_ and called
.. _gist: https://gist.github.com/mattharrison/2a1a263597d80e99cf85e898b800ec32
.. _black: https://github.com/psf/black

Installation
------------
Dependencies:

- `black`_
- `more-itertools`_

.. _more-itertools: https://github.com/more-itertools/more-itertools

Install it with:

.. code:: bash

python -m pip install blackdoc

Usage
-----
The commandline interface supports two modes: checking and inplace
Expand All @@ -43,3 +58,9 @@ When checking, it will report the changed files but will not write them to disk:
.. code:: bash

python -m blackdoc --check .

It is also possible to use the entrypoint script:

.. code:: bash

blackdoc --help
11 changes: 11 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Changelog
=========

v0.1 (unreleased)
-----------------

- Add a CLI (:pull:`1`)
- Add support for ipython prompts (:pull:`4`)
- Add support for code blocks in rst files (:pull:`10`)
- Allow disabling / selectively enabling formats (:issue:`13`, :pull:`18`)
- Initial version of the documentation (:issue:`12`, :pull:`19`)
89 changes: 6 additions & 83 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,88 +10,11 @@ The currently supported formats are:
- ipython
- rst

Installation
------------
Its dependencies are:

- `black`_
- `more-itertools`_
- `importlib-metadata`_ (on **python** < 3.8)
.. toctree::
:maxdepth: 1
:caption: Contents


It has not been released, yet, so use:

.. code:: bash

python -m pip install git+https://github.com/keewis/blackdoc

for installing.


.. _more-itertools: https://more-itertools.readthedocs.io/
.. _black: https://black.readthedocs.io/en/stable/
.. _importlib-metadata: https://importlib-metadata.readthedocs.io/en/latest/


Usage
-----
**blackdoc** tries to copy as much of the CLI of **black** as
possible. This means that most calls to **black** can be directly
translated to **blackdoc**:

To reformat specific files, use:

.. code:: sh

python -m blackdoc file1 file2 ...

while passing directories reformats all files in those directories
that match the file format specified by ``--include`` and
``--exclude``:

.. code:: sh

python -m blackdoc directory1 directory2 ...

mixing directories and files is also possible.

As an example, having a structure like::

directory
├── file.py
└── file.rst

with

.. literalinclude:: directory/file.py

.. literalinclude:: directory/file.rst
:language: rst

If we run

.. code:: sh

python -m blackdoc directory

we get

.. literalinclude:: directory/reformatted.py

.. literalinclude:: directory/reformatted.rst
:language: rst

If instead we run

.. code:: sh

python -m blackdoc --check directory

the result is::

would reformat directory/file.rst
would reformat directory/file.py
Oh no! 💥 💔 💥
2 files would be reformatted.

with a non-zero exit status.
installing
usage
changelog
19 changes: 19 additions & 0 deletions doc/installing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Installation
------------
Its dependencies are:

- `black`_
- `more-itertools`_
- `importlib-metadata`_ (on **python** < 3.8)


To install it, use

.. code:: bash

python -m pip install blackdoc


.. _more-itertools: https://more-itertools.readthedocs.io/
.. _black: https://black.readthedocs.io/en/stable/
.. _importlib-metadata: https://importlib-metadata.readthedocs.io/en/latest/
62 changes: 62 additions & 0 deletions doc/usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Usage
-----
**blackdoc** tries to copy as much of the CLI of **black** as
possible. This means that most calls to **black** can be directly
translated to **blackdoc**:

To reformat specific files, use:

.. code:: sh

python -m blackdoc file1 file2 ...

while passing directories reformats all files in those directories
that match the file format specified by ``--include`` and
``--exclude``:

.. code:: sh

python -m blackdoc directory1 directory2 ...

mixing directories and files is also possible.

As an example, having a structure like::

directory
├── file.py
└── file.rst

with

.. literalinclude:: directory/file.py

.. literalinclude:: directory/file.rst
:language: rst

If we run

.. code:: sh

python -m blackdoc directory

we get

.. literalinclude:: directory/reformatted.py

.. literalinclude:: directory/reformatted.rst
:language: rst

If instead we run

.. code:: sh

python -m blackdoc --check directory

the result is::

would reformat directory/file.rst
would reformat directory/file.py
Oh no! 💥 💔 💥
2 files would be reformatted.

with a non-zero exit status.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==19.10b0
black
flake8
more-itertools
pytest