pyproject-pre-commit 0.2.4__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [rcmdnk]
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: publish
3
+
4
+ on:
5
+ schedule:
6
+ - cron: '0 0 1 * *'
7
+ workflow_dispatch:
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ check:
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ contents: write
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ with:
21
+ ref: main
22
+ - name: Compare to the last tag
23
+ id: check
24
+ run: |
25
+ git pull --tags
26
+ last_tag=$(git tag --sort=version:refname | tail -n1)
27
+ echo $last_tag
28
+ if [ -n "$(git diff $last_tag src pyproject.toml)" ];then
29
+ echo "flag=1" >> $GITHUB_OUTPUT
30
+ else
31
+ echo "flag=0" >> $GITHUB_OUTPUT
32
+ fi
33
+ - name: Update tag
34
+ id: update
35
+ if: ${{ steps.check.outputs.flag == 1 }}
36
+ run: |
37
+ last_tag=$(git tag --sort=version:refname | tail -n1)
38
+ minor=${last_tag##*.}
39
+ ((++minor))
40
+ new_tag=${last_tag%.*}.${minor}
41
+ new_tag_no_v=${new_tag#v}
42
+ sed -i"" "s/^version.*$/version = \"${new_tag_no_v}\"/" pyproject.toml
43
+ if [ -n "$(git diff)" ];then
44
+ echo "flag=1" >> $GITHUB_OUTPUT
45
+ echo "lat_tag=${last_tag}" >> $GITHUB_OUTPUT
46
+ echo "new_tag=${new_tag}" >> $GITHUB_OUTPUT
47
+ else
48
+ echo "flag=0" >> $GITHUB_OUTPUT
49
+ fi
50
+ - name: Commit and push
51
+ if: ${{ steps.check.outputs.flag == 1 && steps.update.outputs.flag == 1 }}
52
+ run: |
53
+ git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
54
+ git config --local user.name "github-actions[bot]"
55
+ git add .
56
+ PRE_COMMIT_ALLOW_NO_CONFIG=1 git commit -m "update tag"
57
+ - name: Make new tag
58
+ if: ${{ steps.check.outputs.flag == 1 && steps.update.outputs.flag == 1 }}
59
+ run: |
60
+ comment=$(git log --pretty='%h - %s (%an)' ${{ steps.update.outputs.last_tag }}..HEAD|cut -d'-' -f2-)
61
+ git tag -a ${{ steps.update.outputs.new_tag }} -m "${comment}"
62
+ git push --tag
63
+ - name: Push
64
+ if: ${{ steps.check.outputs.flag == 1 && steps.update.outputs.flag == 1 }}
65
+ uses: ad-m/github-push-action@master
66
+ with:
67
+ github_token: ${{ github.token }}
68
+ branch: main
69
+ - name: Push new tag
70
+ if: ${{ steps.check.outputs.flag == 1 && steps.update.outputs.flag == 1 }}
71
+ uses: ad-m/github-push-action@master
72
+ with:
73
+ github_token: ${{ github.token }}
74
+ tags: true
75
+ - uses: actions/setup-python@v5
76
+ if: ${{ steps.check.outputs.flag == 1 }}
77
+ with:
78
+ python-version: "3.10"
79
+ - name: Publish to PyPI
80
+ if: ${{ steps.check.outputs.flag == 1 }}
81
+ run: |
82
+ pip install poetry
83
+ poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
84
+ poetry publish --build
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: test
3
+
4
+ on:
5
+ push:
6
+ branches-ignore:
7
+ - "coverage"
8
+ - "renovate/**"
9
+ pull_request:
10
+ workflow_dispatch:
11
+ inputs:
12
+ main_branch:
13
+ description: "Main branch for coverage/tmate."
14
+ type: string
15
+ required: false
16
+ default: "main"
17
+ main_os:
18
+ description: "Main os for coverage/tmate."
19
+ type: choice
20
+ default: "ubuntu-latest"
21
+ options:
22
+ - "ubuntu-latest"
23
+ main_py_ver:
24
+ description: "Main python version for coverage/tmate."
25
+ type: choice
26
+ default: "3.10"
27
+ options:
28
+ - "3.11"
29
+ - "3.10"
30
+ - "3.9"
31
+ - "3.8"
32
+ tmate:
33
+ type: boolean
34
+ description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate). This is only for main strategy and others will be stopped.'
35
+ required: false
36
+ default: false
37
+
38
+ env:
39
+ main_branch: ${{ inputs.main_branch || 'main' }}
40
+ main_os: ${{ inputs.main_os || 'ubuntu-latest' }}
41
+ main_py_ver: ${{ inputs.main_py_ver || '3.10' }}
42
+ tmate: ${{ inputs.tmate || 'false' }}
43
+
44
+
45
+
46
+ concurrency:
47
+ group: ${{ github.workflow }}-${{ github.ref }}
48
+ cancel-in-progress: true
49
+
50
+ jobs:
51
+ test_matrix:
52
+ strategy:
53
+ fail-fast: false
54
+ matrix:
55
+ os: [ubuntu-latest]
56
+ python-version: ["3.12", "3.11", "3.10", "3.9", "3.8"]
57
+ permissions:
58
+ contents: write
59
+ runs-on: ${{ matrix.os }}
60
+ steps:
61
+ - name: Check is main
62
+ id: is_main
63
+ run: |
64
+ if [ "${{ github.ref }}" = "refs/heads/${{ env.MAIN_BRANCH }}" ] && [ "${{ matrix.os }}" = "${{ env.MAIN_OS }}" ] && [ "${{ matrix.python-version }}" = "${{ env.MAIN_PY_VER }}" ];then
65
+ echo "IS_MAIN=1" >> $GITHUB_ENV
66
+ is_main=1
67
+ else
68
+ echo "IS_MAIN=0" >> $GITHUB_ENV
69
+ is_main=0
70
+ fi
71
+ if [ "${{ env.TMATE }}" = "true" ];then
72
+ if [ "$is_main" = 0 ];then
73
+ echo "Tmate is enabled and this is not main, skip tests"
74
+ exit 1
75
+ fi
76
+ echo "DEBUG=1" >> $GITHUB_ENV
77
+ else
78
+ echo "DEBUG=0" >> $GITHUB_ENV
79
+ fi
80
+ - uses: rcmdnk/python-action@v2
81
+ with:
82
+ checkout: 1
83
+ setup-python: 1
84
+ python-version: "${{ matrix.python-version }}"
85
+ pip: 'pip'
86
+ setup-cmd: 'poetry install'
87
+ pip-packages: ''
88
+ poetry: 1
89
+ cache: 'poetry'
90
+ pytest: 1
91
+ pytest-tests-path: 'tests/'
92
+ pytest-ignore: ''
93
+ pytest-separate-benchmark: 0
94
+ coverage: 1
95
+ coverage-cov-path: 'src'
96
+ coverage-push: "${{ env.IS_MAIN }}"
97
+ coverage-push-condition: "branch=${{ env.MAIN_BRANCH }}, os=${{ env.MAIN_OS }}, python_version=${{ env.MAIN_PY_VER }}"
98
+ github_token: "${{github.token}}"
99
+ pre-commit: "${{ env.IS_MAIN }}"
100
+ tmate: "${{ env.DEBUG }}"
@@ -0,0 +1,167 @@
1
+ # Ref: https://github.com/github/gitignore/blob/main/Python.gitignore
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ pip-wheel-metadata/
26
+ share/python-wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py,cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ cover/
56
+ pytest*
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ .pybuilder/
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # pyenv
90
+ .python-version
91
+
92
+ # pipenv
93
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
95
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
96
+ # install all needed dependencies.
97
+ #Pipfile.lock
98
+
99
+ # poetry
100
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
101
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
102
+ # commonly ignored for libraries.
103
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
104
+ #poetry.lock
105
+
106
+ # pdm
107
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
108
+ #pdm.lock
109
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
110
+ # in version control.
111
+ # https://pdm.fming.dev/#use-with-ide
112
+ .pdm.toml
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
161
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
+ #.idea/
163
+
164
+ # Others
165
+ .DS_Store
166
+ /*.txt
167
+ /*.py
@@ -0,0 +1,217 @@
1
+ repos:
2
+ - repo: local
3
+ hooks:
4
+ - id: ruff-lint-diff
5
+ # https://github.com/astral-sh/ruff-pre-commit
6
+ name: ruff-lint-diff
7
+ description: "Show diff of ruff for linting"
8
+ entry: ruff check --diff --force-exclude
9
+ language: system
10
+ types_or:
11
+ - python
12
+ - pyi
13
+ - jupyter
14
+ require_serial: true
15
+ minimum_pre_commit_version: "2.9.2"
16
+ verbose: true
17
+ - id: ruff-lint
18
+ # https://github.com/astral-sh/ruff-pre-commit
19
+ name: ruff-lint
20
+ description: "Fix by ruff for linting"
21
+ entry: ruff check --fix --force-exclude
22
+ language: system
23
+ types_or:
24
+ - python
25
+ - pyi
26
+ - jupyter
27
+ require_serial: true
28
+ minimum_pre_commit_version: "2.9.2"
29
+ - id: ruff-format-diff
30
+ name: ruff-format-diff
31
+ description: "Show diff of ruff for formatting"
32
+ entry: ruff format --diff --force-exclude
33
+ language: python
34
+ types_or:
35
+ - python
36
+ - pyi
37
+ - jupyter
38
+ require_serial: true
39
+ minimum_pre_commit_version: "2.9.2"
40
+ verbose: true
41
+ - id: ruff-format
42
+ name: ruff-format
43
+ description: "Fix by ruff for formatting"
44
+ entry: ruff format --force-exclude
45
+ language: python
46
+ types_or:
47
+ - python
48
+ - pyi
49
+ - jupyter
50
+ require_serial: true
51
+ minimum_pre_commit_version: "2.9.2"
52
+ - id: black-diff
53
+ name: black-diff
54
+ entry: black
55
+ language: system
56
+ types_or:
57
+ - python
58
+ - pyi
59
+ require_serial: true
60
+ args:
61
+ - "--diff"
62
+ - "--color"
63
+ - "--quiet"
64
+ verbose: true
65
+ - id: black
66
+ # https://github.com/psf/black-pre-commit-mirror
67
+ name: black
68
+ entry: black
69
+ language: system
70
+ types_or:
71
+ - python
72
+ - pyi
73
+ require_serial: true
74
+ args:
75
+ - "--quiet"
76
+ - id: blacken-docs
77
+ # https://github.com/asottile/blacken-docs
78
+ name: blacken-docs
79
+ entry: blacken-docs
80
+ language: system
81
+ files: '\.(rst|md|markdown|py|tex)$'
82
+ - id: autoflake-diff
83
+ name: autoflake-diff
84
+ entry: autoflake
85
+ language: system
86
+ types:
87
+ - python
88
+ require_serial: true
89
+ verbose: true
90
+ - id: autoflake
91
+ # https://github.com/PyCQA/autoflake
92
+ name: autoflake
93
+ entry: autoflake
94
+ language: system
95
+ types:
96
+ - python
97
+ require_serial: true
98
+ args:
99
+ - "--in-place"
100
+ - id: autopep8-diff
101
+ name: autopep8-diff
102
+ entry: autopep8
103
+ language: system
104
+ types:
105
+ - python
106
+ args:
107
+ - "--diff"
108
+ verbose: true
109
+ - id: autopep8
110
+ # https://github.com/hhatto/autopep8
111
+ name: autopep8
112
+ entry: autopep8
113
+ language: system
114
+ types:
115
+ - python
116
+ args:
117
+ - "--in-place"
118
+ - id: isort-diff
119
+ name: isort-diff
120
+ entry: isort
121
+ language: system
122
+ require_serial: true
123
+ types_or:
124
+ - cython
125
+ - pyi
126
+ - python
127
+ args:
128
+ - '--diff'
129
+ - '--filter-files'
130
+ verbose: true
131
+ - id: isort
132
+ # https://github.com/PyCQA/isort
133
+ name: isort
134
+ entry: isort
135
+ language: system
136
+ require_serial: true
137
+ types_or:
138
+ - cython
139
+ - pyi
140
+ - python
141
+ args:
142
+ - '--filter-files'
143
+ - id: flake8
144
+ # https://gitlab.com/pycqa/flake8
145
+ name: flake8
146
+ entry: flake8
147
+ language: system
148
+ types:
149
+ - python
150
+ require_serial: true
151
+ - id: bandit
152
+ # https://github.com/PyCQA/bandit
153
+ name: bandit
154
+ entry: bandit
155
+ language: system
156
+ types:
157
+ - python
158
+ args:
159
+ - "-c"
160
+ - "pyproject.toml"
161
+ - id: mypy
162
+ # https://github.com/pre-commit/mirrors-mypy
163
+ name: mypy
164
+ entry: mypy
165
+ language: system
166
+ types_or:
167
+ - python
168
+ - pyi
169
+ require_serial: true
170
+ pass_filenames: false
171
+ - id: numpydoc-validation
172
+ # https://github.com/numpy/numpydoc
173
+ name: numpydoc-validation
174
+ entry: validate-docstrings
175
+ require_serial: true
176
+ language: system
177
+ types:
178
+ - python
179
+ - id: shellcheck
180
+ # https://github.com/shellcheck-py/shellcheck-py
181
+ name: shellcheck
182
+ entry: shellcheck
183
+ language: system
184
+ types: [shell]
185
+ require_serial: true
186
+ - id: mdformat-check
187
+ name: mdformat-check
188
+ entry: mdformat
189
+ language: system
190
+ types: [markdown]
191
+ args:
192
+ - "--check"
193
+ - id: mdformat
194
+ name: mdformat
195
+ entry: mdformat
196
+ language: system
197
+ types: [markdown]
198
+ - repo: https://github.com/pre-commit/pre-commit-hooks
199
+ rev: v5.0.0
200
+ hooks:
201
+ - id: check-byte-order-marker
202
+ - id: check-yaml
203
+ - id: check-json
204
+ - id: check-toml
205
+ - id: check-case-conflict
206
+ - id: check-merge-conflict
207
+ args:
208
+ - "--assume-in-merge"
209
+ - id: end-of-file-fixer
210
+ - id: fix-byte-order-marker
211
+ - id: mixed-line-ending
212
+ - id: trailing-whitespace
213
+ - id: debug-statements
214
+ - id: detect-private-key
215
+ - id: detect-aws-credentials
216
+ args:
217
+ - "--allow-missing-credentials"