Skip to content

Commit a183c39

Browse files
committed
Add black to github actions, pytest and run on project
1 parent f457ef6 commit a183c39

26 files changed

+511
-384
lines changed

.github/workflows/test_and_coverage.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ jobs:
2626
pip install -r example/requirements.txt
2727
- name: Run Tox
2828
run: tox
29+
- name: Run isort and black
30+
# needs to be run outside of pytest else only the example app is tested
31+
run: |
32+
isort .
33+
black .
2934
# TODO: re-enable when coverage is fixed (see tox.ini)
3035
# - name: Report to coverall # by the package as the action is broken, but won't work on external forks!
3136
# if: matrix.python-version == 3.7

.isort.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[settings]
2-
line_length=90
32
known_project=image_cropping
43
known_django=django
54
sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,DJANGO,PROJECT,LOCALFOLDER

docs/conf.py

Lines changed: 82 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,38 @@
1212
import os
1313
import sys
1414

15-
sys.path.append(os.path.abspath('..'))
16-
os.environ['DJANGO_SETTINGS_MODULE'] = 'example.settings'
15+
sys.path.append(os.path.abspath(".."))
16+
os.environ["DJANGO_SETTINGS_MODULE"] = "example.settings"
1717

1818
# If extensions (or modules to document with autodoc) are in another directory,
1919
# add these directories to sys.path here. If the directory is relative to the
2020
# documentation root, use os.path.abspath to make it absolute, like shown here.
21-
#sys.path.insert(0, os.path.abspath('.'))
21+
# sys.path.insert(0, os.path.abspath('.'))
2222

2323
# -- General configuration -----------------------------------------------------
2424

2525
# If your documentation needs a minimal Sphinx version, state it here.
26-
#needs_sphinx = '1.0'
26+
# needs_sphinx = '1.0'
2727

2828
# Add any Sphinx extension module names here, as strings. They can be extensions
2929
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
3030
extensions = []
3131

3232
# Add any paths that contain templates here, relative to this directory.
33-
templates_path = ['_templates']
33+
templates_path = ["_templates"]
3434

3535
# The suffix of source filenames.
36-
source_suffix = '.rst'
36+
source_suffix = ".rst"
3737

3838
# The encoding of source files.
39-
#source_encoding = 'utf-8-sig'
39+
# source_encoding = 'utf-8-sig'
4040

4141
# The master toctree document.
42-
master_doc = 'index'
42+
master_doc = "index"
4343

4444
# General information about the project.
45-
project = 'django-image-cropping'
46-
copyright = '2013, Jonas und der Wolf'
45+
project = "django-image-cropping"
46+
copyright = "2013, Jonas und der Wolf"
4747

4848
# The version info for the project you're documenting, acts as replacement for
4949
# |version| and |release|, also used in various other places throughout the
@@ -55,179 +55,187 @@
5555
from image_cropping import __version__
5656

5757
# The short X.Y version.
58-
version = '.'.join(__version__.split('.')[:2])
58+
version = ".".join(__version__.split(".")[:2])
5959
# The full version, including alpha/beta/rc tags.
6060
release = __version__
6161
except ImportError:
62-
version = release = 'dev'
62+
version = release = "dev"
6363

6464
# The language for content autogenerated by Sphinx. Refer to documentation
6565
# for a list of supported languages.
66-
#language = None
66+
# language = None
6767

6868
# There are two options for replacing |today|: either, you set today to some
6969
# non-false value, then it is used:
70-
#today = ''
70+
# today = ''
7171
# Else, today_fmt is used as the format for a strftime call.
72-
#today_fmt = '%B %d, %Y'
72+
# today_fmt = '%B %d, %Y'
7373

7474
# List of patterns, relative to source directory, that match files and
7575
# directories to ignore when looking for source files.
76-
exclude_patterns = ['_build']
76+
exclude_patterns = ["_build"]
7777

7878
# The reST default role (used for this markup: `text`) to use for all documents.
79-
#default_role = None
79+
# default_role = None
8080

8181
# If true, '()' will be appended to :func: etc. cross-reference text.
82-
#add_function_parentheses = True
82+
# add_function_parentheses = True
8383

8484
# If true, the current module name will be prepended to all description
8585
# unit titles (such as .. function::).
86-
#add_module_names = True
86+
# add_module_names = True
8787

8888
# If true, sectionauthor and moduleauthor directives will be shown in the
8989
# output. They are ignored by default.
90-
#show_authors = False
90+
# show_authors = False
9191

9292
# The name of the Pygments (syntax highlighting) style to use.
93-
pygments_style = 'sphinx'
93+
pygments_style = "sphinx"
9494

9595
# A list of ignored prefixes for module index sorting.
96-
#modindex_common_prefix = []
96+
# modindex_common_prefix = []
9797

9898

9999
# -- Options for HTML output ---------------------------------------------------
100100

101101
# The theme to use for HTML and HTML Help pages. See the documentation for
102102
# a list of builtin themes.
103-
html_theme = 'default'
103+
html_theme = "default"
104104

105105
# Theme options are theme-specific and customize the look and feel of a theme
106106
# further. For a list of options available for each theme, see the
107107
# documentation.
108-
#html_theme_options = {}
108+
# html_theme_options = {}
109109

110110
# Add any paths that contain custom themes here, relative to this directory.
111-
#html_theme_path = []
111+
# html_theme_path = []
112112

113113
# The name for this set of Sphinx documents. If None, it defaults to
114114
# "<project> v<release> documentation".
115-
#html_title = None
115+
# html_title = None
116116

117117
# A shorter title for the navigation bar. Default is the same as html_title.
118-
#html_short_title = None
118+
# html_short_title = None
119119

120120
# The name of an image file (relative to this directory) to place at the top
121121
# of the sidebar.
122-
#html_logo = None
122+
# html_logo = None
123123

124124
# The name of an image file (within the static path) to use as favicon of the
125125
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
126126
# pixels large.
127-
#html_favicon = None
127+
# html_favicon = None
128128

129129
# Add any paths that contain custom static files (such as style sheets) here,
130130
# relative to this directory. They are copied after the builtin static files,
131131
# so a file named "default.css" will overwrite the builtin "default.css".
132-
html_static_path = ['_static']
132+
html_static_path = ["_static"]
133133

134134
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
135135
# using the given strftime format.
136-
#html_last_updated_fmt = '%b %d, %Y'
136+
# html_last_updated_fmt = '%b %d, %Y'
137137

138138
# If true, SmartyPants will be used to convert quotes and dashes to
139139
# typographically correct entities.
140-
#html_use_smartypants = True
140+
# html_use_smartypants = True
141141

142142
# Custom sidebar templates, maps document names to template names.
143-
#html_sidebars = {}
143+
# html_sidebars = {}
144144

145145
# Additional templates that should be rendered to pages, maps page names to
146146
# template names.
147-
#html_additional_pages = {}
147+
# html_additional_pages = {}
148148

149149
# If false, no module index is generated.
150-
#html_domain_indices = True
150+
# html_domain_indices = True
151151

152152
# If false, no index is generated.
153-
#html_use_index = True
153+
# html_use_index = True
154154

155155
# If true, the index is split into individual pages for each letter.
156-
#html_split_index = False
156+
# html_split_index = False
157157

158158
# If true, links to the reST sources are added to the pages.
159-
#html_show_sourcelink = True
159+
# html_show_sourcelink = True
160160

161161
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
162-
#html_show_sphinx = True
162+
# html_show_sphinx = True
163163

164164
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
165-
#html_show_copyright = True
165+
# html_show_copyright = True
166166

167167
# If true, an OpenSearch description file will be output, and all pages will
168168
# contain a <link> tag referring to it. The value of this option must be the
169169
# base URL from which the finished HTML is served.
170-
#html_use_opensearch = ''
170+
# html_use_opensearch = ''
171171

172172
# This is the file name suffix for HTML files (e.g. ".xhtml").
173-
#html_file_suffix = None
173+
# html_file_suffix = None
174174

175175
# Output file base name for HTML help builder.
176-
htmlhelp_basename = 'django-image-croppingdoc'
176+
htmlhelp_basename = "django-image-croppingdoc"
177177

178178

179179
# -- Options for LaTeX output --------------------------------------------------
180180

181181
latex_elements = {
182-
# The paper size ('letterpaper' or 'a4paper').
183-
#'papersize': 'letterpaper',
184-
185-
# The font size ('10pt', '11pt' or '12pt').
186-
#'pointsize': '10pt',
187-
188-
# Additional stuff for the LaTeX preamble.
189-
#'preamble': '',
182+
# The paper size ('letterpaper' or 'a4paper').
183+
#'papersize': 'letterpaper',
184+
# The font size ('10pt', '11pt' or '12pt').
185+
#'pointsize': '10pt',
186+
# Additional stuff for the LaTeX preamble.
187+
#'preamble': '',
190188
}
191189

192190
# Grouping the document tree into LaTeX files. List of tuples
193191
# (source start file, target name, title, author, documentclass [howto/manual]).
194192
latex_documents = [
195-
('index', 'django-image-cropping.tex', 'django-image-cropping Documentation',
196-
'Jonas und der Wolf', 'manual'),
193+
(
194+
"index",
195+
"django-image-cropping.tex",
196+
"django-image-cropping Documentation",
197+
"Jonas und der Wolf",
198+
"manual",
199+
),
197200
]
198201

199202
# The name of an image file (relative to this directory) to place at the top of
200203
# the title page.
201-
#latex_logo = None
204+
# latex_logo = None
202205

203206
# For "manual" documents, if this is true, then toplevel headings are parts,
204207
# not chapters.
205-
#latex_use_parts = False
208+
# latex_use_parts = False
206209

207210
# If true, show page references after internal links.
208-
#latex_show_pagerefs = False
211+
# latex_show_pagerefs = False
209212

210213
# If true, show URL addresses after external links.
211-
#latex_show_urls = False
214+
# latex_show_urls = False
212215

213216
# Documents to append as an appendix to all manuals.
214-
#latex_appendices = []
217+
# latex_appendices = []
215218

216219
# If false, no module index is generated.
217-
#latex_domain_indices = True
220+
# latex_domain_indices = True
218221

219222

220223
# -- Options for manual page output --------------------------------------------
221224

222225
# One entry per manual page. List of tuples
223226
# (source start file, name, description, authors, manual section).
224227
man_pages = [
225-
('index', 'django-image-cropping', 'django-image-cropping Documentation',
226-
['Jonas und der Wolf'], 1)
228+
(
229+
"index",
230+
"django-image-cropping",
231+
"django-image-cropping Documentation",
232+
["Jonas und der Wolf"],
233+
1,
234+
)
227235
]
228236

229237
# If true, show URL addresses after external links.
230-
#man_show_urls = False
238+
# man_show_urls = False
231239

232240

233241
# -- Options for Texinfo output ------------------------------------------------
@@ -236,16 +244,22 @@
236244
# (source start file, target name, title, author,
237245
# dir menu entry, description, category)
238246
texinfo_documents = [
239-
('index', 'django-image-cropping', 'django-image-cropping Documentation',
240-
'Jonas und der Wolf', 'django-image-cropping', 'One line description of project.',
241-
'Miscellaneous'),
247+
(
248+
"index",
249+
"django-image-cropping",
250+
"django-image-cropping Documentation",
251+
"Jonas und der Wolf",
252+
"django-image-cropping",
253+
"One line description of project.",
254+
"Miscellaneous",
255+
),
242256
]
243257

244258
# Documents to append as an appendix to all manuals.
245-
#texinfo_appendices = []
259+
# texinfo_appendices = []
246260

247261
# If false, no module index is generated.
248-
#texinfo_domain_indices = True
262+
# texinfo_domain_indices = True
249263

250264
# How to display URL addresses: 'footnote', 'no', or 'inline'.
251-
#texinfo_show_urls = 'footnote'
265+
# texinfo_show_urls = 'footnote'

example/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
class ImageForm(forms.ModelForm):
77
class Meta:
88
model = Image
9-
fields = ('image_field', 'cropping', 'cropping_free')
9+
fields = ("image_field", "cropping", "cropping_free")

0 commit comments

Comments
 (0)