diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5df57a0..0d36f88 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,15 +9,15 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, windows-latest, macos-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Configure pip caching with: path: ~/.cache/pip @@ -34,12 +34,12 @@ jobs: runs-on: ubuntu-latest needs: [test] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.12' - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Configure pip caching with: path: ~/.cache/pip diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml index 8a86cd2..a3d5532 100644 --- a/.github/workflows/spellcheck.yml +++ b/.github/workflows/spellcheck.yml @@ -6,12 +6,12 @@ jobs: spellcheck: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: 3.9 - - uses: actions/cache@v2 + python-version: "3.12" + - uses: actions/cache@v4 name: Configure pip caching with: path: ~/.cache/pip diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index 0681f66..a710e41 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -12,12 +12,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: 3.9 - - uses: actions/cache@v2 + python-version: "3.11" + - uses: actions/cache@v4 name: Configure pip caching with: path: ~/.cache/pip diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1832262..9224d82 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,16 +10,22 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] numpy: [0, 1] - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest, macos-14] + # Skip 3.8 and 3.9 on macos-14 - it only has 3.10+ + exclude: + - python-version: "3.8" + os: macos-14 + - python-version: "3.9" + os: macos-14 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Configure pip caching with: path: ~/.cache/pip @@ -29,8 +35,7 @@ jobs: - name: Install dependencies run: | pip install -e '.[test,mypy,flake8]' - - name: Optionally install tui dependencies (not 3.7) - if: matrix.python-version != '3.7' + - name: Optionally install tui dependencies run: pip install -e '.[tui]' - name: Optionally install numpy if: matrix.numpy == 1 @@ -50,12 +55,10 @@ jobs: pytest -v - name: run mypy run: mypy sqlite_utils tests - - name: run flake8 if Python 3.8 or higher - if: matrix.python-version >= 3.8 + - name: run flake8 run: flake8 - name: Check formatting run: black . --check - name: Check if cog needs to be run - if: matrix.python-version != '3.7' run: | cog --check README.md docs/*.rst diff --git a/setup.py b/setup.py index 0ade8fc..5e512ae 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ setup( "pluggy", ], extras_require={ - "test": ["pytest", "black", "hypothesis", "cogapp"], + "test": ["pytest", "black>=24.1.1", "hypothesis", "cogapp"], "docs": [ "furo", "sphinx-autobuild", @@ -64,7 +64,7 @@ setup( "Issues": "https://github.com/simonw/sqlite-utils/issues", "CI": "https://github.com/simonw/sqlite-utils/actions", }, - python_requires=">=3.7", + python_requires=">=3.8", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -72,7 +72,6 @@ setup( "Intended Audience :: End Users/Desktop", "Topic :: Database", "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index c204b95..faec65c 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -457,8 +457,7 @@ class Database: fn_name, arity, fn, **dict(kwargs, deterministic=True) ) registered = True - except (sqlite3.NotSupportedError, TypeError): - # TypeError is Python 3.7 "function takes at most 3 arguments" + except sqlite3.NotSupportedError: pass if not registered: self.conn.create_function(fn_name, arity, fn, **kwargs) @@ -951,9 +950,9 @@ class Database: " [{column_name}] {column_type}{column_extras}".format( column_name=column_name, column_type=COLUMN_TYPE_MAPPING[column_type], - column_extras=(" " + " ".join(column_extras)) - if column_extras - else "", + column_extras=( + (" " + " ".join(column_extras)) if column_extras else "" + ), ) ) extra_pk = "" @@ -1527,9 +1526,11 @@ class Table(Queryable): def __repr__(self) -> str: return "".format( self.name, - " (does not exist yet)" - if not self.exists() - else " ({})".format(", ".join(c.name for c in self.columns)), + ( + " (does not exist yet)" + if not self.exists() + else " ({})".format(", ".join(c.name for c in self.columns)) + ), ) @property @@ -3001,9 +3002,11 @@ class Table(Queryable): value = jsonify_if_needed( record.get( key, - None - if key != hash_id - else hash_record(record, hash_id_columns), + ( + None + if key != hash_id + else hash_record(record, hash_id_columns) + ), ) ) if key in extracts: diff --git a/sqlite_utils/utils.py b/sqlite_utils/utils.py index 29440a5..9e9882a 100644 --- a/sqlite_utils/utils.py +++ b/sqlite_utils/utils.py @@ -304,10 +304,7 @@ def rows_from_file( rows = rows_from_file( fp, format=Format.CSV, dialect=csv.excel_tab, encoding=encoding )[0] - return ( - _extra_key_strategy(rows, ignore_extras, extras_key), - Format.TSV, - ) + return _extra_key_strategy(rows, ignore_extras, extras_key), Format.TSV elif format is None: # Detect the format, then call this recursively buffered = io.BufferedReader(cast(io.RawIOBase, fp), buffer_size=4096)