electrum-personal-server

Maximally lightweight electrum server for a single user
git clone https://git.parazyd.org/electrum-personal-server
Log | Files | Refs | README

developer-notes.md (2758B)


      1 # Developer notes for Electrum Personal Server
      2 
      3 Please keep lines under 80 characters in length and ideally don't add
      4 any external dependencies to keep this as easy to install as possible.
      5 
      6 The project tries to follow the [python style guide PEP 8](https://www.python.org/dev/peps/pep-0008/).
      7 
      8 ## Naming
      9 
     10 Do not use the acronym EPS. Acronyms are not very user-friendly and are hard to
     11 search for.
     12 
     13 ## Installing in developer mode
     14 
     15 To seamlessly work on the codebase while using `pip`, you need to
     16 install in the `develop`/`editable` mode.  You can do that with:
     17 
     18     $ pip3 install --user -e /path/to/repo
     19 
     20 `/path/to/repo` can also be a relative path, so if you are in the
     21 source directory, just use `.`.  This installs the scripts in the
     22 usual places, but imports the package from the source directory.  This
     23 way, any changes you make are immediately visible.
     24 
     25 ## Maintainable code
     26 
     27 Read the article [How To Write Unmaintainable Code](https://github.com/Droogans/unmaintainable-code/blob/master/README.md) and do the opposite of what it says.
     28 
     29 ## Commits
     30 
     31 Commits should be [atomic](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention) and diffs should be easy to read.
     32 
     33 Commit messages should be verbose by default consisting of a short subject line
     34 (50 chars max), a blank line and detailed explanatory text as separate
     35 paragraph(s), unless the title alone is self-explanatory (like "Corrected typo
     36 in server.py") in which case a single title line is sufficient. Commit messages
     37 should be helpful to people reading your code in the future, so explain the
     38 reasoning for your decisions. Further explanation
     39 [here](https://chris.beams.io/posts/git-commit/).
     40 
     41 ## Testing
     42 
     43 Electrum Personal Server also works on [testnet](https://en.bitcoin.it/wiki/Testnet)
     44 and [regtest](https://bitcoin.org/en/glossary/regression-test-mode). The
     45 Electrum wallet can be started in testnet mode with the command line flag
     46 `--testnet` or `--regtest`.
     47 
     48 pytest is used for automated testing. On Debian-like systems install with
     49 `pip3 install pytest pytest-cov`
     50 
     51 Run the tests with:
     52 
     53     $ PYTHONPATH=.:$PYTHONPATH pytest
     54 
     55 Create the coverage report with:
     56 
     57     $ PYTHONPATH=.:$PYTHONPATH pytest --cov-report=html --cov
     58     $ open htmlcov/index.html
     59 
     60 If you have installed Electrum Personal Server with pip, there is no
     61 need to set `PYTHONPATH`.  You could also run the tests with:
     62 
     63     $ python3 setup.py test
     64 
     65 ## Packaged binary release with pyinstaller
     66 
     67 Pyinstaller is used to create the packaged binary releases. To build run:
     68 
     69     pyinstaller common.spec
     70 
     71 This is best done on a virtual machine with the target OS installed. The
     72 `cert/` directory needs to be copied and for windows its helpful to run
     73 `unix2dos config.ini_sample` to convert the line endings.
     74