lpython icon indicating copy to clipboard operation
lpython copied to clipboard

Which modules to implement from the Python standard library

Open certik opened this issue 3 years ago • 15 comments

The Python standard library has a lot of modules: https://docs.python.org/3/library/index.html, but many of them are rarely used. First we should concentrate on the most commonly used modules, probably:

  • sys
  • os
  • string
  • time
  • datetime
  • cmath
  • decimal
  • numbers
  • fractions
  • statistics
  • glob
  • tempfile
  • itertools
  • functools
  • pickle
  • csv
  • argparse
  • logging
  • platform
  • json
  • pdb
  • ast

Some of these might be initially difficult to implement, but some of these might be doable already.

certik avatar Mar 04 '22 19:03 certik

I can work on implementing statistics.

Smit-create avatar Mar 04 '22 19:03 Smit-create

I can begin with the random module

namannimmo10 avatar Mar 06 '22 10:03 namannimmo10

Should these modules be implemented in C++ or in LPython itself?

Oshanath avatar Mar 14 '22 12:03 Oshanath

All these modules should be in LPython, i.e., the subset of Python that LPython can compile. You can try to implement some simple function and if LPython is missing some feature, you can open up an issue for it.

certik avatar Mar 14 '22 15:03 certik

Basically if I were to implement something from this list, what I should do is refer to the Python documentation of that module and implement those same functions the same way using LPython. Am I correct?

Oshanath avatar Mar 14 '22 18:03 Oshanath

Yes, and add them to src/runtime and add tests to integration_tests and register them in integration_tests/run_tests.py, they will be run via CPython (to ensure the test script is written correctly) as well as LPython (to ensure everything actually compiles).

certik avatar Mar 14 '22 19:03 certik

I think itertools, datetime, sys and os should also be added to the lpython since they are used extensively in scientific computing. i can start the work for sys and os modules.

rajpratyush avatar Mar 22 '22 05:03 rajpratyush

I think itertools, datetime, sys and os should also be added to the lpython since they are used extensively in scientific computing. i can start the work for sys and os modules.

Great. Let us know if you need any help!

namannimmo10 avatar Mar 22 '22 05:03 namannimmo10

sure could you provide me up links to the development guide so that I can set up the project locally. or any kind of documentation website

rajpratyush avatar Mar 22 '22 06:03 rajpratyush

You can find the installation guide in the README.md file. For now, see https://docs.lfortran.org/developer_tutorial/ for more information -- LPython follows the same design as in LFortran.

namannimmo10 avatar Mar 22 '22 06:03 namannimmo10

so it doesn't have a documentation website ?

rajpratyush avatar Mar 22 '22 07:03 rajpratyush

We currently don't have dedicated LPython documentation. We will eventually add it.

certik avatar Mar 24 '22 18:03 certik

how about building one?

rajpratyush avatar Mar 24 '22 19:03 rajpratyush

Yes, we should.

certik avatar Mar 24 '22 20:03 certik

I would like to work for argparse. Can you please help me how to start?

Umesh-JNU avatar Feb 12 '23 16:02 Umesh-JNU