Skip to main content

Merge pull request #42 from alexwlchan/build-improvements

ID
6d5b8bc
date
2024-06-02 09:22:42+00:00
author
Alex Chan <alex@alexwlchan.net>
parents
b236137, 883d0da
message
Merge pull request #42 from alexwlchan/build-improvements

Various Python tooling-related build improvements
changed files
5 files, 29 additions, 70 deletions

Changed files

.github/workflows/test.yml (1018) → .github/workflows/test.yml (653)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index b72bfaa..d3b6ad0 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -18,20 +18,15 @@ jobs:
       uses: actions/setup-python@v5
       with:
         python-version: "3.12"
+        cache: pip
+
     - name: Install dependencies
-      run: |
-        pip install -r requirements.txt
+      run: pip install -r requirements.txt
+
     - name: Run linting
       run: |
-        black --check .
-
-        # E501 = line too long; anything up to 100-ish is fine in my book
-        # (the "ish" is intentional; see https://www.youtube.com/watch?v=wf-BqAjZb8M)
-        #
-        # W503 = line break before binary operator; this is something added
-        # by black and I don't have a strong opinion on, so I'm going to trust
-        # black and have flake8 ignore it.
-        flake8 --ignore=E501,W503
+        ruff check .
+        ruff format --check .
 
     - name: Check README files with Cog
       run: ./text/recog --check

aws/dynamols.py (4887) → aws/dynamols.py (4889)

diff --git a/aws/dynamols.py b/aws/dynamols.py
index 6f2cf1a..ea03aca 100755
--- a/aws/dynamols.py
+++ b/aws/dynamols.py
@@ -112,9 +112,9 @@ def parallel_scan_table(sess, *, TableName, **kwargs):
             # of entries in the queue if we've finished scanning the table, so
             # we need to spot that and not throw.
             for scan_params in itertools.islice(scans_to_run, len(done)):
-                futures[
-                    executor.submit(dynamo_client.scan, **scan_params)
-                ] = scan_params
+                futures[executor.submit(dynamo_client.scan, **scan_params)] = (
+                    scan_params
+                )
 
 
 def list_table_names(sess):

fish_functions/pyfmt.fish (219) → fish_functions/pyfmt.fish (363)

diff --git a/fish_functions/pyfmt.fish b/fish_functions/pyfmt.fish
index ac7746b..e7306f7 100644
--- a/fish_functions/pyfmt.fish
+++ b/fish_functions/pyfmt.fish
@@ -1,3 +1,11 @@
+function _run_ruff
+    if which ruff >/dev/null
+        ruff $argv
+    else
+        ~/repos/scripts/.venv/bin/ruff $argv
+    end
+end
+
 function pyfmt --description "Run Python formatting over a directory"
     if test (count $argv) -eq 0
         set root $PWD
@@ -5,6 +13,6 @@ function pyfmt --description "Run Python formatting over a directory"
         set root $argv[1]
     end
 
-    ruff check "$root"
-    ruff format "$root"
+    _run_ruff check "$root"
+    _run_ruff format "$root"
 end

requirements.in (371) → requirements.in (353)

diff --git a/requirements.in b/requirements.in
index 79bcd1a..6216c71 100644
--- a/requirements.in
+++ b/requirements.in
@@ -1,11 +1,9 @@
 attrs
-black
 boto3
 beautifulsoup4
 cogapp
 datasette
 datasette-render-image-tags
-flake8
 google-api-python-client==1.7.2
 google-auth-oauthlib==0.4.1
 httpx
@@ -16,11 +14,11 @@ keyring
 naturalsort==1.5.1  # Used as 'natsort'
 Pillow
 pillow_heif
-pip-tools
 pipx
 pygments  # Used as 'pygmentize' in 'pp_xml.sh'
 pypdf
 pytest
+ruff
 sqlite-utils
 termcolor
 tqdm

requirements.txt (5119) → requirements.txt (4442)

diff --git a/requirements.txt b/requirements.txt
index 1e738ed..497cab6 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,9 +1,5 @@
-#
-# This file is autogenerated by pip-compile with Python 3.12
-# by the following command:
-#
-#    pip-compile
-#
+# This file was autogenerated by uv via the following command:
+#    uv pip compile requirements.in --output-file requirements.txt
 aiofiles==23.2.1
     # via datasette
 anyio==4.1.0
@@ -18,8 +14,6 @@ attrs==23.1.0
     # via -r requirements.in
 beautifulsoup4==4.12.3
     # via -r requirements.in
-black==23.11.0
-    # via -r requirements.in
 boto3==1.33.11
     # via -r requirements.in
 botocore==1.33.11
@@ -28,8 +22,6 @@ botocore==1.33.11
     #   s3transfer
 brotli==1.1.0
     # via yt-dlp
-build==1.0.3
-    # via pip-tools
 cachetools==5.3.2
     # via google-auth
 certifi==2023.11.17
@@ -38,16 +30,12 @@ certifi==2023.11.17
     #   httpx
     #   requests
     #   yt-dlp
-cffi==1.16.0
-    # via cryptography
 charset-normalizer==3.3.2
     # via requests
 click==8.1.7
     # via
-    #   black
     #   click-default-group
     #   datasette
-    #   pip-tools
     #   sqlite-utils
     #   userpath
     #   uvicorn
@@ -57,16 +45,12 @@ click-default-group==1.2.4
     #   sqlite-utils
 cogapp==3.3.0
     # via -r requirements.in
-cryptography==42.0.7
-    # via secretstorage
 datasette==0.64.6
     # via
     #   -r requirements.in
     #   datasette-render-image-tags
 datasette-render-image-tags==0.1
     # via -r requirements.in
-flake8==6.1.0
-    # via -r requirements.in
 google-api-python-client==1.7.2
     # via -r requirements.in
 google-auth==2.27.0
@@ -120,10 +104,6 @@ jaraco-context==5.3.0
     # via keyring
 jaraco-functools==4.0.1
     # via keyring
-jeepney==0.8.0
-    # via
-    #   keyring
-    #   secretstorage
 jinja2==3.1.3
     # via datasette
 jmespath==1.0.1
@@ -134,8 +114,6 @@ keyring==25.2.1
     # via -r requirements.in
 markupsafe==2.1.3
     # via jinja2
-mccabe==0.7.0
-    # via flake8
 mergedeep==1.3.4
     # via datasette
 more-itertools==10.1.0
@@ -144,20 +122,14 @@ more-itertools==10.1.0
     #   jaraco-functools
 mutagen==1.47.0
     # via yt-dlp
-mypy-extensions==1.0.0
-    # via black
 naturalsort==1.5.1
     # via -r requirements.in
 oauthlib==3.2.2
     # via requests-oauthlib
 packaging==23.2
     # via
-    #   black
-    #   build
     #   pipx
     #   pytest
-pathspec==0.12.0
-    # via black
 pillow==10.1.0
     # via
     #   -r requirements.in
@@ -166,14 +138,12 @@ pillow-heif==0.14.0
     # via -r requirements.in
 pint==0.23
     # via datasette
-pip-tools==7.3.0
-    # via -r requirements.in
+pip==24.0
+    # via datasette
 pipx==1.5.0
     # via -r requirements.in
 platformdirs==4.1.0
-    # via
-    #   black
-    #   pipx
+    # via pipx
 pluggy==1.3.0
     # via
     #   datasette
@@ -185,22 +155,14 @@ pyasn1==0.5.1
     #   rsa
 pyasn1-modules==0.3.0
     # via google-auth
-pycodestyle==2.11.1
-    # via flake8
-pycparser==2.22
-    # via cffi
 pycryptodomex==3.19.0
     # via yt-dlp
-pyflakes==3.1.0
-    # via flake8
 pygments==2.18.0
     # via -r requirements.in
 pyparsing==3.1.1
     # via httplib2
 pypdf==3.17.2
     # via -r requirements.in
-pyproject-hooks==1.0.0
-    # via build
 pytest==7.4.3
     # via -r requirements.in
 python-dateutil==2.8.2
@@ -220,10 +182,12 @@ requests-oauthlib==1.3.1
     # via google-auth-oauthlib
 rsa==4.9
     # via google-auth
+ruff==0.4.7
+    # via -r requirements.in
 s3transfer==0.8.2
     # via boto3
-secretstorage==3.3.3
-    # via keyring
+setuptools==70.0.0
+    # via datasette
 six==1.16.0
     # via
     #   google-api-python-client
@@ -261,11 +225,5 @@ uvicorn==0.25.0
     # via datasette
 websockets==12.0
     # via yt-dlp
-wheel==0.42.0
-    # via pip-tools
 yt-dlp==2024.5.26
     # via -r requirements.in
-
-# The following packages are considered to be unsafe in a requirements file:
-# pip
-# setuptools