Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ updates:
directory: /
schedule:
interval: monthly
# let a release settle before taking it
cooldown:
default-days: 7
groups:
actions:
patterns: ["*"]
13 changes: 8 additions & 5 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: GitHub Pages

on:
push:
branches: [master]
branches: [main]
pull_request:
workflow_dispatch:

Expand All @@ -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

Expand All @@ -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
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -36,19 +36,19 @@ 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
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: dist
path: dist/
Expand Down
45 changes: 24 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test

on:
push:
branches: [master]
branches: [main]
pull_request:

permissions:
Expand All @@ -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
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -62,15 +63,15 @@ 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

pantable reads and writes pandoc's document AST through [panflute](https://github.com/sergiocorreia/panflute), which follows the AST's version, [pandoc-types](https://hackage.haskell.org/package/pandoc-types):

| 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 |
Expand Down
9 changes: 9 additions & 0 deletions docs/examples/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
17 changes: 17 additions & 0 deletions docs/examples/include.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -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'
```
2 changes: 1 addition & 1 deletion docs/library.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand All @@ -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"]
Expand Down
Loading