From 4025f7f381cad719758dc5c196d46da60aa5b7dd Mon Sep 17 00:00:00 2001 From: CoderJoshDK <74162303+CoderJoshDK@users.noreply.github.com> Date: Tue, 2 Apr 2024 00:05:43 -0400 Subject: [PATCH 1/7] feat: use uv for package management (#77) ## 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. --- .github/workflows/main.yml | 9 ++++---- pyproject.toml | 1 - requirements-dev.txt | 44 +++----------------------------------- 3 files changed, 8 insertions(+), 46 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c30dd5a..adba977 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,13 +16,14 @@ jobs: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.11" - cache: pip - cache-dependency-path: requirements-dev.txt - - run: pip install -r requirements-dev.txt + - name: download uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - run: uv pip install --system -r requirements-dev.txt - name: set git config run: | diff --git a/pyproject.toml b/pyproject.toml index cd462a8..9e2bfd2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,5 @@ dependencies = [ [project.optional-dependencies] dev = [ "packaging~=23.1", - "pip-tools>=7.3.0,<8.0.0", "urllib3>=2.0.5,<3.0.0", ] diff --git a/requirements-dev.txt b/requirements-dev.txt index ec9cbe4..c98d526 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,49 +1,11 @@ -# -# 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 +# This file was autogenerated by uv via the following command: +# uv pip compile --extra=dev --generate-hashes -o requirements-dev.txt --no-emit-package=ruff pyproject.toml 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. +# The following packages were excluded from the output: # ruff From 2b6485a44b3cde04a59f58400044b27b00ff644c Mon Sep 17 00:00:00 2001 From: CoderJoshDK <74162303+CoderJoshDK@users.noreply.github.com> Date: Wed, 3 Apr 2024 21:39:03 -0400 Subject: [PATCH 2/7] 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 --- .github/workflows/main.yml | 28 +++++++++++++++++++++++++++- .github/workflows/release.yml | 20 -------------------- 2 files changed, 27 insertions(+), 21 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index adba977..3358a6e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,6 +32,32 @@ jobs: - run: python 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/uv/releases/tag/$TAG_NAME" \ + --latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index e933642..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Releases - -on: - push: - tags: - - 'v?[0-9]+.[0-9]+.[0-9]*' - -jobs: - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - run: | - TAG_NAME=${GITHUB_REF#refs/tags/} - gh release create "$TAG_NAME" \ - --title "$TAG_NAME" \ - --notes "See: https://github.com/astral-sh/ruff/releases/tag/$TAG_NAME" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1e9839fabf35aa7bad44c3b56fd4a1a5440676eb Mon Sep 17 00:00:00 2001 From: CoderJoshDK <74162303+CoderJoshDK@users.noreply.github.com> Date: Fri, 5 Apr 2024 00:45:38 -0400 Subject: [PATCH 3/7] 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. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3358a6e..d45d484 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,7 +57,7 @@ jobs: echo $TAG_NAME gh release create "$TAG_NAME" \ --title "$TAG_NAME" \ - --notes "See: https://github.com/astral-sh/uv/releases/tag/$TAG_NAME" \ + --notes "See: https://github.com/astral-sh/ruff/releases/tag/$TAG_NAME" \ --latest env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c0bff48397a5119af3fadb07c507dd09ac9e2aa8 Mon Sep 17 00:00:00 2001 From: charliermarsh Date: Thu, 11 Apr 2024 16:25:42 +0000 Subject: [PATCH 4/7] Mirror: 0.3.6 --- README.md | 12 ++++++------ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b68715d..36ce169 100644 --- a/README.md +++ b/README.md @@ -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.5.svg)](https://pypi.python.org/pypi/ruff) -[![image](https://img.shields.io/pypi/l/ruff/0.3.5.svg)](https://pypi.python.org/pypi/ruff) -[![image](https://img.shields.io/pypi/pyversions/ruff/0.3.5.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/v/ruff/0.3.6.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/l/ruff/0.3.6.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/pyversions/ruff/0.3.6.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). @@ -19,7 +19,7 @@ To run Ruff's [linter](https://docs.astral.sh/ruff/linter) and [formatter](https ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.3.5 + rev: v0.3.6 hooks: # Run the linter. - id: ruff @@ -32,7 +32,7 @@ To enable lint fixes, add the `--fix` argument to the lint hook: ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.3.5 + rev: v0.3.6 hooks: # Run the linter. - id: ruff @@ -46,7 +46,7 @@ To run the hooks over Jupyter Notebooks too, add `jupyter` to the list of allowe ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.3.5 + rev: v0.3.6 hooks: # Run the linter. - id: ruff diff --git a/pyproject.toml b/pyproject.toml index 9e2bfd2..f6e1e98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "ruff-pre-commit" version = "0.0.0" dependencies = [ - "ruff==0.3.5", + "ruff==0.3.6", ] [project.optional-dependencies] From e76e45000a5aa92cd2ec4d3fb1485f2f9fea5097 Mon Sep 17 00:00:00 2001 From: charliermarsh Date: Fri, 12 Apr 2024 03:55:37 +0000 Subject: [PATCH 5/7] Mirror: 0.3.7 --- README.md | 12 ++++++------ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 36ce169..3a404de 100644 --- a/README.md +++ b/README.md @@ -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.6.svg)](https://pypi.python.org/pypi/ruff) -[![image](https://img.shields.io/pypi/l/ruff/0.3.6.svg)](https://pypi.python.org/pypi/ruff) -[![image](https://img.shields.io/pypi/pyversions/ruff/0.3.6.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/v/ruff/0.3.7.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/l/ruff/0.3.7.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/pyversions/ruff/0.3.7.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). @@ -19,7 +19,7 @@ To run Ruff's [linter](https://docs.astral.sh/ruff/linter) and [formatter](https ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.3.6 + rev: v0.3.7 hooks: # Run the linter. - id: ruff @@ -32,7 +32,7 @@ To enable lint fixes, add the `--fix` argument to the lint hook: ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.3.6 + rev: v0.3.7 hooks: # Run the linter. - id: ruff @@ -46,7 +46,7 @@ To run the hooks over Jupyter Notebooks too, add `jupyter` to the list of allowe ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.3.6 + rev: v0.3.7 hooks: # Run the linter. - id: ruff diff --git a/pyproject.toml b/pyproject.toml index f6e1e98..678b227 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "ruff-pre-commit" version = "0.0.0" dependencies = [ - "ruff==0.3.6", + "ruff==0.3.7", ] [project.optional-dependencies] From 2ca3d774ce61288db69efaea35298f70653dbcd3 Mon Sep 17 00:00:00 2001 From: charliermarsh Date: Thu, 18 Apr 2024 19:52:15 +0000 Subject: [PATCH 6/7] Mirror: 0.4.0 --- README.md | 12 ++++++------ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3a404de..5a8cbca 100644 --- a/README.md +++ b/README.md @@ -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.7.svg)](https://pypi.python.org/pypi/ruff) -[![image](https://img.shields.io/pypi/l/ruff/0.3.7.svg)](https://pypi.python.org/pypi/ruff) -[![image](https://img.shields.io/pypi/pyversions/ruff/0.3.7.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/v/ruff/0.4.0.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/l/ruff/0.4.0.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/pyversions/ruff/0.4.0.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). @@ -19,7 +19,7 @@ To run Ruff's [linter](https://docs.astral.sh/ruff/linter) and [formatter](https ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.3.7 + rev: v0.4.0 hooks: # Run the linter. - id: ruff @@ -32,7 +32,7 @@ To enable lint fixes, add the `--fix` argument to the lint hook: ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.3.7 + rev: v0.4.0 hooks: # Run the linter. - id: ruff @@ -46,7 +46,7 @@ To run the hooks over Jupyter Notebooks too, add `jupyter` to the list of allowe ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.3.7 + rev: v0.4.0 hooks: # Run the linter. - id: ruff diff --git a/pyproject.toml b/pyproject.toml index 678b227..3d70c0a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "ruff-pre-commit" version = "0.0.0" dependencies = [ - "ruff==0.3.7", + "ruff==0.4.0", ] [project.optional-dependencies] From 21d9bff1d62aaf03230baa6b804b9074255fa9b8 Mon Sep 17 00:00:00 2001 From: charliermarsh Date: Fri, 19 Apr 2024 16:05:59 +0000 Subject: [PATCH 7/7] Mirror: 0.4.1 --- README.md | 12 ++++++------ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5a8cbca..17fd3ea 100644 --- a/README.md +++ b/README.md @@ -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.4.0.svg)](https://pypi.python.org/pypi/ruff) -[![image](https://img.shields.io/pypi/l/ruff/0.4.0.svg)](https://pypi.python.org/pypi/ruff) -[![image](https://img.shields.io/pypi/pyversions/ruff/0.4.0.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/v/ruff/0.4.1.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/l/ruff/0.4.1.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/pyversions/ruff/0.4.1.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). @@ -19,7 +19,7 @@ To run Ruff's [linter](https://docs.astral.sh/ruff/linter) and [formatter](https ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.4.0 + rev: v0.4.1 hooks: # Run the linter. - id: ruff @@ -32,7 +32,7 @@ To enable lint fixes, add the `--fix` argument to the lint hook: ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.4.0 + rev: v0.4.1 hooks: # Run the linter. - id: ruff @@ -46,7 +46,7 @@ To run the hooks over Jupyter Notebooks too, add `jupyter` to the list of allowe ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.4.0 + rev: v0.4.1 hooks: # Run the linter. - id: ruff diff --git a/pyproject.toml b/pyproject.toml index 3d70c0a..4edc270 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "ruff-pre-commit" version = "0.0.0" dependencies = [ - "ruff==0.4.0", + "ruff==0.4.1", ] [project.optional-dependencies]