Skip to content

Commit acbd6ba

Browse files
authored
Merge pull request #1294 from gitpython-developers/tidy-tools
Tidy tools
2 parents 06c2199 + f587b21 commit acbd6ba

12 files changed

+99
-135
lines changed

Diff for: .codeclimate.yml

-15
This file was deleted.

Diff for: .coveragerc

-7
This file was deleted.

Diff for: .deepsource.toml

-15
This file was deleted.

Diff for: .flake8

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[flake8]
2+
show-source = True
3+
count= True
4+
statistics = True
5+
# E265 = comment blocks like @{ section, which it can't handle
6+
# E266 = too many leading '#' for block comment
7+
# E731 = do not assign a lambda expression, use a def
8+
# W293 = Blank line contains whitespace
9+
# W504 = Line break after operator
10+
# E704 = multiple statements in one line - used for @override
11+
# TC002 =
12+
# ANN = flake8-annotations
13+
# TC, TC2 = flake8-type-checking
14+
# D = flake8-docstrings
15+
16+
# select = C,E,F,W ANN, TC, TC2 # to enable code. Disabled if not listed, including builtin codes
17+
enable-extensions = TC, TC2 # only needed for extensions not enabled by default
18+
19+
ignore = E265,E266,E731,E704,
20+
W293, W504,
21+
ANN0 ANN1 ANN2,
22+
TC0, TC1, TC2
23+
# B,
24+
A,
25+
D,
26+
RST, RST3
27+
max-line-length = 120
28+
29+
exclude = .tox,.venv,build,dist,doc,git/ext/,test
30+
31+
rst-roles = # for flake8-RST-docstrings
32+
attr,class,func,meth,mod,obj,ref,term,var # used by sphinx

Diff for: .github/workflows/pythonpackage.yml

+4-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: [3.6, 3.7, 3.8, 3.9, "3.10.0-beta.3"]
18+
python-version: [3.6, 3.7, 3.8, 3.9, "3.10.0-beta.4"]
1919

2020
steps:
2121
- uses: actions/checkout@v2
@@ -46,26 +46,21 @@ jobs:
4646
- name: Lint with flake8
4747
run: |
4848
set -x
49-
pip install flake8
50-
# stop the build if there are Python syntax errors or undefined names
51-
flake8 --ignore=W293,E265,E266,W503,W504,E704,E731 --count --show-source --statistics
49+
flake8
5250
5351
- name: Check types with mypy
5452
run: |
5553
set -x
56-
pip install mypy
5754
mypy -p git
5855
5956
- name: Test with pytest
6057
run: |
6158
set -x
62-
pip install -r requirements-dev.txt
63-
pytest --cov --cov-report=term
64-
# pytest settings in tox.ini[pytest]
59+
pytest
6560
continue-on-error: false
6661

6762
- name: Documentation
6863
run: |
6964
set -x
7065
pip install -r doc/requirements.txt
71-
make -C doc html
66+
make -C doc html

Diff for: README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,20 @@ On *Windows*, make sure you have `git-daemon` in your PATH. For MINGW-git, the
106106
exists in `Git\mingw64\libexec\git-core\`; CYGWIN has no daemon, but should get along fine
107107
with MINGW's.
108108

109-
The easiest way to run tests is by using [tox](https://pypi.python.org/pypi/tox)
110-
a wrapper around virtualenv. It will take care of setting up environments with the proper
111-
dependencies installed and execute test commands. To install it simply:
109+
Ensure testing libraries are installed. In the root directory, run: `pip install test-requirements.txt`
110+
Then,
112111

113-
pip install tox
112+
To lint, run `flake8`
113+
To typecheck, run `mypy -p git`
114+
To test, `pytest`
114115

115-
Then run:
116+
Configuration for flake8 is in root/.flake8 file.
117+
Configuration for mypy, pytest, coverage is in root/pyproject.toml.
116118

117-
tox
119+
The same linting and testing will also be performed against different supported python versions
120+
upon submitting a pull request (or on each push if you have a fork with a "main" branch).
118121

119122

120-
For more fine-grained control, you can use `unittest`.
121123

122124
### Contributions
123125

Diff for: doc/requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
sphinx<2.0
1+
sphinx==4.1.1
22
sphinx_rtd_theme
3+
sphinx-autodoc-typehints

Diff for: doc/source/conf.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
# All configuration values have a default; values that are commented out
1515
# serve to show the default.
1616

17-
import sys, os
17+
import sys
18+
import os
1819

1920
# If your extensions are in another directory, add it here. If the directory
2021
# is relative to the documentation root, use os.path.abspath to make it
@@ -50,7 +51,7 @@
5051
# built documents.
5152
#
5253
# The short X.Y version.
53-
with open(os.path.join(os.path.dirname(__file__),"..", "..", 'VERSION')) as fd:
54+
with open(os.path.join(os.path.dirname(__file__), "..", "..", 'VERSION')) as fd:
5455
VERSION = fd.readline().strip()
5556
version = VERSION
5657
# The full version, including alpha/beta/rc tags.
@@ -170,8 +171,8 @@
170171
# Grouping the document tree into LaTeX files. List of tuples
171172
# (source start file, target name, title, author, document class [howto/manual]).
172173
latex_documents = [
173-
('index', 'GitPython.tex', ur'GitPython Documentation',
174-
ur'Michael Trier', 'manual'),
174+
('index', 'GitPython.tex', r'GitPython Documentation',
175+
r'Michael Trier', 'manual'),
175176
]
176177

177178
# The name of an image file (relative to this directory) to place at the top of

Diff for: mypy.ini

-14
This file was deleted.

Diff for: pyproject.toml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[tool.pytest.ini_options]
2+
python_files = 'test_*.py'
3+
testpaths = 'test' # space seperated list of paths from root e.g test tests doc/testing
4+
addopts = '--cov=git --cov-report=term --maxfail=10 --force-sugar --disable-warnings'
5+
filterwarnings = 'ignore::DeprecationWarning'
6+
# --cov coverage
7+
# --cov-report term # send report to terminal term-missing -> terminal with line numbers html xml
8+
# --cov-report term-missing # to terminal with line numbers
9+
# --cov-report html:path # html file at path
10+
# --maxfail # number of errors before giving up
11+
# -disable-warnings # Disable pytest warnings (not codebase warnings)
12+
# -rf # increased reporting of failures
13+
# -rE # increased reporting of errors
14+
# --ignore-glob=**/gitdb/* # ignore glob paths
15+
# filterwarnings ignore::WarningType # ignores those warnings
16+
17+
[tool.mypy]
18+
# disallow_untyped_defs = True
19+
no_implicit_optional = true
20+
warn_redundant_casts = true
21+
# warn_unused_ignores = True
22+
# warn_unreachable = True
23+
show_error_codes = true
24+
25+
# TODO: remove when 'gitdb' is fully annotated
26+
[[tool.mypy.overrides]]
27+
module = "gitdb.*"
28+
ignore_missing_imports = true
29+
30+
[tool.coverage.run]
31+
source = ["git"]
32+
33+
[tool.coverage.report]
34+
include = ["*/git/*"]
35+
omit = ["*/git/ext/*"]

Diff for: requirements-dev.txt

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
-r requirements.txt
22
-r test-requirements.txt
33

4-
pytest
5-
pytest-cov
4+
# libraries for additional local testing/linting - to be added to test-requirements.txt when all pass
5+
6+
flake8-bugbear
7+
flake8-comprehensions
8+
flake8-type-checking;python_version>="3.8" # checks for TYPE_CHECKING only imports
9+
# flake8-annotations # checks for presence of type annotations
10+
# flake8-rst-docstrings # checks docstrings are valid RST
11+
# flake8-builtins # warns about shadowing builtin names
12+
# flake8-pytest-style
13+
14+
# pytest-flake8
615
pytest-sugar
716
pytest-icdiff
17+
# pytest-profiling

Diff for: tox.ini

-61
This file was deleted.

0 commit comments

Comments
 (0)