Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the package #50

Open
PiRK opened this issue Dec 10, 2020 · 0 comments
Open

Refactor the package #50

PiRK opened this issue Dec 10, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@PiRK
Copy link
Collaborator

PiRK commented Dec 10, 2020

At some point the ElectronCash package got refactored to make it possible to execute it from a simple script. This may seem like a good idea for development purposes, but it has the side effect of requiring some auto-generated files to be part of the source package: protobuf compiled file, icons.py, libsecp256k1 (.dll or .so)...

I would like to switch back to a package structure where only source files written by humans are part of the repository, and other files are generated only when installing or generating binaries.
It will still be possible to run the program from the development repository, using an intermediate script that builds the necessary files in a temporary build directory and patches the Python path to include the build (see https://github.com/silx-kit/silx/blob/master/bootstrap.py)

This will be a good opportunity to rename the subpackages, and merge them into a single package.

The current structure of the project is a loose bundle of 3 packages and many resource files:

ElectrumABC -- electrum-abc (script)
            |- setup.py
            |- electroncash -- __init__.py .
            |               |- ...
            |
            |- electroncash_gui -- __init__.py
            |                   |- ...
            |
            |- electroncash_plugins -- __init__.py
            |                       |- ...
            |
            |- icons/

Various resources and auto-generated files are placed in various places in that structure and outside (contrib...). The requirements*.txt files are in the contrib directory.

The structure I would like to have:

ElectrumABC -- setup.py
            |- bootstrap.py   (run the script in development mode)
            |- requirements.txt
            |- electrumabc |- __init.__.py 
                           |- __main__.py  (with code previously in the script)
                           |- tests |- __init__.py
                           |        |- ...
                           |
                           |- core -- __init__.py .
                           |       |- ...
                           |
                           |- gui -- __init__.py
                           |      |- ...
                           |
                           |- plugins --__init__.py
                           |          |- ...
                           |- resources -- __init__.py
                                        |- icons/
                                        |- fonts/
                                        |- protobuf/
                                        |- misc/    (servers.json...)

The resources subpackage would replace the current use of the Qt resource system. See https://github.com/silx-kit/silx/blob/master/silx/resources/ for an implementation.

The setup.py file would install the executable script as an entry point: https://chriswarrick.com/blog/2014/09/15/python-apps-the-right-way-entry_points-and-scripts/

This would be a first step to make the entire program installable using a simple pip install electrumabc command. Other steps include providing proper packages for some dependencies (secp256k1) as binary wheels for windows and MacOS.

@PiRK PiRK added the enhancement New feature or request label Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant