Skip to content

Commit 53bc906

Browse files
Add style recommendations and Black linter (#3)
1 parent e9cd075 commit 53bc906

File tree

4 files changed

+41
-14
lines changed

4 files changed

+41
-14
lines changed

.github/workflows/black.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This workflow installs the package and builds the docs
2+
# See https://black.readthedocs.io/en/stable/github_actions.html for details
3+
4+
name: Lint
5+
6+
on: [push, pull_request]
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
- uses: psf/black@stable

.github/workflows/build-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow installs the package and builds the docs
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: build the docs
4+
name: Build the docs
55

66
on:
77
push:

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
Copyright (c) 2021 IIASA
44

5-
![GitHub](https://img.shields.io/github/license/iiasa/python-stub)
5+
![License](https://img.shields.io/github/license/iiasa/python-stub)
6+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
67

78
## Overview
89

@@ -17,25 +18,36 @@ Detailed instructions to create a new repository from a template can be found
1718

1819
Then, make the following changes:
1920

20-
0. Change the text of the `LICENSE` file and the badge in this readme (optional).
21-
1. Rename the folder `python_stub` to the intended package name.
22-
2. Update the package name, author info and url in `setup.cfg`.
23-
3. Update the package name, author info and copyright in `doc/source/conf.py`.
24-
4. Delete the configuration section from this readme and update the title and overview section.
21+
0. Change the text of the `LICENSE` file (optional).
22+
0. Update the url in the license badge in this readme to point to the new repository.
23+
0. Rename the folder `python_stub` to the intended package name.
24+
0. Update the package name, author info and url in `setup.cfg`.
25+
0. Update the package name, author info and copyright in `doc/source/conf.py`.
26+
0. Delete the configuration section from this readme and update the title and overview section.
2527

2628
Make sure to commit all changes to your new repository - then program away!
2729

30+
## Recommendations
31+
32+
This package uses the [Black](https://black.readthedocs.io/) code style.
33+
A GitHub Action workflow is configured to check that your commits conform to the style.
34+
35+
We recommend that you follow the [numpydoc](https://numpydoc.readthedocs.io)
36+
docstring formatting guide.
37+
38+
Looking for more ideas to include fancy modules in your package?
39+
Take a look at the [cookiecutter-hypermodern-python](https://github.com/cjolowicz/cookiecutter-hypermodern-python) repository!
40+
2841
## Installation
2942

3043
Install the package including the requirements for building the docs.
3144

32-
pip install -e .[doc]
45+
pip install --editable .[doc]
3346

3447
## Building the docs
3548

3649
Navigate to the doc folder and run Sphinx.
3750

38-
cd doc
39-
make html
51+
make --directory=doc html
4052

4153
The rendered html pages will be located in `doc/build/html/index.html`.

doc/source/conf.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
# so a file named "default.css" will overwrite the builtin "default.css".
5555
html_static_path = ["_static"]
5656

57-
58-
# Add the IIASA stylesheet
59-
def setup(app):
60-
app.add_css_file("iiasa.css")
57+
# These paths are either relative to html_static_path
58+
# or fully qualified paths (eg. https://...)
59+
html_css_files = [
60+
"iiasa.css",
61+
]

0 commit comments

Comments
 (0)