Skip to content

Conversation

@brianatdetections
Copy link

Summary

This PR updates the STIX Pattern Validator to use ANTLR 4.13.x and adds Python 3.13 support.

Changes

  • ANTLR Runtime: Updated antlr4-python3-runtime dependency from ~=4.9.0 to ~=4.13.0
  • Parser Regeneration: Regenerated all 12 parser files across 3 locations with ANTLR 4.13.2
  • Python 3.13: Added to test matrix, classifiers, and GitHub Actions workflow
  • Automation: Added scripts/regenerate_grammars.sh for easy grammar regeneration
  • Documentation: Fixed ANTLR generation docs to use Python3 instead of Python2
  • GitHub Actions: Updated to latest action versions (checkout@v4, setup-python@v5, codecov@v4)
  • Version: Bumped to 2.1.0

Breaking Change Note

The upstream grammar now requires timestamp literals with the t prefix for STARTSTOP qualifiers (e.g., START t'2024-01-01T00:00:00Z' instead of START '2024-01-01T00:00:00Z'). This aligns with the current STIX 2.1 specification. The v20 inspector and tests have been updated accordingly.

Test Plan

  • All 177 existing tests pass
  • Pre-commit hooks pass (flake8, isort, trailing whitespace)
  • Packaging validation passes (twine check)
  • Tested on Python 3.12

Files Changed

Category Files
Grammar (regenerated) 12 files (4 per location × 3 locations)
Configuration setup.py, setup.cfg, tox.ini, MANIFEST.in
CI/CD .github/workflows/python-ci-tests.yml
Documentation docs/conf.py, docs/developers.rst, CHANGELOG.rst
Code stix2patterns/v20/inspector.py
Tests stix2patterns/test/v20/test_inspector.py
New scripts/regenerate_grammars.sh

CLA

I have signed the Individual Contributor License Agreement.


🤖 Generated with Claude Code

@CLAassistant
Copy link

CLAassistant commented Dec 29, 2025

CLA assistant check
All committers have signed the CLA.

@brianatdetections
Copy link
Author

recheck

brianatdetections and others added 2 commits December 29, 2025 13:54
- Update antlr4-python3-runtime dependency from ~=4.9.0 to ~=4.13.0
- Regenerate all parser files with ANTLR 4.13.2 (12 files across 3 locations)
- Add Python 3.13 to test matrix and classifiers
- Add automated grammar regeneration script (scripts/regenerate_grammars.sh)
- Update v20 inspector to use TimestampLiteral (grammar API change)
- Update v20 tests to use timestamp literal syntax (t'...')
- Fix documentation to reference Python3 instead of Python2 for ANTLR
- Update GitHub Actions to latest versions (checkout@v4, setup-python@v5)
- Bump version to 2.1.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@brianatdetections
Copy link
Author

@ejratl @clenk @chisholm @JasonKeirstead @sparrell

Hi maintainers! This PR updates ANTLR to 4.13.2 and adds Python 3.13 support.

Key improvements over the existing PR #96:

  • Newer ANTLR version (4.13.2 vs 4.13.1)
  • Includes automated regeneration script (scripts/regenerate_grammars.sh)
  • Updates ALL grammar directories (including shared stix2patterns/grammars/)
  • Adds Python 3.13 to test matrix and CI
  • Fixes v20 inspector for grammar API changes (TimestampLiteral)
  • Updates GitHub Actions to latest versions (checkout@v4, setup-python@v5)

All 177 tests pass, CLA is signed, and CI is green. Would appreciate a review when you have time. Happy to address any feedback!

@vEpiphyte
Copy link

@brianatdetections Nice work! It would probably be best to include Python 3.14 as a supported target as well; since that would be one more package pulled into support for the modern world. I haven't looked to see about antlr4 version support for 3.14 is; so that could be a issue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants