Skip to content

test: add Python compiler tests, Windows fixes, and documentation#7

Closed
gotogrub wants to merge 3 commits into
enspirit:mainfrom
gotogrub:test-python-compiler
Closed

test: add Python compiler tests, Windows fixes, and documentation#7
gotogrub wants to merge 3 commits into
enspirit:mainfrom
gotogrub:test-python-compiler

Conversation

@gotogrub
Copy link
Copy Markdown

@gotogrub gotogrub commented Jan 28, 2026

Summary

Adds tests, fixes, and documentation for the Python compiler.

Changes

Tests

  • Add 30 unit tests for Python compiler (test/unit/compilers/python.unit.test.ts)
  • All tests pass: literals, operators, precedence, let expressions, dates

Fixes

  • Fix Windows path handling in fixtures.integration.test.ts
  • Fix Windows CLI invocation in cli.integration.test.ts
  • Make test-python.sh configurable via PYTHON_CMD env variable

Documentation

  • Add PYTHON-COMPILER.md (English)
  • Add PYTHON-COMPILER-RU.md (Russian)
  • Update README.md with Python target info

Test Results

  • Unit tests: 1054/1054 pass
  • Integration tests: 846/846 pass
  • Python fixtures: 44/44 pass

Python support is now fully implemented and tested. Features include:

  • All arithmetic, logical, and comparison operators
  • Let bindings (using walrus operator :=)
  • Lambdas, map/filter/reduce
  • Temporal types (dates, datetimes, ISO8601 durations)
  • Type definitions with schema validation
  • Guards and type selectors
  • Pipe (|>) and alternative (|) operators

44 acceptance tests pass. Requires Python 3.8+ for walrus operator support.

CLI usage:

eloc -e "2 ^ 10" -t python
# => (lambda _: 2 ** 10)

cyberpsychoz and others added 3 commits January 28, 2026 12:40
- Add Python compiler unit tests (30 tests)
- Fix Windows path handling in fixtures test
- Fix Windows CLI invocation in integration tests
- Make test-python.sh configurable via PYTHON_CMD
- Update README with Python documentation
@gotogrub gotogrub closed this Jan 28, 2026
@gotogrub gotogrub changed the title Test python compiler Python Compiler Implementation Jan 28, 2026
@gotogrub gotogrub reopened this Jan 28, 2026
@gotogrub gotogrub changed the title Python Compiler Implementation test: add Python compiler tests, Windows fixes, and documentation Jan 28, 2026
@blambeau
Copy link
Copy Markdown
Contributor

blambeau commented Jan 29, 2026

@cyberpsychoz looks ok at first glance.

Should we add some doc/example showing how to load a python-generated lambda from another Python program?

What's your own use case ?

@blambeau
Copy link
Copy Markdown
Contributor

@cyberpsychoz I've selectively merged your contributions.

I haven't kept the PYTHON-COMPILER files. It seemed a bit redundant with CLAUDE.md/README.md, and if we write them we need to do it for all compilers and maintain a consistent set of languages. I'll think about it.

@blambeau blambeau closed this Jan 31, 2026
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.

2 participants