Repository navigation
docs: add online validator for versions, requirements, and specifiers - #1434
Open
Topgearfanboy wants to merge 9 commits into
Open
Topgearfanboy wants to merge 9 commits into
Topgearfanboy wants to merge 9 commits into
Conversation
This addresses issue pypa#670 by providing a Pyodide-based online validator that allows users to check and validate requirements and versions in their browser without installing the packaging library. Changes: - Add web_validator/ directory with index.html that uses Pyodide to run packaging library in the browser - Add docs/validator.rst with comprehensive documentation for the online validator - Update README.rst to mention the online validator - Update docs/index.rst to include the validator documentation and link - Update .github/workflows/docs.yml to deploy the validator to GitHub Pages The validator provides three main tools: - Version Validator: Parse and validate version strings per PEP 440 - Requirement Validator: Validate requirement strings and extract components - Specifier Validator: Test version specifiers and check version matches This helps users affected by the removal of LegacyVersion (issue pypa#631) by providing an easy way to test versions and requirements without installing the library.
Contributor
|
Interesting! I'd suggest moving this into the docs, though. No need to have a separate page build just for this page when it's a static page that could be on readthedocs. The pyodide version is also old. We can save on download size by removing micropip, that also lets us use the current version easily. I did check WASI for this, and it would be a lot more work and a 2x bigger download (extra stdlib). Micropython doesn't include (at least) I've got this set up locally, can push in a minute. |
Serve the validator as a page in the Sphinx docs instead of a separate GitHub Pages site. The docs build zips the packaging source, so each docs version runs its own code in Pyodide, without micropip or PyPI. Pyodide loads on first use. Pass input as function arguments to prevent code injection, and render results as text. Assisted-by: ClaudeCode:claude-opus-5-5
Run the Pyodide and source downloads in parallel, release PyProxy objects, and simplify the zip build, CSS, and ruff ignores. Assisted-by: ClaudeCode:claude-opus-5-5
Move Pyodide into a module worker so that its startup does not block the page. The page sends checks to the worker as messages, and starts a new worker if loading fails. Assisted-by: ClaudeCode:claude-opus-5-5
Route all checks through one Python dispatcher, collapse the worker lifecycle onto a single ready promise, and style results with furo admonition classes. Assisted-by: ClaudeCode:claude-fable-5-1
Add a status indicator, form cards, clickable examples, and result cards with a valid/invalid header and the normalized value. Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Contributor
|
I also used a web worker and adjusted the style a bit. You can see the result at https://packaging--1434.org.readthedocs.build/en/1434/validator.html |
This branch has not been deployed
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.
Summary
This PR addresses issue #670 by adding a Pyodide-based online validator that allows users to check and validate requirements and versions in their browser without installing the packaging library.
Changes
Features
The online validator provides three main tools:
Use Cases
This is particularly useful for:
Technical Details
Test Plan