diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 478231b..01d58ae 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,6 +4,9 @@ updates: directory: / schedule: interval: monthly + # let a release settle before taking it + cooldown: + default-days: 7 groups: actions: patterns: ["*"] diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 9e3c95f..3a56ca6 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -2,7 +2,7 @@ name: GitHub Pages on: push: - branches: [master] + branches: [main] pull_request: workflow_dispatch: @@ -17,13 +17,16 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 - - uses: prefix-dev/setup-pixi@v0.10.2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: + pixi-version: v0.81.0 environments: docs locked: true + cache: true + cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} - run: pixi run -e docs docs - - uses: actions/upload-pages-artifact@v5 + - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 with: path: docs/_site @@ -39,4 +42,4 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} steps: - id: deployment - uses: actions/deploy-pages@v5 + uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 234e456..17e9449 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,17 +12,17 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - uses: astral-sh/setup-uv@v10.2.0 + - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Check tag matches version run: | version="$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" echo "tag: ${GITHUB_REF_NAME}, pyproject.toml: ${version}" test "${GITHUB_REF_NAME}" = "v${version}" - run: uv build - - uses: actions/upload-artifact@v7 + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: dist path: dist/ @@ -36,11 +36,11 @@ jobs: permissions: id-token: write # trusted publishing and PEP 740 attestations steps: - - uses: actions/download-artifact@v8 + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: dist path: dist/ - - uses: pypa/gh-action-pypi-publish@release/v1 + - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 github-release: needs: publish @@ -48,7 +48,7 @@ jobs: permissions: contents: write steps: - - uses: actions/download-artifact@v8 + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: dist path: dist/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 749bc39..3fae76a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Test on: push: - branches: [master] + branches: [main] pull_request: permissions: @@ -18,26 +18,26 @@ jobs: strategy: fail-fast: false matrix: - # the platforms in [tool.pixi.workspace] in pyproject.toml - os: - - ubuntu-latest # linux-64 - - ubuntu-24.04-arm # linux-aarch64 - - macos-15-intel # osx-64 - - macos-latest # osx-arm64 - - windows-latest # win-64 - # python and pandoc versions increase together, see [tool.pixi.environments] in pyproject.toml - environment: - - test-py310 - - test-py311 - - test-py312 - - test-py313 - - test-py314 + # Every version on linux-64; python and pandoc versions increase together, + # see [tool.pixi.environments] in pyproject.toml + os: [ubuntu-latest] + environment: [test-py310, test-py311, test-py312, test-py313, test-py314] + # and each other platform in [tool.pixi.workspace] once, the oldest + # environment on the oldest platform + include: + - { os: ubuntu-24.04-arm, environment: test-py313 } # linux-aarch64 + - { os: macos-15-intel, environment: test-py310 } # osx-64 + - { os: macos-latest, environment: test-py314 } # osx-arm64 + - { os: windows-latest, environment: test-py314 } # win-64 steps: - - uses: actions/checkout@v7 - - uses: prefix-dev/setup-pixi@v0.10.2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: + pixi-version: v0.81.0 environments: ${{ matrix.environment }} locked: true + cache: true + cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} - name: Sanity check run: | pixi run -e ${{ matrix.environment }} pandoc --version @@ -48,19 +48,22 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 - - uses: prefix-dev/setup-pixi@v0.10.2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: + pixi-version: v0.81.0 environments: lint locked: true + cache: true + cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} - run: pixi run -e lint lint # what the release workflow publishes: build it, and install the wheel build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 - - uses: astral-sh/setup-uv@v10.2.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - run: uv build - run: | uv venv diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..b3cc004 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,12 @@ +# Read the Docs builds the same Quarto site as GitHub Pages (pages.yml), with +# pixi's locked docs environment. build.commands replaces Read the Docs' own +# Sphinx/MkDocs steps: whatever ends up in $READTHEDOCS_OUTPUT/html is served. +version: 2 + +build: + os: ubuntu-24.04 + commands: + - curl -fsSL https://pixi.sh/install.sh | PIXI_HOME="$HOME/.pixi" PIXI_VERSION=v0.81.0 PIXI_NO_PATH_UPDATE=1 bash + - ~/.pixi/bin/pixi run --locked -e docs docs + - mkdir -p "$READTHEDOCS_OUTPUT" + - cp -r docs/_site "$READTHEDOCS_OUTPUT/html" diff --git a/CHANGELOG.md b/CHANGELOG.md index 3721d85..6d27263 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - fix option type checking on Python 3.14, where `typing.Union` is a class - tests use pytest-xdist instead of the unmaintained pytest-parallel - test matrix: Python 3.10–3.14, pandoc 3.7.0.2–3.12, numpy 1.26 and 2; the reference outputs need pandoc 3.7.0.2 or later - - requires Python 3.10 or later, and panflute 2.3 or later 2.x (`panflute>=2.3.1,<3`) + - requires Python 3.10 or later, and panflute 2.3 (`panflute>=2.3.1,<2.4`) - fix `table-width`: columns without a `width` are sized by their content, rather than all equally - fix `pantable2csvx` on a table without a body, and on a table with some column widths default - packaging: PEP 621 metadata built with uv instead of Poetry; the version is single-sourced from `pyproject.toml` diff --git a/LICENSE b/LICENSE index 15ee742..435b216 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2016-2020, Kolen Cheung +Copyright (c) 2016-2026, Kolen Cheung All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index b38945b..3e865ef 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,11 @@ [![Test](https://github.com/ickc/pantable/actions/workflows/test.yml/badge.svg)](https://github.com/ickc/pantable/actions/workflows/test.yml) [![Documentation](https://github.com/ickc/pantable/actions/workflows/pages.yml/badge.svg)](https://ickc.github.io/pantable) +[![Read the Docs](https://readthedocs.org/projects/pantable/badge/?version=latest)](https://pantable.readthedocs.io/en/latest/) [![PyPI](https://img.shields.io/pypi/v/pantable.svg)](https://pypi.org/project/pantable) [![Supported versions](https://img.shields.io/pypi/pyversions/pantable.svg)](https://pypi.org/project/pantable) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/pantable.svg)](https://anaconda.org/conda-forge/pantable) -[![License](https://img.shields.io/pypi/l/pantable.svg)](https://github.com/ickc/pantable/blob/master/LICENSE) +[![License](https://img.shields.io/pypi/l/pantable.svg)](https://github.com/ickc/pantable/blob/main/LICENSE) [![DOI](https://zenodo.org/badge/74008159.svg)](https://zenodo.org/badge/latestdoi/74008159) ## Introduction @@ -62,7 +63,7 @@ conda install -c conda-forge pantable pixi global install pantable ``` -To install the in-development version: `pip install https://github.com/ickc/pantable/archive/master.zip`. +To install the in-development version: `pip install https://github.com/ickc/pantable/archive/main.zip`. ### Supported pandoc versions @@ -70,7 +71,7 @@ pantable reads and writes pandoc's document AST through [panflute](https://githu | pantable | panflute | pandoc | pandoc-types | | -------- | -------- | -------------------- | ------------ | -| 0.15 | 2.3+ | 3.7.0.2–3.12, tested | 1.23 | +| 0.15 | 2.3 | 3.7.0.2–3.12, tested | 1.23 | | 0.14.1-2 | 2.1.3 | 2.11.0.4–2.17.x | 1.22–1.22.1 | | 0.14 | 2.1 | 2.11.0.4–2.14.x | 1.22 | | 0.13 | 2.0 | 2.11.0.4–2.11.x | 1.22 | diff --git a/docs/examples/basics.md b/docs/examples/basics.md index a2dc87b..a37dc91 100644 --- a/docs/examples/basics.md +++ b/docs/examples/basics.md @@ -39,6 +39,15 @@ Mercury,0 Venus,0 ``` +A cell with a comma, a quote or a line break is quoted with double +quotes, and a double quote inside it is doubled: + +```table +Planet,Note +Earth,"Third from the Sun, and has ""Moon"" for a moon" +Mars,"Named after the god of war" +``` + `alignment-cells` aligns cells one by one, a line per row, and again what is left out is default: diff --git a/docs/examples/include.md b/docs/examples/include.md index 87e82c1..516e4c6 100644 --- a/docs/examples/include.md +++ b/docs/examples/include.md @@ -12,6 +12,10 @@ include: fruits.csv --- ``` +The options are read from the YAML block only, as with any other +table, and not from attributes on the code block such as +`{.table include="fruits.csv" caption="..."}`. + `include-encoding` sets the file's encoding when it is not UTF-8. A CSV file saved by Microsoft Excel may need `utf-8-sig`. @@ -28,3 +32,16 @@ Fruit;Price Bananas;1,34 Oranges;2,10 ``` + +Here, for values in single quotes, after a comma and a space: + +```table +--- +csv-kwargs: + quotechar: "'" + skipinitialspace: true +--- +Prefix, City, Comment +'030', 'Berlin', 'My comment' +'069', 'Frankfurt', 'Main, not Oder' +``` diff --git a/docs/library.md b/docs/library.md index 2ef5ad7..f8c1ad7 100644 --- a/docs/library.md +++ b/docs/library.md @@ -6,7 +6,7 @@ title: pantable as a library Documentation here is sparse, partly because the upstream (pandoc) may change the table AST again. See [Crazy ideas: table structure from upstream GitHub](https://github.com/jgm/pandoc-types/issues/86). -The modules are in [`src/pantable/`](https://github.com/ickc/pantable/tree/master/src/pantable). +The modules are in [`src/pantable/`](https://github.com/ickc/pantable/tree/main/src/pantable). For example, looking at the source of `pantable` as a pandoc filter, in `codeblock_to_table.py`, you will see the main function doing the work is now diff --git a/pixi.lock b/pixi.lock index 91af98c..0b98ebe 100644 --- a/pixi.lock +++ b/pixi.lock @@ -9068,7 +9068,7 @@ packages: - pypi: ./ name: pantable requires_dist: - - panflute>=2.3.1,<3 + - panflute>=2.3.1,<2.4 - pyyaml>=5,<7 - numpy>=1.16,<3 - coloredlogs>=14,<16 ; extra == 'extras' diff --git a/pyproject.toml b/pyproject.toml index f3b394b..755c6b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ requires-python = ">=3.10" # Each panflute minor release has tracked a pandoc API bump, # so cap at the latest tested minor release. dependencies = [ - "panflute>=2.3.1,<3", + "panflute>=2.3.1,<2.4", "pyyaml>=5,<7", "numpy>=1.16,<3", ] @@ -67,7 +67,7 @@ pantable2csvx = "pantable.cli.pantable2csvx:main" Homepage = "https://github.com/ickc/pantable" Repository = "https://github.com/ickc/pantable" Documentation = "https://ickc.github.io/pantable" -Changelog = "https://github.com/ickc/pantable/blob/master/CHANGELOG.md" +Changelog = "https://github.com/ickc/pantable/blob/main/CHANGELOG.md" [dependency-groups] test = ["pytest", "pytest-xdist", "coverage>=7.10"]