Test against Python 3.13 pre-release (#619)

* Test against Python 3.13 pre-release

* Skip tests for numpy on Python 3.13

Refs https://github.com/simonw/sqlite-utils/pull/619#issuecomment-1998798451

* Try to avoid Python 3.13 cog differences

* Hide \b characters in cli-reference

* Fixed .rST warning
This commit is contained in:
Simon Willison 2024-03-14 21:14:10 -07:00 • committed by GitHub
commit 5bd7aec4d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 26 deletions

View file

@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
numpy: [0, 1] numpy: [0, 1]
os: [ubuntu-latest, macos-latest, windows-latest, macos-14] os: [ubuntu-latest, macos-latest, windows-latest, macos-14]
# Skip 3.8 and 3.9 on macos-14 - it only has 3.10+ # Skip 3.8 and 3.9 on macos-14 - it only has 3.10+
@ -19,12 +19,15 @@ jobs:
os: macos-14 os: macos-14
- python-version: "3.9" - python-version: "3.9"
os: macos-14 os: macos-14
- python-version: "3.13"
numpy: 1
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: actions/cache@v4 - uses: actions/cache@v4
name: Configure pip caching name: Configure pip caching
with: with:

View file

@ -85,6 +85,7 @@ This page lists the ``--help`` for every ``sqlite-utils`` CLI sub-command.
cog.out("::\n\n") cog.out("::\n\n")
result = CliRunner().invoke(cli.cli, [command, "--help"]) result = CliRunner().invoke(cli.cli, [command, "--help"])
output = result.output.replace("Usage: cli ", "Usage: sqlite-utils ") output = result.output.replace("Usage: cli ", "Usage: sqlite-utils ")
output = output.replace('\b', '')
cog.out(textwrap.indent(output, ' ')) cog.out(textwrap.indent(output, ' '))
cog.out("\n\n") cog.out("\n\n")
.. ]]] .. ]]]
@ -603,9 +604,9 @@ See :ref:`cli_convert`.
Convert columns using Python code you supply. For example: Convert columns using Python code you supply. For example:
sqlite-utils convert my.db mytable mycolumn \ sqlite-utils convert my.db mytable mycolumn \
'"\n".join(textwrap.wrap(value, 10))' \ '"\n".join(textwrap.wrap(value, 10))' \
--import=textwrap --import=textwrap
"value" is a variable with the column value to be converted. "value" is a variable with the column value to be converted.
@ -615,30 +616,30 @@ See :ref:`cli_convert`.
r.jsonsplit(value, delimiter=',', type=<class 'str'>) r.jsonsplit(value, delimiter=',', type=<class 'str'>)
Convert a string like a,b,c into a JSON array ["a", "b", "c"] Convert a string like a,b,c into a JSON array ["a", "b", "c"]
r.parsedate(value, dayfirst=False, yearfirst=False, errors=None) r.parsedate(value, dayfirst=False, yearfirst=False, errors=None)
Parse a date and convert it to ISO date format: yyyy-mm-dd Parse a date and convert it to ISO date format: yyyy-mm-dd

- dayfirst=True: treat xx as the day in xx/yy/zz - dayfirst=True: treat xx as the day in xx/yy/zz
- yearfirst=True: treat xx as the year in xx/yy/zz - yearfirst=True: treat xx as the year in xx/yy/zz
- errors=r.IGNORE to ignore values that cannot be parsed - errors=r.IGNORE to ignore values that cannot be parsed
- errors=r.SET_NULL to set values that cannot be parsed to null - errors=r.SET_NULL to set values that cannot be parsed to null
r.parsedatetime(value, dayfirst=False, yearfirst=False, errors=None) r.parsedatetime(value, dayfirst=False, yearfirst=False, errors=None)
Parse a datetime and convert it to ISO datetime format: yyyy-mm-ddTHH:MM:SS Parse a datetime and convert it to ISO datetime format: yyyy-mm-ddTHH:MM:SS

- dayfirst=True: treat xx as the day in xx/yy/zz - dayfirst=True: treat xx as the day in xx/yy/zz
- yearfirst=True: treat xx as the year in xx/yy/zz - yearfirst=True: treat xx as the year in xx/yy/zz
- errors=r.IGNORE to ignore values that cannot be parsed - errors=r.IGNORE to ignore values that cannot be parsed
- errors=r.SET_NULL to set values that cannot be parsed to null - errors=r.SET_NULL to set values that cannot be parsed to null
You can use these recipes like so: You can use these recipes like so:
sqlite-utils convert my.db mytable mycolumn \ sqlite-utils convert my.db mytable mycolumn \
'r.jsonsplit(value, delimiter=":")' 'r.jsonsplit(value, delimiter=":")'
Options: Options:
--import TEXT Python modules to import --import TEXT Python modules to import

View file

@ -2177,7 +2177,7 @@ The ``.has_counts_triggers`` property shows if a table has been configured with
>>> db["authors"].has_counts_triggers >>> db["authors"].has_counts_triggers
True True
.. _python_api_introspection_supports_strict .. _python_api_introspection_supports_strict:
db.supports_strict db.supports_strict
------------------ ------------------

View file

@ -2871,9 +2871,9 @@ def _generate_convert_help():
Convert columns using Python code you supply. For example: Convert columns using Python code you supply. For example:
\b \b
sqlite-utils convert my.db mytable mycolumn \\ sqlite-utils convert my.db mytable mycolumn \\
'"\\n".join(textwrap.wrap(value, 10))' \\ '"\\n".join(textwrap.wrap(value, 10))' \\
--import=textwrap --import=textwrap
"value" is a variable with the column value to be converted. "value" is a variable with the column value to be converted.
@ -2892,7 +2892,7 @@ def _generate_convert_help():
for name in recipe_names: for name in recipe_names:
fn = getattr(recipes, name) fn = getattr(recipes, name)
help += "\n\nr.{}{}\n\n\b{}".format( help += "\n\nr.{}{}\n\n\b{}".format(
name, str(inspect.signature(fn)), fn.__doc__.rstrip() name, str(inspect.signature(fn)), textwrap.dedent(fn.__doc__.rstrip())
) )
help += "\n\n" help += "\n\n"
help += textwrap.dedent( help += textwrap.dedent(
@ -2900,8 +2900,8 @@ def _generate_convert_help():
You can use these recipes like so: You can use these recipes like so:
\b \b
sqlite-utils convert my.db mytable mycolumn \\ sqlite-utils convert my.db mytable mycolumn \\
'r.jsonsplit(value, delimiter=":")' 'r.jsonsplit(value, delimiter=":")'
""" """
).strip() ).strip()
return help return help