Repository navigation
Package css2table as a library with documented API and release workflow - #6
Open
mgroeber9110 wants to merge 6 commits into
Open
mgroeber9110 wants to merge 6 commits into
mgroeber9110 wants to merge 6 commits into
Conversation
- Public API: convert, convert_file, encode, file_loader, StylesheetLoader, DEFAULT_VIEWPORT_WIDTH and __version__, with type hints, docstrings and a py.typed marker. The CLI now uses encode/file_loader. - pyproject.toml: dynamic version, MIT license, classifiers, project URLs, minimum dependency versions; MANIFEST.in so the sdist can run its tests. - docs/api.md (API reference), docs/releasing.md, CHANGELOG.md, LICENSE. - GitHub Actions: CI runs the tests on Python 3.9-3.14 and builds and smoke-tests the wheel; a v* tag builds the release, creates a GitHub Release and optionally publishes to PyPI via trusted publishing. - tests/test_api.py covers the new functions and the command line. Conversion output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1zAu4mG3qrUq7adbFp4Bm
examples/out/ was still produced by the first prototype, before the output size reductions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1zAu4mG3qrUq7adbFp4Bm
Python 3.9 reached end of life in October 2025 and setup-python cannot install it on the current ubuntu-latest image. Also update checkout and setup-python to their Node 24 releases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1zAu4mG3qrUq7adbFp4Bm
Encoding the output is not part of the table conversion. The command line keeps its --encoding option and does the charset replacement itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1zAu4mG3qrUq7adbFp4Bm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1zAu4mG3qrUq7adbFp4Bm
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.
Requested by Marcus · project thread
Summary
Turns the prototype into an installable, reusable Python package and adds GitHub Actions for CI and releases. Conversion output is unchanged (checked on
examples/andtests/pages/againstmain).Public API (
import css2table)convert(html, viewport_width=800, base_url=None, load_stylesheet=None): unchanged signature, now with type hints and a full docstring.convert_file(path, ...): converts a saved page and loads its stylesheets from disk.file_loader(base_dir): moved from__main__tocss2table/api.py(still importable from__main__).StylesheetLoader,DEFAULT_VIEWPORT_WIDTH,__version__;py.typedmarker.--version.Packaging
pyproject.toml: version read fromcss2table.__version__, SPDX license, classifiers, project URLs, minimum dependency versions. Requires Python 3.10+ (3.9 is end of life and no longer available on GitHub's Ubuntu runners).MANIFEST.inso the sdist contains the tests, test pages and tools and can run its own test suite.LICENSE(MIT, confirmed by Marcus; copyright "The css2table authors"),CHANGELOG.md.Docs
docs/api.md: API reference with examples (including a network stylesheet loader for a later proxy).docs/releasing.md: release steps and one-time PyPI setup.GitHub Actions
ci.yml: tests on Python 3.10 to 3.14; builds sdist and wheel, runstwine check --strict, installs the wheel into a clean venv and smoke-tests the CLI.release.ymlonv*tags: checks tag ==__version__, runs tests, builds, creates a GitHub Release with the files and generated notes (pre-release fora/b/rc/devtags).PUBLISH_TO_PYPIistrue. Setup steps are indocs/releasing.md(pending publisher on PyPI, environmentpypi, the variable). The namecss2tableis currently free on PyPI.Also
examples/out/, which was still from the first prototype (before PR Reduce output size: no duplicate CSS, shorter font face lists #3/Omit table attributes that repeat browser defaults #4), and again after mergingmain(PR Keep HTML 4 pages intact and convert a WoltLab forum #5).To do for Marcus
docs/releasing.md.git tag v0.1.0 && git push origin v0.1.0.Noticed, not changed
values.VIEWPORT_WIDTH(used forvw/viunits) is a constant 800 and is never set fromviewport_width, sovwignores--width. Left for a separate fix to keep this PR behavior-neutral.Test plan
python -m pytest: 91 passed, 1 skipped (real test pages not present).python -m build+twine check --strictpass;actionlintclean.https://claude.ai/code/session_01K1zAu4mG3qrUq7adbFp4Bm
Generated by Claude Code