toncenter / ton-http-api

HTTP API for TON (The Open Network)
https://toncenter.com
GNU General Public License v3.0
220 stars 43 forks source link

Create pypi package #1

Closed tvorogme closed 2 years ago

tvorogme commented 2 years ago

There is a problem with the project structure that does not allow making a PyPI package. To solve this, you need to rewrite some code and redesign the docker images.

Why we need PyPi package?

Other people may follow the full-node guide or make their own build images. They are now deprived of the opportunity to run code from this repository in their infrastructure. We want to simplify this way up to two commands: pip install pyton-new pyton-new run

What actually had to be done?

  1. Make a CLI utility that runs unicorn for pyTON / anTon. As example: pyton-new run, pyton-new run analitics
  2. Add the ability to load settings.yaml from the home directory, from the directory in which the user is currently running the script
  3. Add the ability to generate settings.yaml from the CLI following the example of jupyter notebook --generate-config
  4. Make a PyPI package
  5. Rewrite Docker images to use PyPi package as shown in [1] (You can do pip install -e . in docker for example)

Most likely, our team @disintar will be able to implement this, but the discussion about the correctness of the implementation is open.

tvorogme commented 2 years ago

By default, toncenter proxy all requests in nginx through /api/v2/ rewriting address , so if you want to start toncenter locally - don't forget to do something with this

If you see error page like this:

image

Don't panic, just replace base_url in main.py :)

dungeon-master-666 commented 2 years ago

We've added pypi package. Run it by

pip install ton-http-api
ton-http-api