Browse Source
c8eef50e93 Migrate to modern packaging and src layout (roshii)
Pull request description:
- Migrate to src-layout following https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#src-layout to facilitate automatic package discovery and editable installs.
- Create `joinmarket` namespace distribution package in line with https://packaging.python.org/en/latest/guides/packaging-namespace-packages/
- Migrate to `pyproject.toml` file for project configuration instead of legacy `setup.py`
In practice:
- Joinmarket packages are moved to `src` folder, with their respective test moved to `test` folder at project root
- Optional dependencies definitions groups allows a granular installation depending on user needs
- Integrated test cannot be run prior to subpackages' respective test, `reactor` is somehow left unclean by the latter., the former test definitions are therefore moved to a dedicated `unified` folder.
- A private module is created in `jmqtui` to be run upon UI update (not tested)
Fixes https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/1491
Top commit has no ACKs.
Tree-SHA512: f88c4f58c114700a68cbc451fa37ad53e9e2e07b837c20ac4d83a73e6803a28a4a38ec68320932ba309a72107d6747f37465f9898a9cdf0e2f210aa067146e1b
master
144 changed files with 121 additions and 212 deletions
@ -1,15 +1,4 @@
|
||||
# .coveragerc to control coverage.py |
||||
[run] |
||||
omit = |
||||
jmclient/jmclient/jsonrpc.py |
||||
jmclient/jmclient/electruminterface.py |
||||
jmclient/jmclient/btc.py |
||||
jmclient/test/* |
||||
jmclient/setup.py |
||||
jmbitcoin/test/* |
||||
jmbitcoin/setup.py |
||||
jmbase/test/* |
||||
jmbase/setup.py |
||||
jmdaemon/test/* |
||||
jmdaemon/setup.py |
||||
jmdaemon/jmdaemon/socks.py |
||||
src/jmclient/jsonrpc.py |
||||
@ -1,16 +0,0 @@
|
||||
from setuptools import setup |
||||
|
||||
|
||||
setup(name='joinmarketbase', |
||||
version='0.9.11dev', |
||||
description='Joinmarket client library for Bitcoin coinjoins', |
||||
url='https://github.com/JoinMarket-Org/joinmarket-clientserver/tree/master/jmbase', |
||||
author='', |
||||
author_email='', |
||||
license='GPL', |
||||
packages=['jmbase'], |
||||
install_requires=['twisted==22.4.0', 'service-identity==21.1.0', |
||||
'chromalog==1.0.5', 'pyaes==1.6.1', |
||||
'txtorcon==22.0.0'], |
||||
python_requires='>=3.7', |
||||
zip_safe=False) |
||||
@ -1,14 +0,0 @@
|
||||
from setuptools import setup |
||||
|
||||
|
||||
setup(name='joinmarketbitcoin', |
||||
version='0.9.11dev', |
||||
description='Joinmarket client library for Bitcoin coinjoins', |
||||
url='https://github.com/JoinMarket-Org/joinmarket-clientserver/tree/master/jmbitcoin', |
||||
author='', |
||||
author_email='', |
||||
license='GPL', |
||||
packages=['jmbitcoin'], |
||||
python_requires='>=3.7', |
||||
install_requires=['python-bitcointx==1.1.3'], |
||||
zip_safe=False) |
||||
@ -1,17 +0,0 @@
|
||||
from setuptools import setup |
||||
|
||||
|
||||
setup(name='joinmarketclient', |
||||
version='0.9.11dev', |
||||
description='Joinmarket client library for Bitcoin coinjoins', |
||||
url='https://github.com/JoinMarket-Org/joinmarket-clientserver/tree/master/jmclient', |
||||
author='', |
||||
author_email='', |
||||
license='GPL', |
||||
packages=['jmclient'], |
||||
install_requires=['joinmarketbase==0.9.11dev', 'mnemonic==0.20', |
||||
'argon2_cffi==21.3.0', 'bencoder.pyx==3.0.1', |
||||
'klein==20.6.0', 'pyjwt==2.4.0', |
||||
'autobahn==20.12.3', 'werkzeug==2.2.3'], |
||||
python_requires='>=3.7', |
||||
zip_safe=False) |
||||
@ -1,17 +0,0 @@
|
||||
from setuptools import setup |
||||
|
||||
|
||||
setup(name='joinmarketdaemon', |
||||
version='0.9.11dev', |
||||
description='Joinmarket client library for Bitcoin coinjoins', |
||||
url='https://github.com/JoinMarket-Org/joinmarket-clientserver/tree/master/jmdaemon', |
||||
author='', |
||||
author_email='', |
||||
license='GPL', |
||||
packages=['jmdaemon'], |
||||
install_requires=['cryptography==3.3.2; platform_machine != "aarch64" and platform_machine != "amd64" and platform_machine != "x86_64"', |
||||
'cryptography==41.0.2; platform_machine == "aarch64" or platform_machine == "amd64" or platform_machine == "x86_64"', |
||||
'pyopenssl==23.2.0', 'libnacl==1.8.0', |
||||
'joinmarketbase==0.9.11dev'], |
||||
python_requires='>=3.7', |
||||
zip_safe=False) |
||||
@ -1,19 +0,0 @@
|
||||
from setuptools import setup |
||||
|
||||
setup(name='joinmarketui', |
||||
version='0.9.11dev', |
||||
description='Joinmarket client library for Bitcoin coinjoins', |
||||
url='https://github.com/JoinMarket-Org/joinmarket-clientserver/tree/master/jmqtui', |
||||
author='', |
||||
author_email='', |
||||
license='GPL', |
||||
packages=['jmqtui'], |
||||
install_requires=['PyQt5!=5.15.0,!=5.15.1,!=5.15.2,!=6.0'], |
||||
python_requires='>=3.7', |
||||
zip_safe=False) |
||||
|
||||
# The following command should be executed whenever `open_wallet_dialog.ui` is updated. |
||||
# We have commented out this command so that we wouldn't require every user of JoinMarket-qt |
||||
# to install the correct version of pyside2-uic. |
||||
#import os |
||||
#os.system('pyside2-uic jmqtui/open_wallet_dialog.ui -o jmqtui/open_wallet_dialog.py') |
||||
@ -0,0 +1,81 @@
|
||||
[build-system] |
||||
requires = ["setuptools>=64", "wheel"] |
||||
build-backend = "setuptools.build_meta" |
||||
|
||||
[project] |
||||
name = "joinmarket" |
||||
version = "0.9.11dev" |
||||
description = "Joinmarket client library for Bitcoin coinjoins" |
||||
readme = "README.md" |
||||
requires-python = ">=3.7" |
||||
license = {file = "LICENSE"} |
||||
dependencies = [ |
||||
"chromalog==1.0.5", |
||||
"pyaes==1.6.1", |
||||
"service-identity==21.1.0", |
||||
"txtorcon==22.0.0", |
||||
"twisted==22.4.0", |
||||
] |
||||
|
||||
[project.optional-dependencies] |
||||
jmbitcoin = [ |
||||
"python-bitcointx==1.1.3", |
||||
] |
||||
jmclient = [ |
||||
"argon2_cffi==21.3.0", |
||||
"autobahn==20.12.3", |
||||
"bencoder.pyx==3.0.1", |
||||
"klein==20.6.0", |
||||
"mnemonic==0.20", |
||||
"pyjwt==2.4.0", |
||||
"werkzeug==2.2.3", |
||||
] |
||||
jmdaemon = [ |
||||
"libnacl==1.8.0", |
||||
"pyopenssl==23.2.0", |
||||
'cryptography==3.3.2; platform_machine != "aarch64" and platform_machine != "amd64" and platform_machine != "x86_64"', |
||||
'cryptography==41.0.2; platform_machine == "aarch64" or platform_machine == "amd64" or platform_machine == "x86_64"', |
||||
] |
||||
jmqtui = [ |
||||
"PyQt5!=5.15.0,!=5.15.1,!=5.15.2,!=6.0", |
||||
"PySide2!=5.15.0,!=5.15.1,!=5.15.2,!=6.0", # https://bugreports.qt.io/browse/QTBUG-88688 |
||||
"qrcode[pil]==7.3.1", |
||||
'pywin32; platform_system == "Windows"', |
||||
"qt5reactor==0.6.3", |
||||
] |
||||
client = [ |
||||
"joinmarket[jmclient]", |
||||
"joinmarket[jmbitcoin]", |
||||
] |
||||
daemon = [ |
||||
"joinmarket[jmdaemon]", |
||||
] |
||||
services = [ |
||||
"joinmarket[client]", |
||||
"joinmarket[daemon]", |
||||
] |
||||
test = [ |
||||
"joinmarket[services]", |
||||
"coverage==5.2.1", |
||||
"flake8", |
||||
"freezegun", |
||||
"mock", |
||||
"pexpect", |
||||
"pytest-cov>=2.4.0,<2.6", |
||||
"pytest==6.2.5", |
||||
"python-coveralls", |
||||
] |
||||
gui = [ |
||||
"joinmarket[services]", |
||||
"joinmarket[jmqtui]", |
||||
] |
||||
|
||||
[project.urls] |
||||
repository = "https://github.com/JoinMarket-Org/joinmarket-clientserver.git" |
||||
|
||||
[tool.setuptools.packages.find] |
||||
where = ["src"] |
||||
exclude = ["*.test"] |
||||
|
||||
[tool.pytest.ini_options] |
||||
testpaths = ["test"] |
||||
@ -1,4 +0,0 @@
|
||||
-e ./jmbase |
||||
-e ./jmbitcoin |
||||
-e ./jmclient |
||||
-e ./jmdaemon |
||||
@ -1,9 +0,0 @@
|
||||
-r base.txt |
||||
pywin32; platform_system == "Windows" |
||||
# https://bugreports.qt.io/browse/QTBUG-88688 |
||||
PySide2!=5.15.0,!=5.15.1,!=5.15.2,!=6.0 |
||||
PyQt5!=5.15.0,!=5.15.1,!=5.15.2,!=6.0 |
||||
qrcode[pil]==7.3.1 |
||||
https://github.com/sunu/qt5reactor/archive/58410aaead2185e9917ae9cac9c50fe7b70e4a60.zip#egg=qt5reactor |
||||
|
||||
-e ./jmqtui |
||||
@ -1,11 +0,0 @@
|
||||
-r base.txt |
||||
# matplotlib |
||||
# numpy |
||||
pexpect |
||||
coverage==5.2.1 |
||||
pytest==6.2.5 |
||||
pytest-cov>=2.4.0,<2.6 |
||||
python-coveralls |
||||
mock |
||||
flake8 |
||||
freezegun |
||||
@ -1,57 +0,0 @@
|
||||
#!/usr/bin/env python |
||||
import sys, os, subprocess |
||||
|
||||
"""A script to install in one of 3 modes: |
||||
(a) daemon - installs jmbase, jmdaemon |
||||
(b) client-only - installs jmbase, jmclient |
||||
(c) client-bitcoin - installs jmbase, jmclient, jmbitcoin |
||||
(d) all - installs jmbase, jmclient, jmbitcoin, jmdaemon |
||||
(e) develop - installs jmbase, jmclient, jmbitcoin, jmdaemon linked to the source directoy |
||||
|
||||
Note that b and c are distinct mainly due to the fact that |
||||
the latter requires the secp256k1 (libsecp256k1 via the secp256k1-py binding), |
||||
which is something that would be an annoyance if you don't need it (wallets). |
||||
While only (a) has a similarly annoying dependency on libnacl as the binding |
||||
to libsodium. |
||||
All modes require and install twisted. |
||||
""" |
||||
|
||||
if sys.version_info < (3, 7): |
||||
raise RuntimeError("This package requres Python 3.7+") |
||||
|
||||
def help(): |
||||
print("Usage: python setupall.py <mode>\n" |
||||
"Mode is one of:\n" |
||||
"`--all` - for the full joinmarket package with secp256k1\n" |
||||
"`--daemon` - for joinmarketd\n" |
||||
"`--client-only` - for client not using joinmarket's own bitcoin code\n" |
||||
"`--client-bitcoin` - using joinmarket bitcoin code, installs secp256k1\n" |
||||
"`--develop` - uses the local code for all packages (does not install to site-packages)." |
||||
) |
||||
sys.exit(2) |
||||
|
||||
if len(sys.argv) != 2: |
||||
help() |
||||
|
||||
curdir = os.getcwd() |
||||
|
||||
mode = sys.argv[1] |
||||
|
||||
packages = {"--all": ["jmbase", "jmbitcoin", "jmclient", "jmdaemon"], |
||||
"--daemon": ["jmbase", "jmdaemon"], |
||||
"--client-only": ["jmbase", "jmclient"], |
||||
"--client-bitcoin": ["jmbase", "jmbitcoin", "jmclient"], |
||||
"--develop": ["jmbase", "jmbitcoin", "jmclient", "jmdaemon"]} |
||||
if mode not in packages: |
||||
help() |
||||
|
||||
for x in packages[mode]: |
||||
dirtorun = os.path.join(curdir, x) |
||||
|
||||
cmd = ['pip', 'install', '--upgrade'] |
||||
if mode == "--develop": |
||||
cmd.append('-e') |
||||
cmd.append('.') |
||||
|
||||
p = subprocess.Popen(cmd, cwd=dirtorun) |
||||
p.wait() |
||||
@ -0,0 +1,7 @@
|
||||
import os |
||||
|
||||
# The following command should be executed whenever `open_wallet_dialog.ui` is updated. |
||||
# `gui-dev` dependencies must be installed prior to execution. |
||||
|
||||
def compile_ui(): |
||||
os.system('pyside2-uic jmqtui/open_wallet_dialog.ui -o jmqtui/open_wallet_dialog.py') |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue