Madhav2310's Blog

GSOC Journey Blog Week 3

Madhav2310
Published: 07/01/2022

What did you do this week?

This week I majorly focused on two things. Lpython does not yet support class methods. So I raised an issue about it and explored ways to implement that. A lot of the modules in my priority list highly use methods, for eg. str builtin functions, decimal, etc.

Other than that, I began with statistics & random modules which require functions implementation rather than methods.

What is coming up next?

After discussion with my mentor, we decided it’ll be best to implement method functions right away, only without the llvm and just with cpython. We can include LLVM after support for methods is successfully implemented. I’ll work on current open PRs and look up ways to introduce methods in the back end.

Did you get stuck anywhere?

Until now I’ve been entirely involved with implementing functions using python, but this week I was faced with a roadblock due to some features missing from the back end. So I decided to give it a go myself. I have however not worked with ASTs as of now, so it's a slow process to understand it all. I’ll soon be able to contribute there too surely.

 

View Blog Post

GSOC Journey Blog | Week 2

Madhav2310
Published: 06/24/2022

What did you do this week?

This week I majorly worked on the following 3 Pull Requests:

Implemented multiple datatypes for pow and fabs functions #581

Currently in our codebase classes or templates are not implemented. So we have to overload for multiple datatypes like i64, i32, i16, i8, f64, f32 etc. I learned about testing and writing errors. I also got to know about the whole end to end process form writing the function to writing test files, writing errors and generating reference files.

capitalize and upper functions (String module) #669

String.py is a newly started module I'm working on. I have begun with the capitalize and  upper functions to begin with. will soon write some error files and also add the necessarily needed lower function.

decimal module inititiated #679

Decimal.py is a newly started module I'm working on. After discussion with my mentor @gagandeep, I'll be designing this module differently from the other current modules. We'll be making a class for it and writing method functions instead of separate independent functions. I'n still a lil unsure how to go about it, so I'll study about it and implement accordingly.

What is coming up next?

The upcoming week I'll parallelly work on the decimal.py and the string.py modules while writing some error files as per our TDD system.

Did you get stuck anywhere?

I was facing issues in managing the return types of functions. There are often limited options to go with since a lot of things are yet to be implemented in the backend. The mentors patiently helped me resolve all issues whenever something came up.

View Blog Post

GSOC Journey Blog | Week 1

Madhav2310
Published: 06/18/2022

This week, along with the community bonding period brought a lot of learning for me. I got more aware of the vision behind out project and the details of the Codebase.  Being a total beginner to open-source, I had several doubts here and there, but @Ondrej, @Gagandeep and @Naman were extremely patient and helpful throughout.

This week I majorly focused on writing integration tests and a few functions along-side too.

Commits/PRs:

cbrt and exp2 functions implemented #564

I implemented the cube root function and exp2 (exponentialize function) by taking the CPython repository as reference. I also wrote the tests for the same and studied more about writing tests.

This PR wasn’t merged however and these functions aren’t yet implemented in CPython, only their tests have been written to check for TypeError.

Tests for acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh written

I wrote detailed tests for key values and corner cases for 9 trigonometric functions. However on discussion with @gagandeep we reached the conclusion that we shouldn’t test for individual values, rather a range. 

Essentially:

def test_trig():

   eps: f64 = 1e-12
   assert abs(atan(1.0) - pi/4) < eps

Instead of:

def test_atan():

    assert atan(-1) == -pi/4 , f"assertion error in atan"
    assert atan(0) == 0, f"assertion error in atan"
    assert atan(1) == pi/4, f"assertion error in atan"

Implemented multiple datatypes for pow and fabs functions #581

Currently in our codebase classes or templates are not implemented. So we have to overload for multiple datatypes like i64, i32, i16, i8, f64, f32 etc. Through this I learned how to overload functions.

View Blog Post