Skip to content

Commit 93766c4

Browse files
committed
Fix #201: Reformat source code with black
* Add `pyproject.toml` containing black configuration * Add batch image in `README.rst` * Reformat source code with `black`
1 parent 017e296 commit 93766c4

File tree

6 files changed

+630
-537
lines changed

6 files changed

+630
-537
lines changed

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Quickstart
55
66
A Python module for `semantic versioning`_. Simplifies comparing versions.
77

8-
|build-status| |python-support| |downloads| |license| |docs|
8+
|build-status| |python-support| |downloads| |license| |docs| |black|
99

1010
.. teaser-end
1111
@@ -125,3 +125,6 @@ There are other functions to discover. Read on!
125125
:target: http://python-semver.readthedocs.io/en/latest/?badge=latest
126126
:alt: Documentation Status
127127
.. _semantic versioning: http://semver.org/
128+
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
129+
:target: https://github.com/psf/black
130+
:alt: Black Formatter

docs/conf.py

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
#
1919
import os
2020
import sys
21-
sys.path.insert(0, os.path.abspath('..'))
21+
22+
sys.path.insert(0, os.path.abspath(".."))
2223

2324
from semver import __version__ # noqa: E402
2425

@@ -32,27 +33,27 @@
3233
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3334
# ones.
3435
extensions = [
35-
'sphinx.ext.autodoc',
36-
'sphinx.ext.intersphinx',
37-
'sphinx.ext.napoleon',
38-
'sphinx.ext.extlinks',
36+
"sphinx.ext.autodoc",
37+
"sphinx.ext.intersphinx",
38+
"sphinx.ext.napoleon",
39+
"sphinx.ext.extlinks",
3940
]
4041

4142
# Add any paths that contain templates here, relative to this directory.
42-
templates_path = ['_templates']
43+
templates_path = ["_templates"]
4344

4445
# The suffix(es) of source filenames.
4546
# You can specify multiple suffix as a list of string:
4647
#
47-
source_suffix = '.rst'
48+
source_suffix = ".rst"
4849

4950
# The master toctree document.
50-
master_doc = 'index'
51+
master_doc = "index"
5152

5253
# General information about the project.
53-
project = 'python-semver'
54-
copyright = '2018, Kostiantyn Rybnikov and all'
55-
author = 'Kostiantyn Rybnikov and all'
54+
project = "python-semver"
55+
copyright = "2018, Kostiantyn Rybnikov and all"
56+
author = "Kostiantyn Rybnikov and all"
5657

5758
# The version info for the project you're documenting, acts as replacement for
5859
# |version| and |release|, also used in various other places throughout the
@@ -73,29 +74,28 @@
7374
# List of patterns, relative to source directory, that match files and
7475
# directories to ignore when looking for source files.
7576
# This patterns also effect to html_static_path and html_extra_path
76-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
77+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
7778

7879
# The name of the Pygments (syntax highlighting) style to use.
79-
pygments_style = 'sphinx'
80+
pygments_style = "sphinx"
8081

8182
# If true, `todo` and `todoList` produce output, else they produce nothing.
8283
todo_include_todos = False
8384

8485
# Markup to shorten external links
8586
# See https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
86-
extlinks = {'gh': ('https://github.com/python-semver/python-semver/issues/%s',
87-
'#'),
88-
'pr': ('https://github.com/python-semver/python-semver/pull/%s',
89-
'PR #'),
90-
}
87+
extlinks = {
88+
"gh": ("https://github.com/python-semver/python-semver/issues/%s", "#"),
89+
"pr": ("https://github.com/python-semver/python-semver/pull/%s", "PR #"),
90+
}
9191

9292
# -- Options for HTML output ----------------------------------------------
9393

9494
# The theme to use for HTML and HTML Help pages. See the documentation for
9595
# a list of builtin themes.
9696
#
9797
# html_theme = 'alabaster'
98-
html_theme = 'sphinx_rtd_theme'
98+
html_theme = "sphinx_rtd_theme"
9999

100100
# Theme options are theme-specific and customize the look and feel of a theme
101101
# further. For a list of options available for each theme, see the
@@ -106,22 +106,22 @@
106106
# Add any paths that contain custom static files (such as style sheets) here,
107107
# relative to this directory. They are copied after the builtin static files,
108108
# so a file named "default.css" will overwrite the builtin "default.css".
109-
html_static_path = ['_static']
109+
html_static_path = ["_static"]
110110

111-
html_css_files = ['css/default.css']
111+
html_css_files = ["css/default.css"]
112112

113113
# Custom sidebar templates, must be a dictionary that maps document names
114114
# to template names.
115115
#
116116
# This is required for the alabaster theme
117117
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
118118
html_sidebars = {
119-
'**': [
120-
'about.html',
121-
'navigation.html',
122-
'relations.html', # needs 'show_related': True theme option to display
123-
'searchbox.html',
124-
'donate.html',
119+
"**": [
120+
"about.html",
121+
"navigation.html",
122+
"relations.html", # needs 'show_related': True theme option to display
123+
"searchbox.html",
124+
"donate.html",
125125
]
126126
}
127127

@@ -130,7 +130,7 @@
130130
# -- Options for HTMLHelp output ------------------------------------------
131131

132132
# Output file base name for HTML help builder.
133-
htmlhelp_basename = 'semverdoc'
133+
htmlhelp_basename = "semverdoc"
134134

135135

136136
# -- Options for LaTeX output ---------------------------------------------
@@ -139,15 +139,12 @@
139139
# The paper size ('letterpaper' or 'a4paper').
140140
#
141141
# 'papersize': 'letterpaper',
142-
143142
# The font size ('10pt', '11pt' or '12pt').
144143
#
145144
# 'pointsize': '10pt',
146-
147145
# Additional stuff for the LaTeX preamble.
148146
#
149147
# 'preamble': '',
150-
151148
# Latex figure (float) alignment
152149
#
153150
# 'figure_align': 'htbp',
@@ -157,8 +154,13 @@
157154
# (source start file, target name, title,
158155
# author, documentclass [howto, manual, or own class]).
159156
latex_documents = [
160-
(master_doc, 'semver.tex', 'python-semver Documentation',
161-
'Kostiantyn Rybnikov and all', 'manual'),
157+
(
158+
master_doc,
159+
"semver.tex",
160+
"python-semver Documentation",
161+
"Kostiantyn Rybnikov and all",
162+
"manual",
163+
)
162164
]
163165

164166

@@ -169,11 +171,13 @@
169171
manpage_doc = "pysemver"
170172

171173
man_pages = [
172-
(manpage_doc,
173-
'pysemver',
174-
'Helper script for Semantic Versioning',
175-
["Thomas Schraitle"],
176-
1)
174+
(
175+
manpage_doc,
176+
"pysemver",
177+
"Helper script for Semantic Versioning",
178+
["Thomas Schraitle"],
179+
1,
180+
)
177181
]
178182

179183

@@ -183,7 +187,13 @@
183187
# (source start file, target name, title, author,
184188
# dir menu entry, description, category)
185189
texinfo_documents = [
186-
(master_doc, 'semver', 'python-semver Documentation',
187-
author, 'semver', 'One line description of project.',
188-
'Miscellaneous'),
190+
(
191+
master_doc,
192+
"semver",
193+
"python-semver Documentation",
194+
author,
195+
"semver",
196+
"One line description of project.",
197+
"Miscellaneous",
198+
)
189199
]

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[tool.black]
2+
line-length = 88
3+
target-version = ['py37']
4+
include = '\.pyi?$'
5+
# diff = true
6+
exclude = '''
7+
(
8+
/(
9+
\.eggs # exclude a few common directories in the
10+
| \.git # root of the project
11+
| \.mypy_cache
12+
| \.tox
13+
| \.venv
14+
| \.env
15+
| _build
16+
| build
17+
| dist
18+
)/
19+
)
20+
'''

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy