Google Summer of Code 2025 Final Report
Student: Swaminath Shiju
Project: Expanding OOP capabilities of LPython for
porting common CPython modules
Organisation: Python Software Foundation
Mentor:
Ondřej Čertík
Weekly Reports:
Link to weekly reports
Abstract
The original goal was to enhance LPython’s object-oriented programming (OOP) capabilities by implementing dunder methods and supporting non-dataclass imports. However, due to significant updates in LPython and its shared backend with LFortran, the project scope was revised during the bonding period in consultation with my mentor.
The revised objective focused on implementing Python-style container
types (lists, sets, dictionaries, and tuples) in LFortran’s frontend
and runtime. This effort improved test coverage for Python-specific
backend components, ensured smoother synchronization with LPython’s
libasr backend, and supported a major synchronization
cycle.
The project spanned frontend syntax, backend code generation, and data structure intrinsics.
Table of Contents
Final Deliverables
- Implemented and stabilized Python-like container types (list, set, dict, tuple) in LFortran’s frontend and runtime.
- Refactored backend to reduce reliance on deprecated mechanisms and prepared for string/struct changes.
- Introduced and iterated on Union types: syntax, access, and ASR refactor.
- Improved C backend behavior (string arguments, dict copy) and enabled robust unsigned integer support.
- Unblocked and synchronized LPython with latest libasr changes; restored integration tests.
Timeline Summary
| Week | Key Achievements |
|---|---|
|
Week 1 |
|
| Week 2 |
|
| Week 3 |
|
| Week 4 |
|
| Week 5 |
|
|
Week 6 |
|
|
Week 7 |
|
|
Week 8 |
|
|
Week 9 |
|
|
Week 10 |
|
|
Week 11 |
|
|
Week 12 |
|
List of Contributions (PRs)
- #7419 List implementation
- #7459 Misc PR towards compiling toml-f
- #7462 Set implementation
- #7529 More List intrinsics
- #7594 Improved syntax
- #7621 Simple dict implementation
- #7643 List intrinsics/tests - 1
- #7660 List intrinsics/tests - 2
- #7671 List intrinsics/tests - 3
- #7684 Parser changes and Tuple,Dict type
- #7698 Parser Shift/Reduce conflict resolution
- #7763 Implemented tests for new syntax
- #7799 Refactored function names
- #7807 Ported tuple tests
- #7813 Ported dict tests
- #7873 Misc fixes for tuple types
- #7896 Implemented support for string key in dict type
- #7898 Optimized list pop
- #7901 Refactored backend for less reliance on typecodes
- #7909 Exposed the Union type to LFortran
- #7912 Refactored backend for less reliance on create_gep
- #7935 Union access implemented
- #7966 Union ASR Refactor
- #8002 LP type - argument handling in C backend
- #8011 C backend dict-copy fix
- #8034 Support unsigned integer in LF
- #8037 Proper handling of string argument in C backend
- #8055 Unsigned int print fix
- #8132 Fixing list regression after string refactor
- #8149 Uint frontent
- #8301 Sync
- #8359 Fix for dict regression
- #2840 Syncing LPython to latest libasr
- #2862 Fixed unsigned integer tests
- #2863 String arguments fix
- #2866 Sync
Current State
-
LPython’s continuous integration (CI) supports approximately 200
tests with the latest
libasrbackend. - Ported all tuple tests and nearly all list, set, and dictionary tests to LFortran. Most tests affected by the backend string refactoring broke. I fixed list tests and all but one dictionary test fixed.
- Adapted the LPython frontend to align with recent backend refactoring efforts.
Future Work
- Complete LPython synchronization to achieve approximately 300 passing tests, integrating LFortran-specific features as tests to prevent backend changes from breaking LPython.
- Implement dunder methods and non-dataclass imports in LPython, aligning with the original project goals.
- Begin porting additional CPython standard library modules to LPython.
- Benchmark performance using Advent of Code 2025 challenges.
Learnings
- Before I started committing to the project I had little to no experience with the LLVM toolchain - but along the course of the project I have picked up a good amount of LLVM fundamentals to begin exploring on my own.
- I've learnt how to use tools like lldb to help debug large complex projects
- I've also learnt how to effectively communicate with other open-source contributors in the community.
- With my college semester starting in the final 3–4 weeks of the program, I developed effective time management skills to balance academic responsibilities and project commitments.
- Git version control, bison, flex, conda, mambda etc
Acknowledgements
Thanks to my mentor Ondřej Čertík, the LFortran/LPython community, and PSF GSoC coordinators for accepting me into this program and providing guidance and reviews throughout the project.