Skip to content

Commit

Permalink
Test against Python 3.13 pre-release (#619)
Browse files Browse the repository at this point in the history
* Test against Python 3.13 pre-release

* Skip tests for numpy on Python 3.13

Refs #619 (comment)

* Try to avoid Python 3.13 cog differences

* Hide \b characters in cli-reference

* Fixed .rST warning
  • Loading branch information
simonw authored Mar 15, 2024
1 parent 17eb818 commit 5bd7aec
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
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]
os: [ubuntu-latest, macos-latest, windows-latest, macos-14]
# Skip 3.8 and 3.9 on macos-14 - it only has 3.10+
Expand All @@ -19,12 +19,15 @@ jobs:
os: macos-14
- python-version: "3.9"
os: macos-14
- python-version: "3.13"
numpy: 1
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: actions/cache@v4
name: Configure pip caching
with:
Expand Down
37 changes: 19 additions & 18 deletions docs/cli-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ This page lists the ``--help`` for every ``sqlite-utils`` CLI sub-command.
cog.out("::\n\n")
result = CliRunner().invoke(cli.cli, [command, "--help"])
output = result.output.replace("Usage: cli ", "Usage: sqlite-utils ")
output = output.replace('\b', '')
cog.out(textwrap.indent(output, ' '))
cog.out("\n\n")
.. ]]]
Expand Down Expand Up @@ -603,9 +604,9 @@ See :ref:`cli_convert`.

Convert columns using Python code you supply. For example:

sqlite-utils convert my.db mytable mycolumn \
'"\n".join(textwrap.wrap(value, 10))' \
--import=textwrap
sqlite-utils convert my.db mytable mycolumn \
'"\n".join(textwrap.wrap(value, 10))' \
--import=textwrap

"value" is a variable with the column value to be converted.

Expand All @@ -615,30 +616,30 @@ See :ref:`cli_convert`.

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)

Parse a date and convert it to ISO date format: yyyy-mm-dd
- dayfirst=True: treat xx as the day 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.SET_NULL to set values that cannot be parsed to null
Parse a date and convert it to ISO date format: yyyy-mm-dd
- dayfirst=True: treat xx as the day 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.SET_NULL to set values that cannot be parsed to null

r.parsedatetime(value, dayfirst=False, yearfirst=False, errors=None)

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
- yearfirst=True: treat xx as the year in xx/yy/zz
- errors=r.IGNORE to ignore values that cannot be parsed
- errors=r.SET_NULL to set values that cannot be parsed to null
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
- yearfirst=True: treat xx as the year in xx/yy/zz
- errors=r.IGNORE to ignore values that cannot be parsed
- errors=r.SET_NULL to set values that cannot be parsed to null

You can use these recipes like so:

sqlite-utils convert my.db mytable mycolumn \
'r.jsonsplit(value, delimiter=":")'
sqlite-utils convert my.db mytable mycolumn \
'r.jsonsplit(value, delimiter=":")'

Options:
--import TEXT Python modules to import
Expand Down
2 changes: 1 addition & 1 deletion docs/python-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ The ``.has_counts_triggers`` property shows if a table has been configured with
>>> db["authors"].has_counts_triggers
True
.. _python_api_introspection_supports_strict
.. _python_api_introspection_supports_strict:
db.supports_strict
------------------
Expand Down
12 changes: 6 additions & 6 deletions sqlite_utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2871,9 +2871,9 @@ def _generate_convert_help():
Convert columns using Python code you supply. For example:
\b
sqlite-utils convert my.db mytable mycolumn \\
'"\\n".join(textwrap.wrap(value, 10))' \\
--import=textwrap
sqlite-utils convert my.db mytable mycolumn \\
'"\\n".join(textwrap.wrap(value, 10))' \\
--import=textwrap
"value" is a variable with the column value to be converted.
Expand All @@ -2892,16 +2892,16 @@ def _generate_convert_help():
for name in recipe_names:
fn = getattr(recipes, name)
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 += textwrap.dedent(
"""
You can use these recipes like so:
\b
sqlite-utils convert my.db mytable mycolumn \\
'r.jsonsplit(value, delimiter=":")'
sqlite-utils convert my.db mytable mycolumn \\
'r.jsonsplit(value, delimiter=":")'
"""
).strip()
return help
Expand Down

0 comments on commit 5bd7aec

Please sign in to comment.