Skip to content

Commit

Permalink
Merge branch 'sh'
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Oct 4, 2023
2 parents b27a89f + c2472e9 commit 385c314
Show file tree
Hide file tree
Showing 26 changed files with 482 additions and 335 deletions.
26 changes: 7 additions & 19 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
[flake8]

show-source = True
count= True
count = True
statistics = True
# E265 = comment blocks like @{ section, which it can't handle

# E266 = too many leading '#' for block comment
# E731 = do not assign a lambda expression, use a def
# W293 = Blank line contains whitespace
# W504 = Line break after operator
# E704 = multiple statements in one line - used for @override
# TC002 = move third party import to TYPE_CHECKING
# ANN = flake8-annotations
# TC, TC2 = flake8-type-checking
# D = flake8-docstrings

# select = C,E,F,W ANN, TC, TC2 # to enable code. Disabled if not listed, including builtin codes
enable-extensions = TC, TC2 # only needed for extensions not enabled by default

ignore = E265,E266,E731,E704,
W293, W504,
ANN0 ANN1 ANN2,
TC002,
TC0, TC1, TC2
# B,
A,
D,
RST, RST3
ignore = E266, E731

exclude = .tox,.venv,build,dist,doc,git/ext/
exclude = .tox, .venv, build, dist, doc, git/ext/

rst-roles = # for flake8-RST-docstrings
attr,class,func,meth,mod,obj,ref,term,var # used by sphinx
attr, class, func, meth, mod, obj, ref, term, var # used by sphinx

min-python-version = 3.7.0

# for `black` compatibility
max-line-length = 120
extend-ignore = E203,W503
extend-ignore = E203, W503
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "weekly"
46 changes: 28 additions & 18 deletions .github/workflows/cygwin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@ on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: windows-latest

strategy:
fail-fast: false

env:
CHERE_INVOKING: 1
SHELLOPTS: igncr
TMP: "/tmp"
TEMP: "/tmp"

defaults:
run:
shell: bash.exe --noprofile --norc -exo pipefail -o igncr "{0}"
shell: C:\cygwin\bin\bash.exe --noprofile --norc -exo pipefail -o igncr "{0}"

steps:
- name: Force LF line endings
run: git config --global core.autocrlf input
run: |
git config --global core.autocrlf false # Affects the non-Cygwin git.
shell: bash

- uses: actions/checkout@v4
with:
Expand All @@ -29,36 +33,42 @@ jobs:
with:
packages: python39 python39-pip python39-virtualenv git

- name: Show python and git versions
- name: Special configuration for Cygwin's git
run: |
/usr/bin/python --version
/usr/bin/git version
- name: Tell git to trust this repo
run: |
/usr/bin/git config --global --add safe.directory "$(pwd)"
git config --global --add safe.directory "$(pwd)"
git config --global core.autocrlf false
- name: Prepare this repo for tests
run: |
TRAVIS=yes ./init-tests-after-clone.sh
./init-tests-after-clone.sh
- name: Further prepare git configuration for tests
- name: Set git user identity and command aliases for the tests
run: |
/usr/bin/git config --global user.email "travis@ci.com"
/usr/bin/git config --global user.name "Travis Runner"
git config --global user.email "travis@ci.com"
git config --global user.name "Travis Runner"
# If we rewrite the user's config by accident, we will mess it up
# and cause subsequent tests to fail
cat test/fixtures/.gitconfig >> ~/.gitconfig
- name: Update PyPA packages
run: |
/usr/bin/python -m pip install --upgrade pip setuptools wheel
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
python -m pip install -U pip $(pip freeze --all | grep -oF setuptools) wheel
- name: Install project and test dependencies
run: |
/usr/bin/python -m pip install ".[test]"
python -m pip install ".[test]"
- name: Show version and platform information
run: |
uname -a
command -v git python
git version
python --version
python -c 'import sys; print(sys.platform)'
python -c 'import os; print(os.name)'
python -c 'import git; print(git.compat.is_win)'
- name: Test with pytest
run: |
set +x
/usr/bin/python -m pytest
python -m pytest --color=yes -p no:sugar --instafail -vv
16 changes: 11 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.x"

- uses: pre-commit/action@v3.0.0
with:
extra_args: --all-files --hook-stage manual
env:
SKIP: black-format
36 changes: 18 additions & 18 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ permissions:

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- experimental: false
- python-version: "3.12"
experimental: true
- experimental: false

defaults:
run:
shell: /bin/bash --noprofile --norc -exo pipefail {0}
Expand All @@ -36,16 +35,11 @@ jobs:
python-version: ${{ matrix.python-version }}
allow-prereleases: ${{ matrix.experimental }}

- name: Show python and git versions
run: |
python --version
git version
- name: Prepare this repo for tests
run: |
TRAVIS=yes ./init-tests-after-clone.sh
./init-tests-after-clone.sh
- name: Prepare git configuration for tests
- name: Set git user identity and command aliases for the tests
run: |
git config --global user.email "travis@ci.com"
git config --global user.name "Travis Runner"
Expand All @@ -55,17 +49,23 @@ jobs:
- name: Update PyPA packages
run: |
python -m pip install --upgrade pip
if pip freeze --all | grep --quiet '^setuptools=='; then
# Python prior to 3.12 ships setuptools. Upgrade it if present.
python -m pip install --upgrade setuptools
fi
python -m pip install --upgrade wheel
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
python -m pip install -U pip $(pip freeze --all | grep -oF setuptools) wheel
- name: Install project and test dependencies
run: |
pip install ".[test]"
- name: Show version and platform information
run: |
uname -a
command -v git python
git version
python --version
python -c 'import sys; print(sys.platform)'
python -c 'import os; print(os.name)'
python -c 'import git; print(git.compat.is_win)'
- name: Check types with mypy
run: |
mypy -p git
Expand All @@ -75,7 +75,7 @@ jobs:

- name: Test with pytest
run: |
pytest
pytest --color=yes -p no:sugar --instafail -vv
continue-on-error: false

- name: Documentation
Expand Down
54 changes: 37 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
repos:
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
[
flake8-bugbear==23.9.16,
flake8-comprehensions==3.14.0,
flake8-typing-imports==1.14.0,
]
exclude: ^doc|^git/ext/
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
alias: black-check
name: black (check)
args: [--check, --diff]
exclude: ^git/ext/
stages: [manual]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: black
alias: black-format
name: black (format)
exclude: ^git/ext/

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==23.9.16
- flake8-comprehensions==3.14.0
- flake8-typing-imports==1.14.0
exclude: ^doc|^git/ext/

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.5
hooks:
- id: shellcheck
args: [--color]
exclude: ^git/ext/

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-toml
- id: check-yaml
- id: check-merge-conflict
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.PHONY: all clean release force_release
.PHONY: all lint clean release force_release

all:
@grep -Ee '^[a-z].*:' Makefile | cut -d: -f1 | grep -vF all
@awk -F: '/^[[:alpha:]].*:/ && !/^all:/ {print $$1}' Makefile

lint:
SKIP=black-format pre-commit run --all-files --hook-stage manual

clean:
rm -rf build/ dist/ .eggs/ .tox/
Expand Down
Loading

0 comments on commit 385c314

Please sign in to comment.