Skip to content

Commit 935af3c

Browse files
Merge pull request #70 from ThomasWaldmann/black
black
2 parents e9588e6 + 3ae3d1e commit 935af3c

21 files changed

Lines changed: 325 additions & 286 deletions

.github/workflows/main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jobs:
1515
run: |
1616
pip install flake8-pyproject
1717
flake8
18+
- name: Check formatting with black
19+
run: |
20+
pip install -r requirements.d/codestyle.txt
21+
black --check .
1822
test:
1923
needs: lint
2024
runs-on: ${{ matrix.os }}
@@ -58,9 +62,9 @@ jobs:
5862
pip install codecov
5963
pip install -e .
6064
- name: Run tox
61-
run: |
65+
run: |
6266
tox --skip-missing-interpreters
6367
- name: Upload coverage to Codecov
6468
uses: codecov/codecov-action@v1
6569
with:
66-
token: ${{ secrets.CODECOV_TOKEN }}
70+
token: ${{ secrets.CODECOV_TOKEN }}

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
10+
- repo: https://github.com/psf/black
11+
rev: 24.8.0
12+
hooks:
13+
- id: black
14+
15+
- repo: https://github.com/pycqa/flake8
16+
rev: 7.0.0
17+
hooks:
18+
- id: flake8
19+
additional_dependencies: [flake8-pyproject]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (C) 2016-2022 The Borg Collective (see AUTHORS file)
1+
Copyright (C) 2016-2025 The Borg Collective (see AUTHORS file)
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

docs/conf.py

Lines changed: 53 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import os
2121
import sys
2222

23-
sys.path.insert(0, os.path.abspath('.'))
23+
sys.path.insert(0, os.path.abspath("."))
2424

25-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
25+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
2626

2727
# -- General configuration ------------------------------------------------
2828

@@ -33,40 +33,37 @@
3333
# Add any Sphinx extension module names here, as strings. They can be
3434
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3535
# ones.
36-
extensions = [
37-
'sphinx.ext.autodoc',
38-
'usage',
39-
]
36+
extensions = ["sphinx.ext.autodoc", "usage"]
4037

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

4441
# The suffix(es) of source filenames.
4542
# You can specify multiple suffix as a list of string:
4643
#
4744
# source_suffix = ['.rst', '.md']
48-
source_suffix = '.rst'
45+
source_suffix = ".rst"
4946

5047
# The encoding of source files.
5148
#
5249
# source_encoding = 'utf-8-sig'
5350

5451
# The master toctree document.
55-
master_doc = 'index'
52+
master_doc = "index"
5653

5754
# General information about the project.
58-
project = 'Borg - Import'
59-
copyright = '2016-2017 The Borg Collective (see AUTHORS file)'
60-
author = 'The Borg Collective'
55+
project = "Borg - Import"
56+
copyright = "2016-2025 The Borg Collective (see AUTHORS file)"
57+
author = "The Borg Collective"
6158

6259
# The version info for the project you're documenting, acts as replacement for
6360
# |version| and |release|, also used in various other places throughout the
6461
# built documents.
6562
#
6663
# The short X.Y version.
67-
version = '0.0'
64+
version = "0.0"
6865
# The full version, including alpha/beta/rc tags.
69-
release = '0.0.0'
66+
release = "0.0.0"
7067

7168
# The language for content autogenerated by Sphinx. Refer to documentation
7269
# for a list of supported languages.
@@ -83,12 +80,12 @@
8380
# Else, today_fmt is used as the format for a strftime call.
8481
#
8582
# today_fmt = '%B %d, %Y'
86-
today_fmt = '%Y-%m-%d'
83+
today_fmt = "%Y-%m-%d"
8784

8885
# List of patterns, relative to source directory, that match files and
8986
# directories to ignore when looking for source files.
9087
# This patterns also effect to html_static_path and html_extra_path
91-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
88+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
9289

9390
# The reST default role (used for this markup: `text`) to use for all
9491
# documents.
@@ -110,7 +107,7 @@
110107
# show_authors = False
111108

112109
# The name of the Pygments (syntax highlighting) style to use.
113-
pygments_style = 'sphinx'
110+
pygments_style = "sphinx"
114111

115112
# A list of ignored prefixes for module index sorting.
116113
# modindex_common_prefix = []
@@ -129,16 +126,17 @@
129126
#
130127
if not on_rtd: # only import and set the theme if we're building docs locally
131128
import sphinx_rtd_theme
132-
html_theme = 'sphinx_rtd_theme'
129+
130+
html_theme = "sphinx_rtd_theme"
133131
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
134-
html_style = 'css/borg.css'
132+
html_style = "css/borg.css"
135133
else:
136134
html_context = {
137-
'css_files': [
138-
'https://media.readthedocs.org/css/sphinx_rtd_theme.css',
139-
'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
140-
'_static/css/borg.css',
141-
],
135+
"css_files": [
136+
"https://media.readthedocs.org/css/sphinx_rtd_theme.css",
137+
"https://media.readthedocs.org/css/readthedocs-doc-embed.css",
138+
"_static/css/borg.css",
139+
]
142140
}
143141

144142
# Theme options are theme-specific and customize the look and feel of a theme
@@ -163,20 +161,20 @@
163161
# of the sidebar.
164162
#
165163
# html_logo = None
166-
html_logo = '_static/logo.png'
164+
html_logo = "_static/logo.png"
167165

168166
# The name of an image file (relative to this directory) to use as a favicon of
169167
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
170168
# pixels large.
171169
#
172170
# html_favicon = None
173-
html_favicon = '_static/favicon.ico'
171+
html_favicon = "_static/favicon.ico"
174172

175173
# Add any paths that contain custom static files (such as style sheets) here,
176174
# relative to this directory. They are copied after the builtin static files,
177175
# so a file named "default.css" will overwrite the builtin "default.css".
178-
#html_static_path = ['_static']
179-
html_static_path = ['borg_theme']
176+
# html_static_path = ['_static']
177+
html_static_path = ["borg_theme"]
180178

181179
# Add any extra paths that contain custom files (such as robots.txt or
182180
# .htaccess) here, relative to this directory. These files are copied
@@ -189,7 +187,7 @@
189187
# The empty string is equivalent to '%b %d, %Y'.
190188
#
191189
# html_last_updated_fmt = None
192-
html_last_updated_fmt = '%Y-%m-%d'
190+
html_last_updated_fmt = "%Y-%m-%d"
193191

194192
# If true, SmartyPants will be used to convert quotes and dashes to
195193
# typographically correct entities.
@@ -201,8 +199,8 @@
201199
# html_sidebars = {}
202200
# Custom sidebar templates, maps document names to template names.
203201
html_sidebars = {
204-
'index': ['sidebarlogo.html', 'sidebarusefullinks.html', 'searchbox.html'],
205-
'**': ['sidebarlogo.html', 'relations.html', 'searchbox.html', 'localtoc.html', 'sidebarusefullinks.html']
202+
"index": ["sidebarlogo.html", "sidebarusefullinks.html", "searchbox.html"],
203+
"**": ["sidebarlogo.html", "relations.html", "searchbox.html", "localtoc.html", "sidebarusefullinks.html"],
206204
}
207205

208206
# Additional templates that should be rendered to pages, maps page names to
@@ -262,35 +260,29 @@
262260
# html_search_scorer = 'scorer.js'
263261

264262
# Output file base name for HTML help builder.
265-
htmlhelp_basename = 'borg-importdoc'
263+
htmlhelp_basename = "borg-importdoc"
266264

267265
# -- Options for LaTeX output ---------------------------------------------
268266

269267
latex_elements = {
270-
# The paper size ('letterpaper' or 'a4paper').
271-
#
272-
# 'papersize': 'letterpaper',
273-
274-
# The font size ('10pt', '11pt' or '12pt').
275-
#
276-
# 'pointsize': '10pt',
277-
278-
# Additional stuff for the LaTeX preamble.
279-
#
280-
# 'preamble': '',
281-
282-
# Latex figure (float) alignment
283-
#
284-
# 'figure_align': 'htbp',
268+
# The paper size ('letterpaper' or 'a4paper').
269+
#
270+
# 'papersize': 'letterpaper',
271+
# The font size ('10pt', '11pt' or '12pt').
272+
#
273+
# 'pointsize': '10pt',
274+
# Additional stuff for the LaTeX preamble.
275+
#
276+
# 'preamble': '',
277+
# Latex figure (float) alignment
278+
#
279+
# 'figure_align': 'htbp',
285280
}
286281

287282
# Grouping the document tree into LaTeX files. List of tuples
288283
# (source start file, target name, title,
289284
# author, documentclass [howto, manual, or own class]).
290-
latex_documents = [
291-
(master_doc, 'borg-import.tex', 'borg-import Documentation',
292-
'The Borg Collective', 'manual'),
293-
]
285+
latex_documents = [(master_doc, "borg-import.tex", "borg-import Documentation", "The Borg Collective", "manual")]
294286

295287
# The name of an image file (relative to this directory) to place at the top of
296288
# the title page.
@@ -329,10 +321,7 @@
329321

330322
# One entry per manual page. List of tuples
331323
# (source start file, name, description, authors, manual section).
332-
man_pages = [
333-
(master_doc, 'borg-import', 'borg-import Documentation',
334-
[author], 1)
335-
]
324+
man_pages = [(master_doc, "borg-import", "borg-import Documentation", [author], 1)]
336325

337326
# If true, show URL addresses after external links.
338327
#
@@ -345,9 +334,15 @@
345334
# (source start file, target name, title, author,
346335
# dir menu entry, description, category)
347336
texinfo_documents = [
348-
(master_doc, 'borg-import', 'borg-import Documentation',
349-
author, 'borg-import', 'One line description of project.',
350-
'Miscellaneous'),
337+
(
338+
master_doc,
339+
"borg-import",
340+
"borg-import Documentation",
341+
author,
342+
"borg-import",
343+
"One line description of project.",
344+
"Miscellaneous",
345+
)
351346
]
352347

353348
# Documents to append as an appendix to all manuals.

docs/installation.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,19 @@ Open a terminal in the borg-import directory and execute the following to instal
1414

1515
If you have */home/user/.local/bin/* in your ``PATH`` variable, you can then start using Borg-Import.
1616
Otherwise, you will need to add *.local/bin/* to your ``PATH``.
17+
18+
For Developers
19+
--------------
20+
21+
If you're planning to contribute to Borg-Import, you should set up the development environment:
22+
23+
1. Install development dependencies:
24+
25+
:code:`pip install -r requirements.d/development.txt`
26+
27+
2. Set up pre-commit hooks:
28+
29+
:code:`pre-commit install`
30+
31+
This will automatically run code formatting (black) and linting (flake8) checks before each commit.
32+
The pre-commit hooks will ensure your code follows the project's style guidelines.

0 commit comments

Comments
 (0)