Fix tag parsing bugs, and bring the project setup up to date - #92
Merged
Merged
Conversation
Three bugs, each with a regression test:
- The tag pattern matched its arguments greedily, so two tags on the same
line became one match that swallowed the text between them and then
failed to parse. Match lazily instead.
- parse_argkwarg() decided arg-versus-kwarg on any '=' in a segment, and
split on every '=' it found. An '=' inside a value raised a SyntaxError,
as in read_csv('a=b.csv') or sep='='. It also tracked brackets and
parentheses but not braces, so a dict argument with more than one key
was split on its comma. Both now use one scanner that knows what is
nested inside quotes, brackets, braces or parentheses.
- convert_to_md_table() escaped the columns of the DataFrame passed in
before copying it, so a macros user rendering the same DataFrame twice
got doubly escaped pipes the second time.
Project setup:
- Deploy the documentation on every push to master. It was deployed by
hand and had fallen behind the readers added in 4.0.0.
- Upload coverage to Codecov again: the step tested env.USING_COVERAGE,
which is set nowhere, so it never ran.
- Move dev dependencies to [dependency-groups], which uv now expects, and
drop the unused codecov package.
- Add .codespellrc, which the codespell workflow already referred to.
- Add the 'enabled' option to schema.json, and a CHANGELOG.md.
- Update the Makefile and CONTRIBUTING.md, which still described
test_requirements.txt, pyflakes and setup.py.
- Link to the hosted docs from the README, where a relative link 404s.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vTNbovqPphizF3v1UdhVW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bugs
Each fix has a regression test.
Two tags on one line crashed the build. The tag pattern matched its arguments greedily, so
{{ read_csv('a.csv') }} and {{ read_csv('b.csv') }}became a single match that swallowed the text between the tags, and then failed to parse withSyntaxError: unmatched ')'.An
=inside an argument value raised aSyntaxError.parse_argkwarg()decided arg-versus-kwarg on any=in a segment, then split on every=. Soread_csv('a=b.csv'),sep='='andna_values=['a=1']all failed. The same scanner tracked brackets and parentheses but not braces, sodtype={'a': 'str', 'b': 'int'}was split on its comma. Both now use one scanner that knows what is nested inside quotes, brackets, braces or parentheses.convert_to_md_table()altered the DataFrame passed in. It escaped the columns in place before copying, so amkdocs-macros-pluginuser rendering the same DataFrame twice saw doubly escaped pipes in the second table.Project setup
master. It was deployed by hand, and the live site had fallen behind the readers added in 4.0.0 —read_parquet,read_orc,read_xml,read_html,read_stata,read_sas,read_spssandread_hdfwere all missing.env.USING_COVERAGE, which is set nowhere in the repository, so it never ran.[dependency-groups], which uv now expects, and drop the unusedcodecovpackage..codespellrc, which the codespell workflow already referred to.enabledoption toschema.json, so editors stop flagging valid configuration.CHANGELOG.md.MakefileandCONTRIBUTING.md, which still describedtests/test_requirements.txt, pyflakes andsetup.py.Version bumped to 4.0.1. Tests: 59 passing, 100% coverage.
🤖 Generated with Claude Code
https://claude.ai/code/session_017vTNbovqPphizF3v1UdhVW