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

Migrate to modern packaging and src layout #1484

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -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
24 changes: 11 additions & 13 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,21 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# - name: Cache venv
# id: cache-venv
# uses: actions/cache@v3
# env:
# cache-name: venv
# with:
# path: jmvenv
# key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('requirements/*.txt', 'install.sh', '*/setup.py') }}
- name: Cache venv
id: cache-venv
uses: actions/cache@v3
env:
cache-name: venv
with:
path: jmvenv
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('requirements/*.txt', 'install.sh', '*/setup.py') }}
- name: Setup joinmarket + virtualenv
# if: steps.cache-venv.outputs.cache-hit != 'true'
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
sed -i.bak 's/-e //g' requirements/base.txt
sed -i.bak 's/-e //g' requirements/gui.txt
./install.sh --develop --with-qt
./jmvenv/bin/pip install -r requirements/testing.txt
./jmvenv/bin/python -m pip install --upgrade pip
- name: Lint with flake8
run: ./jmvenv/bin/flake8 -v jmclient jmbase jmbitcoin jmdaemon scripts
run: ./jmvenv/bin/flake8 -v src
- name: Cache bitcoind
uses: actions/cache@v3
env:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ If binaries are built, they will be gpg signed and announced on the Releases pag
If you haven't chosen the Qt option during installation with `install.sh`, then to run the script `joinmarket-qt.py` from the command line you will need to install two more packages. Use these 2 commands while the `jmvenv` virtual environment is activated:

```
pip install -r requirements/gui.txt
pip install .[gui]
```
After this, the command `python joinmarket-qt.py` from within the `scripts` subdirectory should work.
There is a [walkthrough](docs/JOINMARKET-QT-GUIDE.md) for what to do next.
Expand Down
9 changes: 4 additions & 5 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Then build and install a local copy of libsecp256k1 for python-bitcointx:

> *NOTE*: It is very important to have activated the virtual environment before running this step. Otherwise, `pip install` will fail, you may be tempted to re-run it with `sudo pip install` which will cause problems in the future.
pip install -r requirements/base.txt
pip install .[services]

If you have installed this "full" version of the client, you can use it with the command line scripts as explained in the [usage guide](USAGE.md).

Expand Down Expand Up @@ -122,7 +122,7 @@ If you have installed this "full" version of the client, you can use it with the
7) Setup joinmarket-qt
```
pip install -r requirements/gui.txt
pip install .[gui]
```
8) Start joinmarket-qt
```
Expand Down Expand Up @@ -165,10 +165,9 @@ Unzip the `joinmarket-clientserver-x.x.x` (where `x.x.x` is the release number)
Using the command prompt in Administrator mode, go to that directory and run the commands:
`pip install -r requirements\base.txt`
`pip install -r requirements\gui.txt`
`pip install joinmarket[services]`
(the latter is needed for Joinmarket-Qt).
(replace `services` with `gui` for Joinmarket-Qt).
The final step is to manually add the libsodium dependency, as mentioned. Do the following:
Expand Down
2 changes: 1 addition & 1 deletion docs/JSON-RPC-API-using-jmwalletd.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ On initially creating, unlocking or recovering a wallet, a new access and refres

Tokens are signed with HS256 (HMAC with SHA-256), a symmetric keyed hashing algorithm that uses one secret key. Signature keys (differentiated between access and refresh tokens) are generated from random bytes upon the following events, implying that any previously issued token is invalidated.

- starting Joinmarket wallet deamon
- starting Joinmarket wallet daemon
- creating, unlocking or recovering a wallet if RPC API is already serving another wallet
- locking wallet

Expand Down
2 changes: 1 addition & 1 deletion docs/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Work in your `jmvenv` virtual environment as for all Joinmarket work. Make sure

Install the test requirements:

(jmvenv)$ pip install -r requirements/testing.txt
(jmvenv)$ pip install .[test]

#### Running the test suite.

Expand Down
17 changes: 10 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,17 @@ CookieAuthentication 1

joinmarket_install ()
{
reqs=( 'base.txt' )
reqs='services'

if [[ ${with_qt} == "1" ]]; then
reqs+=( 'gui.txt' )
reqs='gui'
fi
if [[ ${develop} == "1" ]]; then
reqs+=',test'
fi

for req in "${reqs[@]}"; do
if [ "$with_jmvenv" == 1 ]; then pip_command=pip; else pip_command=pip3; fi
$pip_command install -r "requirements/${req}" || return 1
done
if [ "$with_jmvenv" == 1 ]; then pip_command=pip; else pip_command=pip3; fi
$pip_command install -e ".[${reqs}]" || return 1

if [[ ${with_qt} == "1" ]]; then
if [[ -d ~/.local/share/icons ]] && [[ -d ~/.local/share/applications ]]; then
Expand All @@ -462,7 +463,9 @@ parse_flags ()
while :; do
case $1 in
--develop)
# no-op for backwards compatibility
# editable install is currently always on
# option solely triggers test dependencies installation for now
develop='1'
Comment on lines +466 to +468
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand correctly that this means we install test dependencies by default for all users?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test dependencies are only installed with develop flag.
editable installation is always enabled, as per previous behavior.

;;
--disable-os-deps-check)
use_os_deps_check='0'
Expand Down
16 changes: 0 additions & 16 deletions jmbase/setup.py

This file was deleted.

14 changes: 0 additions & 14 deletions jmbitcoin/setup.py

This file was deleted.

17 changes: 0 additions & 17 deletions jmclient/setup.py

This file was deleted.

17 changes: 0 additions & 17 deletions jmdaemon/setup.py

This file was deleted.

19 changes: 0 additions & 19 deletions jmqtui/setup.py

This file was deleted.

81 changes: 81 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [
AdamISZ marked this conversation as resolved.
Show resolved Hide resolved
"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"]
4 changes: 0 additions & 4 deletions requirements/base.txt

This file was deleted.

9 changes: 0 additions & 9 deletions requirements/gui.txt

This file was deleted.

11 changes: 0 additions & 11 deletions requirements/testing.txt

This file was deleted.

5 changes: 1 addition & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# content of pytest.ini
[tool:pytest]
testpaths = jmbitcoin jmclient jmbase jmdaemon test

[flake8]
exclude =
# defaults
.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,
# lots of "unused imports"
__init__.py
jmqtui

max-line-length = 79

Expand Down
Loading