Skip to content

Commit

Permalink
apply auto formatters
Browse files Browse the repository at this point in the history
ignore generated file
  • Loading branch information
blink1073 committed Apr 2, 2022
1 parent f35676b commit 9495f8f
Show file tree
Hide file tree
Showing 160 changed files with 5,228 additions and 4,247 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Expand Up @@ -13,4 +13,5 @@ You may need to attach the .ipynb as a .txt --->
<!--- Can you attach screenshots if relevant? --->

<!--- Are you running the latest version of nbconvert? --->

**Nbconvert version:**
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Expand Up @@ -5,8 +5,6 @@ about: Suggest an idea for this project

<!--- Is your feature request related to a problem? What are you trying to achieve? --->


<!--- Describe the solution you'd like. --->


<!--- If possible, describe alternatives you've considered. Why are they insufficent? --->
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
@@ -1,7 +1,7 @@
---
name: Question
about: If you need some help
labels: question
labels: question
---

If you have a question, you can file an issue here or
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.7', '3.10' ]
python-version: ["3.7", "3.10"]
steps:
- name: Check out repository code
uses: actions/checkout@v2
Expand All @@ -30,7 +30,7 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
architecture: "x64"
- name: Cache pip on Linux
uses: actions/cache@v2
if: startsWith(runner.os, 'Linux')
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Expand Up @@ -14,8 +14,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.7', '3.10']
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.7", "3.10"]
include:
- os: "windows-latest"
python-version: "3.8"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -41,4 +41,3 @@ docs/source/config_options.rst
share/jupyter/nbconvert/templates/lab/static/index.css
share/jupyter/nbconvert/templates/lab/static/theme-dark.css
share/jupyter/nbconvert/templates/lab/static/theme-light.css

2 changes: 1 addition & 1 deletion .mailmap
Expand Up @@ -26,7 +26,7 @@ David Hirschfeld <david.hirschfeld@gazprom-mt.com> dhirschfeld <david.hirschfeld
David P. Sanders <dpsanders@gmail.com> David P. Sanders <dpsanders@ciencias.unam.mx>
David Warde-Farley <wardefar@iro.umontreal.ca> David Warde-Farley <>
Doug Blank <dblank@cs.brynmawr.edu> Doug Blank <doug.blank@gmail.com>
Eugene Van den Bulke <eugene.van-den-bulke@gmail.com> Eugene Van den Bulke <eugene.vandenbulke@gmail.com>
Eugene Van den Bulke <eugene.van-den-bulke@gmail.com> Eugene Van den Bulke <eugene.vandenbulke@gmail.com>
Evan Patterson <epatters@enthought.com> <epatters@EPattersons-MacBook-Pro.local>
Evan Patterson <epatters@enthought.com> <epatters@evan-laptop.localdomain>
Evan Patterson <epatters@enthought.com> <epatters@caltech.edu>
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
@@ -0,0 +1 @@
nbconvert/tests/files/*.html
24 changes: 11 additions & 13 deletions CONTRIBUTING.md
Expand Up @@ -7,33 +7,31 @@ and the [IPython Contributing Guide](https://github.com/ipython/ipython/blob/mas
## Testing

In order to test all the features of nbconvert you need to have `pandoc` and
`TexLive` installed.
`TexLive` installed.

In your environment `pip install -e '.[all]'` will be needed to be able to
run all of the tests and to test all of the features.
run all of the tests and to test all of the features.

If you only want to run some of the tests run `pip install -e '.[test]'`.

## Documentation

NbConvert includes a substantial amount of both user and API documentation.
NbConvert includes a substantial amount of both user and API documentation.

We use sphinx to build the API documentation.

Much of the user documentation is written in Jupyter Notebooks and converted on the fly with nbsphinx.
We use sphinx to build the API documentation.

Much of the user documentation is written in Jupyter Notebooks and converted on the fly with nbsphinx.

To build nbconvert's documentation you need to have `pandoc` and
`TexLive` installed.
`TexLive` installed.

If you want to build the docs you will need to install the docs dependencies in addition to
the standard dependencies. You can get all of the dependencies by running `pip install -e
'.[all]'` and if you want only those needed to run the docs you can access them with `pip install -e '.[docs]'`.
the standard dependencies. You can get all of the dependencies by running `pip install -e '.[all]'` and if you want only those needed to run the docs you can access them with `pip install -e '.[docs]'`.

Full build instructions can be found at [docs/README.md](docs/README.md).


## Code Styling

`nbconvert` has adopted automatic code formatting so you shouldn't
need to worry too much about your code style.
As long as your code is valid,
Expand All @@ -46,13 +44,13 @@ To install `pre-commit` manually, run the following:
```bash
pip install pre-commit
pre-commit install
````
```

You can invoke the pre-commit hook by hand at any time with:

```bash
pre-commit run
````
```

which should run any autoformatting on your code
and tell you about any errors it couldn't fix automatically.
Expand All @@ -67,7 +65,7 @@ yourself after that.
# Releasing

If you are going to release a version of `nbconvert` you should also be capable
of testing it and building the docs.
of testing it and building the docs.

Please follow the instructions in [Testing](#testing) and [Documentation](#documentation) if
you are unfamiliar with how to do so.
Expand Down
23 changes: 12 additions & 11 deletions README.md
@@ -1,4 +1,5 @@
# nbconvert

### Jupyter Notebook Conversion

[![Google Group](https://img.shields.io/badge/-Google%20Group-lightgrey.svg)](https://groups.google.com/forum/#!forum/jupyter)
Expand All @@ -12,18 +13,18 @@ The **nbconvert** tool, `jupyter nbconvert`, converts notebooks to various other
formats via [Jinja][] templates. The nbconvert tool allows you to convert an
`.ipynb` notebook file into various static formats including:

* HTML
* LaTeX
* PDF
* Reveal JS
* Markdown (md)
* ReStructured Text (rst)
* executable script
- HTML
- LaTeX
- PDF
- Reveal JS
- Markdown (md)
- ReStructured Text (rst)
- executable script

## Usage

From the command line, use nbconvert to convert a Jupyter notebook (*input*) to a
a different format (*output*). The basic command structure is:
From the command line, use nbconvert to convert a Jupyter notebook (_input_) to a
a different format (_output_). The basic command structure is:

$ jupyter nbconvert --to <output format> <input notebook>

Expand All @@ -40,7 +41,7 @@ This command creates an HTML output file named `mynotebook.html`.

## Dev Install

Check if pandoc is installed (``pandoc --version``); if needed, install:
Check if pandoc is installed (`pandoc --version`); if needed, install:

```
sudo apt-get install pandoc
Expand Down Expand Up @@ -89,4 +90,4 @@ py.test --pyargs nbconvert
- [Jupyter mailing list](https://groups.google.com/forum/#!forum/jupyter)
- [Project Jupyter website](https://jupyter.org)

[Jinja]: http://jinja.pocoo.org/
[jinja]: http://jinja.pocoo.org/
44 changes: 22 additions & 22 deletions docs/README.md
Expand Up @@ -5,49 +5,49 @@ is hosted on ReadTheDocs.

## Build Documentation locally

1. Change directory to documentation root:
1. Change directory to documentation root:

$ cd docs

2. Create conda env (and install relevant dependencies):
2. Create conda env (and install relevant dependencies):

$ conda env create -f environment.yml

3. Activate the newly built conda environment `nbconvert_docs`
3. Activate the newly built conda environment `nbconvert_docs`

$ source activate nbconvert_docs

4. Create an editable install for nbconvert with doc dependencies using
4. Create an editable install for nbconvert with doc dependencies using

$ pip install -e '..[docs]'
$ pip install -e '..[docs]'

or if you want, `cd ..` and `pip install . -e`. But then you will need to `cd docs` before
continuing to the next step.
or if you want, `cd ..` and `pip install . -e`. But then you will need to `cd docs` before
continuing to the next step.

5. Build documentation using Makefile for Linux and OS X:
5. Build documentation using Makefile for Linux and OS X:

$ make html
$ make html

or on Windows:
or on Windows:

$ make.bat html
$ make.bat html

6. Display the documentation locally by navigating to
``build/html/index.html`` in your browser:
6. Display the documentation locally by navigating to
`build/html/index.html` in your browser:

Or alternatively you may run a local server to display
the docs. In Python 3:
Or alternatively you may run a local server to display
the docs. In Python 3:

$ python -m http.server 8000
$ python -m http.server 8000

In your browser, go to `http://localhost:8000`.
In your browser, go to `http://localhost:8000`.

## Developing Documentation

### Helpful files and directories

* `conf.py` - Sphinx build configuration file
* `source` directory - source for documentation
* `source/api` directory - source files for generated API documentation
* `autogen_config.py` - Generates configuration of ipynb source files to rst
* `index.rst` - Main landing page of the Sphinx documentation
- `conf.py` - Sphinx build configuration file
- `source` directory - source for documentation
- `source/api` directory - source files for generated API documentation
- `autogen_config.py` - Generates configuration of ipynb source files to rst
- `index.rst` - Main landing page of the Sphinx documentation
7 changes: 4 additions & 3 deletions docs/api_examples/template_path/make_html.py
Expand Up @@ -5,17 +5,18 @@
"""
import nbformat
from traitlets.config import Config

from nbconvert import HTMLExporter

nbfile = "quiz_notebook.ipynb"
the_ipynb = nbformat.read(nbfile, as_version=4)

c = Config()
c.TemplateExporter.template_paths = ['.', './project_templates']
for template in ['classic', 'classic_clone']:
c.TemplateExporter.template_paths = [".", "./project_templates"]
for template in ["classic", "classic_clone"]:
c.HTMLExporter.template_name = template
html_exporter = HTMLExporter(config=c)
(body, resources) = html_exporter.from_notebook_node(the_ipynb)
with open(f"{template}.html", 'w') as outfile:
with open(f"{template}.html", "w") as outfile:
outfile.write(body)
print(f"\n{'*'*20}\n{template} succeeds\n{'*'*20}\n")
@@ -1,6 +1,6 @@
{
"base_template": "base",
"mimetypes": {
"text/html": true
}
}
"base_template": "base",
"mimetypes": {
"text/html": true
}
}

0 comments on commit 9495f8f

Please sign in to comment.