Skip to content

Commit 5109248

Browse files
authored
Merge pull request #26 from frichtarik/formatting
fix: automated formatting
2 parents 7921fcd + 899d755 commit 5109248

18 files changed

Lines changed: 1896 additions & 1954 deletions

.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 90
3+
extend-ignore=E203

.github/workflows/publish.yml

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -4,125 +4,125 @@ name: Publish Python Package
44
on:
55
push:
66
tags:
7-
- 'v[0-9]+.[0-9]+.[0-9]*'
7+
- "v[0-9]+.[0-9]+.[0-9]*"
88

99
jobs:
1010
build:
1111
name: Build distribution
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/checkout@v4
16-
# NOTE: tags are not present unless triggered by tag push
17-
# - name: Get tags
18-
# run: git fetch --tags origin
19-
# - name: List tags
20-
# run: git tag --list
21-
# TODO: somehow versioneer does not pickup the tag when workflow is not triggered by a
22-
# tag push, getting e.g. (for sister repo scantree) scantree-0+untagged.1.gd74b1d5,
23-
# see: https://github.com/andhus/scantree/actions/runs/7485873305/job/20375116541#step:7:42)
24-
- name: Set up Python
25-
uses: actions/setup-python@v5
26-
with:
27-
python-version: "3.x"
28-
- name: Install pypa/build
29-
run: >-
30-
python3 -m
31-
pip install
32-
build
33-
--user
34-
- name: Build a binary wheel and a source tarball
35-
run: python3 -m build
36-
- name: Store the distribution packages
37-
uses: actions/upload-artifact@v4
38-
with:
39-
name: python-package-distributions
40-
path: dist/
15+
- uses: actions/checkout@v4
16+
# NOTE: tags are not present unless triggered by tag push
17+
# - name: Get tags
18+
# run: git fetch --tags origin
19+
# - name: List tags
20+
# run: git tag --list
21+
# TODO: somehow versioneer does not pickup the tag when workflow is not triggered by a
22+
# tag push, getting e.g. (for sister repo scantree) scantree-0+untagged.1.gd74b1d5,
23+
# see: https://github.com/andhus/scantree/actions/runs/7485873305/job/20375116541#step:7:42)
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.x"
28+
- name: Install pypa/build
29+
run: >-
30+
python3 -m
31+
pip install
32+
build
33+
--user
34+
- name: Build a binary wheel and a source tarball
35+
run: python3 -m build
36+
- name: Store the distribution packages
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: python-package-distributions
40+
path: dist/
4141

4242
publish-to-pypi:
4343
name: Publish to PyPI
4444
# TODO we need to make sure the tag matches the version!
45-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
45+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
4646
needs:
47-
- build
47+
- build
4848
runs-on: ubuntu-latest
4949
environment:
5050
name: pypi
5151
url: https://pypi.org/p/dirhash
5252
permissions:
53-
id-token: write # IMPORTANT: mandatory for trusted publishing
53+
id-token: write # IMPORTANT: mandatory for trusted publishing
5454

5555
steps:
56-
- name: Download all the dists
57-
uses: actions/download-artifact@v4
58-
with:
59-
name: python-package-distributions
60-
path: dist/
61-
- name: Publish distribution 📦 to PyPI
62-
uses: pypa/gh-action-pypi-publish@release/v1
56+
- name: Download all the dists
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: python-package-distributions
60+
path: dist/
61+
- name: Publish distribution 📦 to PyPI
62+
uses: pypa/gh-action-pypi-publish@release/v1
6363

6464
github-release:
6565
name: Sign and upload to GitHub Release
6666
needs:
67-
- publish-to-pypi
67+
- publish-to-pypi
6868
runs-on: ubuntu-latest
6969

7070
permissions:
71-
contents: write # IMPORTANT: mandatory for making GitHub Releases
72-
id-token: write # IMPORTANT: mandatory for sigstore
71+
contents: write # IMPORTANT: mandatory for making GitHub Releases
72+
id-token: write # IMPORTANT: mandatory for sigstore
7373

7474
steps:
75-
- name: Download all the dists
76-
uses: actions/download-artifact@v4
77-
with:
78-
name: python-package-distributions
79-
path: dist/
80-
- name: Sign the dists with Sigstore
81-
uses: sigstore/gh-action-sigstore-python@v2.1.1
82-
with:
83-
inputs: >-
84-
./dist/*.tar.gz
85-
./dist/*.whl
86-
- name: Create GitHub Release
87-
env:
88-
GITHUB_TOKEN: ${{ github.token }}
89-
run: >-
90-
gh release create
91-
'${{ github.ref_name }}'
92-
--repo '${{ github.repository }}'
93-
--notes ""
94-
- name: Upload artifact signatures to GitHub Release
95-
env:
96-
GITHUB_TOKEN: ${{ github.token }}
97-
# Upload to GitHub Release using the `gh` CLI.
98-
# `dist/` contains the built packages, and the
99-
# sigstore-produced signatures and certificates.
100-
run: >-
101-
gh release upload
102-
'${{ github.ref_name }}' dist/**
103-
--repo '${{ github.repository }}'
75+
- name: Download all the dists
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: python-package-distributions
79+
path: dist/
80+
- name: Sign the dists with Sigstore
81+
uses: sigstore/gh-action-sigstore-python@v2.1.1
82+
with:
83+
inputs: >-
84+
./dist/*.tar.gz
85+
./dist/*.whl
86+
- name: Create GitHub Release
87+
env:
88+
GITHUB_TOKEN: ${{ github.token }}
89+
run: >-
90+
gh release create
91+
'${{ github.ref_name }}'
92+
--repo '${{ github.repository }}'
93+
--notes ""
94+
- name: Upload artifact signatures to GitHub Release
95+
env:
96+
GITHUB_TOKEN: ${{ github.token }}
97+
# Upload to GitHub Release using the `gh` CLI.
98+
# `dist/` contains the built packages, and the
99+
# sigstore-produced signatures and certificates.
100+
run: >-
101+
gh release upload
102+
'${{ github.ref_name }}' dist/**
103+
--repo '${{ github.repository }}'
104104
105105
publish-to-testpypi:
106106
name: Publish to TestPyPI
107-
if: startsWith(github.ref, 'refs/tags/') # only publish on tag pushes
107+
if: startsWith(github.ref, 'refs/tags/') # only publish on tag pushes
108108
needs:
109-
- build
109+
- build
110110
runs-on: ubuntu-latest
111111

112112
environment:
113113
name: testpypi
114114
url: https://test.pypi.org/p/dirhash
115115

116116
permissions:
117-
id-token: write # IMPORTANT: mandatory for trusted publishing
117+
id-token: write # IMPORTANT: mandatory for trusted publishing
118118

119119
steps:
120-
- name: Download all the dists
121-
uses: actions/download-artifact@v4
122-
with:
123-
name: python-package-distributions
124-
path: dist/
125-
- name: Publish distribution 📦 to TestPyPI
126-
uses: pypa/gh-action-pypi-publish@release/v1
127-
with:
128-
repository-url: https://test.pypi.org/legacy/
120+
- name: Download all the dists
121+
uses: actions/download-artifact@v4
122+
with:
123+
name: python-package-distributions
124+
path: dist/
125+
- name: Publish distribution 📦 to TestPyPI
126+
uses: pypa/gh-action-pypi-publish@release/v1
127+
with:
128+
repository-url: https://test.pypi.org/legacy/

.github/workflows/test.yml

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,49 @@ on:
66
- "master"
77
pull_request:
88
branches:
9-
- "*"
9+
- "**"
1010
workflow_dispatch:
1111
release:
1212
types: [published, edited]
1313

1414
jobs:
1515
tests:
16-
1716
runs-on: ubuntu-latest
1817
strategy:
1918
fail-fast: false
2019
matrix:
2120
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2221

2322
steps:
24-
- uses: actions/checkout@v4
25-
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v5
27-
with:
28-
python-version: ${{ matrix.python-version }}
29-
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip
32-
python -m pip install tox tox-gh-actions
33-
- name: Cache tox environments
34-
id: cache-tox
35-
uses: actions/cache@v4
36-
with:
37-
path: .tox
38-
# setup.py and setup.cfg have versioning info that would impact the
39-
# tox environment. hashFiles only takes a single file path or pattern
40-
# at the moment.
41-
key: ${{ runner.os }}-${{ matrix.python-version }}-tox-${{ hashFiles('setup.py') }}-${{ hashFiles('setup.cfg') }} }}
42-
- name: Test with tox
43-
run: tox
44-
- uses: codecov/codecov-action@v4
45-
with:
46-
token: ${{ secrets.CODECOV_TOKEN }}
47-
verbose: true
23+
- uses: actions/checkout@v4
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
python -m pip install tox tox-gh-actions
32+
- name: Cache tox environments
33+
id: cache-tox
34+
uses: actions/cache@v4
35+
with:
36+
path: .tox
37+
# setup.py and setup.cfg have versioning info that would impact the
38+
# tox environment. hashFiles only takes a single file path or pattern
39+
# at the moment.
40+
key: ${{ runner.os }}-${{ matrix.python-version }}-tox-${{ hashFiles('setup.py') }}-${{ hashFiles('setup.cfg') }} }}
41+
- name: Test with tox
42+
run: tox
43+
- name: Commit and Push to Pull Request
44+
if: matrix.python-version == 3.8
45+
run: |
46+
if [ -n "$(git status -s)" ]; then
47+
git add .
48+
git commit -m "✨ ⭐ Automated commit has been added to your pull request to fix formatting! ⭐ ✨"
49+
git push origin ${{ github.head_ref }}
50+
fi
51+
- uses: codecov/codecov-action@v4
52+
with:
53+
token: ${{ secrets.CODECOV_TOKEN }}
54+
verbose: true

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ venv.bak/
106106
# Pycharm
107107
.idea/
108108

109+
# VSC
110+
.vscode/
109111

110112
# Project specific
111-
benchmark/test_cases/*
113+
benchmark/test_cases/*

.pre-commit-config.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 24.3.0
4+
hooks:
5+
- id: black
6+
args: ["--target-version", "py38"]
7+
- repo: https://github.com/PyCQA/isort
8+
rev: 5.13.2
9+
hooks:
10+
- id: isort
11+
args: ["--profile", "black"]
12+
- repo: https://github.com/pre-commit/mirrors-prettier
13+
rev: v3.1.0
14+
hooks:
15+
- id: prettier
16+
args: [--prose-wrap=preserve, --print-width=90]
17+
- repo: https://github.com/pycqa/flake8
18+
rev: 7.0.0
19+
hooks:
20+
- id: flake8
21+
- repo: https://github.com/astral-sh/ruff-pre-commit
22+
rev: v0.3.7
23+
hooks:
24+
- id: ruff
25+
- id: ruff-format
26+
- repo: https://github.com/asottile/pyupgrade
27+
rev: v3.15.2
28+
hooks:
29+
- id: pyupgrade
30+
args: ["--py38-plus"]

CHANGELOG.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,32 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
910
NIL
1011

1112
## [0.2.0] - 2019-04-20
13+
1214
Complies with [Dirhash Standard](https://github.com/andhus/dirhash) Version [0.1.0](https://github.com/andhus/dirhash/releases/v0.1.0)
1315

1416
### Added
17+
1518
- A first implementation based on the formalized [Dirhash Standard](https://github.com/andhus/dirhash).
1619
- This changelog.
1720
- Results form a new benchmark run after changes. The `benchmark/run.py` now outputs results files which names include the `dirhash.__version__`.
1821

1922
### Changed
20-
- **Significant breaking changes** from version 0.1.1 - both regarding API and the
21-
underlying method/protocol for computing the hash. This means that **hashes
22-
computed with this version will differ from hashes computed with version < 0.2.0 for
23-
same directory**.
24-
- This dirhash python implementation has moved to here
25-
[github.com/andhus/dirhash-python](https://github.com/andhus/dirhash-python) from
26-
the previous repository
27-
[github.com/andhus/dirhash](https://github.com/andhus/dirhash)
28-
which now contains the formal description of the Dirhash Standard.
23+
24+
- **Significant breaking changes** from version 0.1.1 - both regarding API and the
25+
underlying method/protocol for computing the hash. This means that **hashes
26+
computed with this version will differ from hashes computed with version < 0.2.0 for
27+
same directory**.
28+
- This dirhash python implementation has moved to here
29+
[github.com/andhus/dirhash-python](https://github.com/andhus/dirhash-python) from
30+
the previous repository
31+
[github.com/andhus/dirhash](https://github.com/andhus/dirhash)
32+
which now contains the formal description of the Dirhash Standard.
2933

3034
### Removed
31-
- All support for the `.dirhashignore` file. This seemed superfluous, please file an
32-
issue if you need this feature.
35+
36+
- All support for the `.dirhashignore` file. This seemed superfluous, please file an
37+
issue if you need this feature.

0 commit comments

Comments
 (0)