Compare commits

...

83 Commits
v0.3.2 ... main

Author SHA1 Message Date
charliermarsh
9aeda5d1f4 Mirror: 0.11.13
Some checks failed
main / main (push) Failing after 4s
2025-06-05 21:05:24 +00:00
charliermarsh
d19233b897 Mirror: 0.11.12 2025-05-29 13:37:20 +00:00
charliermarsh
76e47323a8 Mirror: 0.11.11 2025-05-22 19:25:38 +00:00
charliermarsh
12753357c0 Mirror: 0.11.10 2025-05-15 14:15:07 +00:00
Adam Turner
39f54b73c7
Add and prefer the ruff-check pre-commit ID (#124)
## Summary

Towards #123. Introduces the `ruff-check` pre-commit hook ID, updates
documentation to prefer it, but retains the `ruff` ID for compatibility.
2025-05-13 18:46:04 +05:30
charliermarsh
24e02b24b8 Mirror: 0.11.9 2025-05-09 16:25:33 +00:00
charliermarsh
f0fe93c067 Mirror: 0.11.8 2025-05-01 14:58:49 +00:00
charliermarsh
e84319e627 Mirror: 0.11.7 2025-04-24 18:55:43 +00:00
charliermarsh
d119aaff68 Mirror: 0.11.6 2025-04-17 13:41:32 +00:00
charliermarsh
8304991d8f Mirror: 0.11.5 2025-04-10 17:19:14 +00:00
charliermarsh
9719235819 Mirror: 0.11.4 2025-04-04 18:30:03 +00:00
charliermarsh
716f3372a2 Mirror: 0.11.3 2025-04-03 13:25:45 +00:00
charliermarsh
25a8c8da6c Mirror: 0.11.2 2025-03-21 13:36:56 +00:00
charliermarsh
03d1860500 Mirror: 0.11.1 2025-03-20 15:19:35 +00:00
Zanie Blue
87c3371eb1
Add write permissions to CI workflow (#118)
See https://github.com/astral-sh/uv-pre-commit/issues/44
2025-03-18 18:07:34 -05:00
charliermarsh
99abe27a5a Mirror: 0.11.0 2025-03-14 13:58:05 +00:00
charliermarsh
2b7436a2b1 Mirror: 0.10.0 2025-03-13 18:43:38 +00:00
charliermarsh
41d2daf392 Mirror: 0.9.10 2025-03-07 15:33:19 +00:00
charliermarsh
2c8dce6094 Mirror: 0.9.9 2025-02-28 10:22:43 +00:00
charliermarsh
f78b4d43a4 Mirror: 0.9.8 2025-02-27 14:16:08 +00:00
charliermarsh
efa716b1aa Mirror: 0.9.7 2025-02-20 13:52:04 +00:00
charliermarsh
895ebb3898 Mirror: 0.9.6 2025-02-10 13:05:01 +00:00
charliermarsh
d7f0995508 Mirror: 0.9.5 2025-02-06 19:52:38 +00:00
charliermarsh
871f3bcae4 Mirror: 0.9.4 2025-01-30 18:14:53 +00:00
charliermarsh
36b36942c5 Mirror: 0.9.3 2025-01-23 19:34:23 +00:00
charliermarsh
73413df07b Mirror: 0.9.2 2025-01-16 15:51:58 +00:00
charliermarsh
18ba2d02dc Mirror: 0.9.1 2025-01-10 19:03:15 +00:00
charliermarsh
8d1fdcef55 Mirror: 0.9.0 2025-01-09 14:13:07 +00:00
charliermarsh
89c421dff2 Mirror: 0.8.6 2025-01-04 12:28:02 +00:00
charliermarsh
751b8b57ba Mirror: 0.8.5 2025-01-02 12:09:30 +00:00
Calum Young
6299d2ca23
Update mirror.py to a uv script (#110)
<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

From my reading of the [UV
docs](https://docs.astral.sh/uv/guides/scripts/), `mirror.py` would be a
good example of a standalone script. This PR updates `mirror.py` and the
`main.yml` workflow to be a UV script and makes use of UV in the update
process.

## Test Plan

- Update the uv version (currently 0.8.4) to an older version e.g. 0.8.3
in both `pyproject.toml` and `README.md`
- Run `uv run --no-project mirror.py` to check the update process still
works as expected
2024-12-30 10:48:39 -05:00
charliermarsh
f0b5944bef Mirror: 0.8.4 2024-12-19 13:41:32 +00:00
charliermarsh
fc6ef5d0dd Mirror: 0.8.3 2024-12-12 15:22:54 +00:00
charliermarsh
8b76f04e7e Mirror: 0.8.2 2024-12-05 12:54:12 +00:00
charliermarsh
859e42ab7d Mirror: 0.8.1 2024-11-29 03:34:49 +00:00
charliermarsh
0710b94280 Mirror: 0.8.0 2024-11-22 10:13:07 +00:00
charliermarsh
cafecb2f68 Mirror: 0.7.4 2024-11-15 11:38:19 +00:00
charliermarsh
6a19e69c83 Mirror: 0.7.3 2024-11-08 11:27:35 +00:00
charliermarsh
52c175db9e Mirror: 0.7.2 2024-11-01 16:07:37 +00:00
charliermarsh
4edcbde74a Mirror: 0.7.1 2024-10-24 15:45:46 +00:00
charliermarsh
8983acb92e Mirror: 0.7.0 2024-10-17 19:36:30 +00:00
charliermarsh
75b98813cf Mirror: 0.6.9 2024-10-04 13:44:36 +00:00
Ruwen Frick
46cdcac1de
Update readme config examples to work with pre-commit >= 3 (#99)
Co-authored-by: Ruwen Frick <ruwen.frick@ost.ch>
2024-09-27 08:49:08 +02:00
charliermarsh
cc915bbf18 Mirror: 0.6.8 2024-09-26 12:31:46 +00:00
charliermarsh
9f089bd3b7 Mirror: 0.6.7 2024-09-21 17:40:11 +00:00
charliermarsh
ef9b09598d Mirror: 0.6.6 2024-09-20 03:32:30 +00:00
charliermarsh
79f422bd92 Mirror: 0.6.5 2024-09-13 15:04:15 +00:00
charliermarsh
03d82ba032 Mirror: 0.6.4 2024-09-05 15:55:58 +00:00
charliermarsh
f1ebc5730d Mirror: 0.6.3 2024-08-29 15:20:51 +00:00
charliermarsh
24d039e647 Mirror: 0.6.2 2024-08-22 13:51:31 +00:00
charliermarsh
8b5112a3b2 Mirror: 0.6.1 2024-08-16 17:09:07 +00:00
Henry Schreiner
20d9ac3f11
Check Jupyter notebooks by default, in sync with 0.6.0 (#96) 2024-08-15 17:25:51 +01:00
charliermarsh
718fbf5fa5 Mirror: 0.6.0 2024-08-15 12:39:51 +00:00
charliermarsh
ac97362543 Mirror: 0.5.7 2024-08-08 15:47:05 +00:00
charliermarsh
89fdf53fde Mirror: 0.5.6 2024-08-02 15:56:39 +00:00
charliermarsh
1ee2e38793 Mirror: 0.5.5 2024-07-25 15:08:16 +00:00
charliermarsh
cbaa26132c Mirror: 0.5.4 2024-07-20 18:06:32 +00:00
charliermarsh
34e6222063 Mirror: 0.5.3 2024-07-18 17:10:25 +00:00
charliermarsh
47533c0f59 Mirror: 0.5.2 2024-07-14 15:11:56 +00:00
charliermarsh
f6793c73d5 Mirror: 0.5.1 2024-07-05 13:30:45 +00:00
Jeppe Fihl-Pearson
987f9d7d01
Remove "v" from the Ruff version number in link to release notes (#92)
## Summary

Starting with version 0.5.0 of Ruff, the release/tag name doesn't have a
leading "v". This has broken the link to the release notes that get
added to the release notes for the pre-commit hook.

This fixes it by stripping any "v" from the version number string.

See #91.

## Test Plan

Tested in a bash shell:
```bash
bash-5.2$ TAG_NAME=v0.5.0
bash-5.2$ echo ${TAG_NAME/v}
0.5.0
```

Will otherwise have to be tested on the next Ruff release.
2024-06-28 07:32:17 -04:00
charliermarsh
1dc9eb131c Mirror: 0.5.0 2024-06-27 15:43:31 +00:00
charliermarsh
a5c7353d59 Mirror: 0.4.10 2024-06-20 17:44:01 +00:00
charliermarsh
02609a0003 Mirror: 0.4.9 2024-06-14 15:20:40 +00:00
charliermarsh
99e5311c54 Mirror: 0.4.8 2024-06-05 15:34:50 +00:00
charliermarsh
f428577948 Mirror: 0.4.7 2024-05-31 20:45:13 +00:00
charliermarsh
06206113ba Mirror: 0.4.6 2024-05-28 19:23:09 +00:00
charliermarsh
fc609d3ce5 Mirror: 0.4.5 2024-05-23 01:31:27 +00:00
charliermarsh
f8a3f8c471 Mirror: 0.4.4 2024-05-09 17:14:19 +00:00
charliermarsh
5559d0350d Mirror: 0.4.3 2024-05-03 23:04:06 +00:00
charliermarsh
596470fba2 Mirror: 0.4.2 2024-04-25 17:53:17 +00:00
charliermarsh
21d9bff1d6 Mirror: 0.4.1 2024-04-19 16:05:59 +00:00
charliermarsh
2ca3d774ce Mirror: 0.4.0 2024-04-18 19:52:15 +00:00
charliermarsh
e76e45000a Mirror: 0.3.7 2024-04-12 03:55:37 +00:00
charliermarsh
c0bff48397 Mirror: 0.3.6 2024-04-11 16:25:42 +00:00
CoderJoshDK
1e9839fabf
fix: correct release notes link (#84)
## Summary

I originally tested this functionality in `uv-pre-commit`. And that is
why when moving it over, I ended up copying the URL for that release. I
am sorry for all the broken code I have introduced. I feel so bad. I am
at least glad I realized before a new `ruff` release came out.
2024-04-05 00:45:38 -04:00
CoderJoshDK
2b6485a44b
fix: auto release on mirror updates (#83)
As mentioned in #82, there are issues with having a workflow triggered
by the work done by a different workflow. To keep the functionality of
the auto release workflow, the two files are being merged into one.

Closes #82
2024-04-03 20:39:03 -05:00
CoderJoshDK
4025f7f381
feat: use uv for package management (#77)
<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

`uv` is great. So we should use it where we can. 

The cache had to be removed because the workflow breaks currently.
https://github.com/actions/setup-python/issues/822
When this is solved, caching can be brought back in.

## Test Plan

Ran workflow on my local repo.
2024-04-01 23:05:43 -05:00
charliermarsh
0ccbb5b794 Mirror: 0.3.5
Some checks failed
Releases / release (push) Failing after 11s
2024-04-01 17:37:36 +00:00
CoderJoshDK
53e3b33bd4
feat(workflow): auto release on tag creation (#81)
## Summary

Add a GitHub workflow for creating a new release, automatically, when a
new tag is created.

This solves #78. The code is very similar to the changes added in
https://github.com/astral-sh/uv-pre-commit/pull/6

The primary difference, is that the URL points to ruff and this one
checks for if the tag starts with a `v`, but it is optional. This lets
you change ruff versions to not have a `v` in the future. Although the
`mirror.py` will need to be updated.
Speaking of updates to `mirror.py`, I ran `ruff` on it and updated the
`subprocess` to raise an error on failure.

## Test Plan

Locally tested.
2024-03-30 19:17:08 -04:00
CoderJoshDK
6e85b5cd1f
chore: update information (#76)
## Summary

Changes proposed and introduced through:
https://github.com/astral-sh/uv-pre-commit/pull/1 ; are being fixed and
updated for this repo as well.
2024-03-22 17:46:59 -05:00
Github Actions
1986670a8c Mirror: 0.3.4 2024-03-21 19:22:29 +00:00
Github Actions
c22645f6b4 Mirror: 0.3.3 2024-03-15 18:07:19 +00:00
9 changed files with 297 additions and 221 deletions

View File

@ -10,27 +10,50 @@ jobs:
build:
name: main
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- if: ${{ startsWith(github.event_name, 'repository_dispatch') }}
run: sleep 30
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: pip
cache-dependency-path: requirements-dev.txt
- run: pip install -r requirements-dev.txt
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: set git config
run: |
git config user.name 'Github Actions'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- run: python mirror.py
- run: uv run --no-project mirror.py
- run: |
- name: check for unpushed commits
id: check_unpushed
run: |
UNPUSHED_COMMITS=$(git log origin/main..HEAD)
if [ -z "$UNPUSHED_COMMITS" ]; then
echo "No unpushed commits found."
echo "changes_exist=false" >> $GITHUB_ENV
else
echo "Unpushed commits found."
echo "changes_exist=true" >> $GITHUB_ENV
fi
- name: push changes if they exist
if: env.changes_exist == 'true'
run: |
git push origin HEAD:refs/heads/main
git push origin HEAD:refs/heads/main --tags
- name: create release on new tag if new changes exist
if: env.changes_exist == 'true'
run: |
TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))
echo $TAG_NAME
gh release create "$TAG_NAME" \
--title "$TAG_NAME" \
--notes "See: https://github.com/astral-sh/ruff/releases/tag/${TAG_NAME/v}" \
--latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

130
.gitignore vendored
View File

@ -1,129 +1,3 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
__pycache__
*.pyc
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/

View File

@ -1,20 +1,32 @@
- id: ruff
name: ruff
description: "Run 'ruff' for extremely fast Python linting"
- id: ruff-check
name: ruff check
description: "Run 'ruff check' for extremely fast Python linting"
entry: ruff check --force-exclude
language: python
types_or: [python, pyi]
types_or: [python, pyi, jupyter]
args: []
require_serial: true
additional_dependencies: []
minimum_pre_commit_version: "2.9.2"
- id: ruff-format
name: ruff-format
name: ruff format
description: "Run 'ruff format' for extremely fast Python formatting"
entry: ruff format --force-exclude
language: python
types_or: [python, pyi]
types_or: [python, pyi, jupyter]
args: []
require_serial: true
additional_dependencies: []
minimum_pre_commit_version: "2.9.2"
# Legacy alias
- id: ruff
name: ruff (legacy alias)
description: "Run 'ruff check' for extremely fast Python linting"
entry: ruff check --force-exclude
language: python
types_or: [python, pyi, jupyter]
args: []
require_serial: true
additional_dependencies: []

202
LICENSE-APACHE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2022 Charlie Marsh
Copyright (c) 2024 Astral Software Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,9 +1,9 @@
# ruff-pre-commit
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![image](https://img.shields.io/pypi/v/ruff/0.3.2.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/l/ruff/0.3.2.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/pyversions/ruff/0.3.2.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/v/ruff/0.11.13.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/l/ruff/0.11.13.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/pyversions/ruff/0.11.13.svg)](https://pypi.python.org/pypi/ruff)
[![Actions status](https://github.com/astral-sh/ruff-pre-commit/workflows/main/badge.svg)](https://github.com/astral-sh/ruff-pre-commit/actions)
A [pre-commit](https://pre-commit.com/) hook for [Ruff](https://github.com/astral-sh/ruff).
@ -17,12 +17,13 @@ To run Ruff's [linter](https://docs.astral.sh/ruff/linter) and [formatter](https
(available as of Ruff v0.0.289) via pre-commit, add the following to your `.pre-commit-config.yaml`:
```yaml
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.2
rev: v0.11.13
hooks:
# Run the linter.
- id: ruff
- id: ruff-check
# Run the formatter.
- id: ruff-format
```
@ -30,31 +31,33 @@ To run Ruff's [linter](https://docs.astral.sh/ruff/linter) and [formatter](https
To enable lint fixes, add the `--fix` argument to the lint hook:
```yaml
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.2
rev: v0.11.13
hooks:
# Run the linter.
- id: ruff
- id: ruff-check
args: [ --fix ]
# Run the formatter.
- id: ruff-format
```
To run the hooks over Jupyter Notebooks too, add `jupyter` to the list of allowed filetypes:
To avoid running on Jupyter Notebooks, remove `jupyter` from the list of allowed filetypes:
```yaml
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.2
rev: v0.11.13
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi, jupyter ]
- id: ruff-check
types_or: [ python, pyi ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
types_or: [ python, pyi ]
```
When running with `--fix`, Ruff's lint hook should be placed _before_ Ruff's formatter hook, and
@ -69,7 +72,16 @@ When running without `--fix`, Ruff's formatter hook can be placed before or afte
## License
MIT
ruff-pre-commit is licensed under either of
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or <https://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/licenses/MIT>)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in ruff-pre-commit by you, as defined in the Apache-2.0 license, shall be
dually licensed as above, without any additional terms or conditions.
<div align="center">
<a target="_blank" href="https://astral.sh" style="background:none">

View File

@ -1,9 +1,18 @@
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "packaging==23.1",
# "urllib3==2.0.5",
# ]
# ///
"""Update ruff-pre-commit to the latest version of ruff."""
import re
import subprocess
import tomllib
import typing
from pathlib import Path
import tomllib
import urllib3
from packaging.requirements import Requirement
from packaging.version import Version
@ -20,14 +29,14 @@ def main():
for version in target_versions:
paths = process_version(version)
if subprocess.check_output(["git", "status", "-s"]).strip():
subprocess.run(["git", "add", *paths])
subprocess.run(["git", "commit", "-m", f"Mirror: {version}"])
subprocess.run(["git", "tag", f"v{version}"])
subprocess.run(["git", "add", *paths], check=True)
subprocess.run(["git", "commit", "-m", f"Mirror: {version}"], check=True)
subprocess.run(["git", "tag", f"v{version}"], check=True)
else:
print(f"No change v{version}")
def get_all_versions() -> typing.List[Version]:
def get_all_versions() -> list[Version]:
response = urllib3.request("GET", "https://pypi.org/pypi/ruff/json")
if response.status != 200:
raise RuntimeError("Failed to fetch versions from pypi")

View File

@ -2,12 +2,5 @@
name = "ruff-pre-commit"
version = "0.0.0"
dependencies = [
"ruff==0.3.2",
]
[project.optional-dependencies]
dev = [
"packaging~=23.1",
"pip-tools>=7.3.0,<8.0.0",
"urllib3>=2.0.5,<3.0.0",
"ruff==0.11.13",
]

View File

@ -1,49 +0,0 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --extra=dev --generate-hashes --output-file=./requirements-dev.txt --unsafe-package=ruff ./pyproject.toml
#
build==1.0.3 \
--hash=sha256:538aab1b64f9828977f84bc63ae570b060a8ed1be419e7870b8b4fc5e6ea553b \
--hash=sha256:589bf99a67df7c9cf07ec0ac0e5e2ea5d4b37ac63301c4986d1acb126aa83f8f
# via pip-tools
click==8.1.7 \
--hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
--hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
# via pip-tools
packaging==23.1 \
--hash=sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61 \
--hash=sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f
# via
# build
# ruff-pre-commit (./pyproject.toml)
pip==23.2.1 \
--hash=sha256:7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be \
--hash=sha256:fb0bd5435b3200c602b5bf61d2d43c2f13c02e29c1707567ae7fbc514eb9faf2
# via pip-tools
pip-tools==7.3.0 \
--hash=sha256:8717693288720a8c6ebd07149c93ab0be1fced0b5191df9e9decd3263e20d85e \
--hash=sha256:8e9c99127fe024c025b46a0b2d15c7bd47f18f33226cf7330d35493663fc1d1d
# via ruff-pre-commit (./pyproject.toml)
pyproject-hooks==1.0.0 \
--hash=sha256:283c11acd6b928d2f6a7c73fa0d01cb2bdc5f07c57a2eeb6e83d5e56b97976f8 \
--hash=sha256:f271b298b97f5955d53fb12b72c1fb1948c22c1a6b70b315c54cedaca0264ef5
# via build
setuptools==68.2.2 \
--hash=sha256:4ac1475276d2f1c48684874089fefcd83bd7162ddaafb81fac866ba0db282a87 \
--hash=sha256:b454a35605876da60632df1a60f736524eb73cc47bbc9f3f1ef1b644de74fd2a
# via pip-tools
urllib3==2.0.5 \
--hash=sha256:13abf37382ea2ce6fb744d4dad67838eec857c9f4f57009891805e0b5e123594 \
--hash=sha256:ef16afa8ba34a1f989db38e1dbbe0c302e4289a47856990d0682e374563ce35e
# via ruff-pre-commit (./pyproject.toml)
wheel==0.41.2 \
--hash=sha256:0c5ac5ff2afb79ac23ab82bab027a0be7b5dbcf2e54dc50efe4bf507de1f7985 \
--hash=sha256:75909db2664838d015e3d9139004ee16711748a52c8f336b52882266540215d8
# via pip-tools
# WARNING: The following packages were not pinned, but pip requires them to be
# pinned when the requirements file includes hashes and the requirement is not
# satisfied by a package already installed. Consider using the --allow-unsafe flag.
# ruff