radon-project / radon

The Radon Programming Language
https://radon-project.github.io
GNU General Public License v3.0
21 stars 2 forks source link

Add type annotations to Python codebase #125

Closed angelcaru closed 2 months ago

angelcaru commented 2 months ago

Closes REP-4 (#70)

Should also make the language a lot faster thanks to mypyc, but I haven't tested it yet. Will report on that

angelcaru commented 2 months ago

Should also make the language a lot faster thanks to mypyc, but I haven't tested it yet. Will report on that

UPDATE: mypyc worked, but it didn't make it that much faster in my testing.

Almas-Ali commented 2 months ago

Did you tested make lint?

angelcaru commented 2 months ago

No. Will test

angelcaru commented 2 months ago

Oh no Screenshot mar 30 abr 2024 17:29:17 CEST

angelcaru commented 2 months ago

Also, here is a comparison of the performance of the mypyc-compiled version vs the original: Screenshot mar 30 abr 2024 17:31:18 CEST (old_radon.py is the uncompiled one, main.py is the compiled one. PyPy included for completeness)

Almas-Ali commented 2 months ago

Oh no Screenshot mar 30 abr 2024 17:29:17 CEST

Terrific!!

Almas-Ali commented 2 months ago

In my system pypy3 is way slower than cpython3!

Almas-Ali commented 2 months ago

Added pyright type checking. Use make typecheck to perform this test.

angelcaru commented 2 months ago

Why? Isn't mypy good enough??

Almas-Ali commented 2 months ago

Why? Isn't mypy good enough??

pyright is for strict type checking and mypy for normal type hint checking.

angelcaru commented 2 months ago

I don't think we need strict typechecking right now. And mypy has a --strict flag anyway, so there's no need to introduce a whole other tool into the project

Almas-Ali commented 2 months ago

Are you using any other ruff configs for formating?

angelcaru commented 2 months ago

No, I haven't changed it from the default.

Almas-Ali commented 2 months ago

Functions formatings are changing here.

def some():...
def some():
   .... 
angelcaru commented 2 months ago

Functions formatings are changing here.

def some():...
def some():
   .... 

ruff seems to prefer the top way, at least when there is ...

Almas-Ali commented 2 months ago

In my system it is making like this:

def some():
    .... 

When you are doing it changes to:

def some():...
angelcaru commented 2 months ago

Well, it doesn't really matter that much. This PR is basically blocking all other progress in the project, we need to get it done ASAP

angelcaru commented 2 months ago

In my system it is making like this:

def some():
    .... 

When you are doing it changes to:

def some():...

I think you have some config somewhere. I literally just reinstalled ruff with pip and it still chose the second formatting.

Almas-Ali commented 2 months ago

Can you write a CI for automatic make lint checking?

Almas-Ali commented 2 months ago

Will be easy to write.

angelcaru commented 2 months ago

Probably, but would have to research it. Would be a separate PR

Almas-Ali commented 2 months ago

Probably, but would have to research it. Would be a separate PR

Just a simple yaml script.