# RFG: Improve Python API

**URL:** <https://gov.near.org/t/rfg-improve-python-api/236>\
**Category:** Ecosystem\
**Created:** [December 7, 2020, 11:14am UTC](https://gov.near.org/t/rfg-improve-python-api/236 "2020-12-07T11:14:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![illia](https://dub1.discourse-cdn.com/flex005/user_avatar/gov.near.org/illia/32/16_2.png) [@illia](https://gov.near.org/u/illia)\
**Post date:** [December 7, 2020, 11:14am UTC](https://gov.near.org/t/rfg-improve-python-api/236/1 "2020-12-07T11:14:09Z")

</div>

This is a ask Request-For-Grant to clean up Python APIs for NEAR.

We currently don’t have Borsh Python library.  
There is some aspects of it implemented in a very under-developed library - [https://github.com/near/near-api-py](https://github.com/near/near-api-py)  
Also a lot of python scripts that should be using Python API - are not currently - [https://github.com/near/nearcore/tree/master/pytest](https://github.com/near/nearcore/tree/master/pytest)

The goal would be to make this on the level that we have JS:

- borsh-py - Borsh serialization/deserialization library with decorators for classes in Python.
- near-api-py - full featured for backend development, has good test coverage and CI, has basic documentation (added to [docs.near.org](http://docs.near.org)) and is published to PIP.
- [https://github.com/near/nearcore/tree/master/pytest](https://github.com/near/nearcore/tree/master/pytest) refactored to use near-api-py

---

<div class="post-metadata">

**Author:** ![khorolets](https://dub1.discourse-cdn.com/flex005/user_avatar/gov.near.org/khorolets/32/70_2.png) [@khorolets](https://gov.near.org/u/khorolets)\
**Post date:** [December 14, 2020, 8:58am UTC](https://gov.near.org/t/rfg-improve-python-api/236/2 "2020-12-14T08:58:41Z")

</div>

I’ve started to work on this in my spare time. I’ve started from [borsh-py](https://github.com/near/borsh-py). I’ve frozen `borsh` package on PyPi [https://pypi.org/project/borsh/](https://pypi.org/project/borsh/). Anyway I’m going to transfer the ownership of PyPi package to some NEAR account when I finish.

---

<div class="post-metadata">

**Author:** ![LegalizeOnionFutures](https://dub1.discourse-cdn.com/flex005/user_avatar/gov.near.org/legalizeonionfutures/32/4975_2.png) [@LegalizeOnionFutures](https://gov.near.org/u/LegalizeOnionFutures)\
**Post date:** [August 28, 2021, 11:11am UTC](https://gov.near.org/t/rfg-improve-python-api/236/3 "2021-08-28T11:11:54Z")

</div>

Hey, just posting to say I’ve submitted a grant request to make borsh-py happen. I already know how to do it by building on top of the `construct` library, which is the best way to do this in Python, and which I know in great depth.

`borsh-py` will also cover things that are hard to represent in Python, like Rust’s enums (very different from Python enums).

---

<div class="post-metadata">

**Author:** ![circlenaut](https://dub1.discourse-cdn.com/flex005/user_avatar/gov.near.org/circlenaut/32/19332_2.png) [@circlenaut](https://gov.near.org/u/circlenaut)\
**Post date:** [March 8, 2022, 7:23pm UTC](https://gov.near.org/t/rfg-improve-python-api/236/4 "2022-03-08T19:23:53Z")

</div>

I agree, the [near-api-py](https://github.com/near/near-api-py) library could really use some TLC.

Specifically it would be amazing, and some work, to bring it up to par with, for example, Solana’s python libs ([anchorpy](https://github.com/kevinheavey/anchorpy) and [solana-py](https://github.com/michaelhly/solana-py)).

I’m very familiar with these two solana libs and willing to port features over to NEAR. Is this something NEAR would be able to support through a grant?
