-
Notifications
You must be signed in to change notification settings - Fork 179
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
Conversation
Converting to draft as some test are randomly failing. Needs to be investigated further |
The reorganization certainly makes sense and would be a step forward, I'm sure.
So if I read that right (but, I'm not sure, as I don't exactly understand it) then it still addresses the thing that was "inspiring" me for a rather janky 4 package structure - wanted people to be able to install (jmbase and jmdaemon) or (all 4), plus conceivably certain other combinations. (I'm looking at how they suggest subpackage distributions:
Can you explain how this would map to our case? Suppose a person wants just |
If Alice wants to install I did reorganize code with the same approach, with Splitting That all considered, optimizing installation process is really about optimizing dependencies installation. Since I also plan at moving all test related files (e.g. |
c87b241
to
9e2dd80
Compare
The above requires additional modification, to expose |
Note that some wallet RPC tests are randomly failing on macos such as in https://github.com/roshii/joinmarket-clientserver/actions/runs/4915645134/jobs/8779059629. It looks due invalid cookie, even though cookie validation logic is not changed. Regardless macos test are definitely running slower. |
I'll try to do some testing now on my own (Linux) environment, and see if anything comes up. |
First report that the following sequence (run on 9e2dd80 ):
is successful, with no errors. |
This is not needed, |
I have seen no errors on Linux either, only on MacOS, in CI |
Rebased on |
I had another occurrence of a Issue seem related to #1057 |
We can also see another occurrence of an issue with Issue is unrelated to this refactoring as it was also noticed with legacy setup.py, see #1479 (comment) |
Needs rebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First test: installed successfully with pip3 install -e ./[test]
. Test suite passes.
A couple things noticed:
- We should update the doc. At least these two INSTALL.md, TESTING.md, but there might be others.
- If I use an older version of
pip
(namely20.3.4
), it complains that asetup.py
is missing.
ERROR: File "setup.py" not found. Directory cannot be installed in editable mode: /joinmarket-clientserver
(A "pyproject.toml" file was found, but editable mode currently requires a setup.py based build.)
Regarding #1484 (comment), I don't have an opinion. The approach taken by this PR seems okay to me.
# editable install is currently always on | ||
# option solely triggers test dependencies installation for now | ||
develop='1' |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
I will address the above. Thanks.
We can see from pypi statistics that pip 20.3.4 represents less than 4% of total download for June 2023 (I tried for a longer time-frame but it breaks breaks my Google Big Query free quota). Out of those 4% about two thirds are for Python < 3.16, therefore incompatible with joinmarket. All in all, we have less than 2% of pip user that could be impacted, a marginal joinmarket user base, which could simply update pip. Unless objections, I will address the above by updating documentation. Thanks. $ pypinfo -pc --month 2023-06 pip version
Served from cache: False
Data processed: 3.94 GiB
Data billed: 3.94 GiB
Estimated cost: $0.02
| version | percent | download_count |
| ------- | ------- | -------------- |
| 23.1.2 | 82.25% | 101,527,150 |
| 21.3.1 | 6.55% | 8,084,168 |
| 20.3.4 | 3.95% | 4,870,960 |
| 23.0.1 | 1.59% | 1,965,136 |
| 22.3.1 | 1.53% | 1,890,467 |
| 21.2.1 | 1.17% | 1,443,021 |
| 22.2.2 | 0.84% | 1,040,282 |
| 23.0 | 0.77% | 956,088 |
| 21.0.1 | 0.67% | 833,090 |
| 23.1 | 0.67% | 831,404 |
| Total | | 123,441,766 |
$ pypinfo -pc --month 2023-06 'pip==20.*' pyversion
Served from cache: False
Data processed: 5.02 GiB
Data billed: 5.02 GiB
Estimated cost: $0.03
| python_version | percent | download_count |
| -------------- | ------- | -------------- |
| 2.7 | 52.86% | 4,394,730 |
| 3.7 | 14.25% | 1,185,002 |
| 3.8 | 11.97% | 995,110 |
| 3.6 | 11.29% | 938,924 |
| 3.5 | 4.17% | 346,687 |
| 3.9 | 3.58% | 297,341 |
| 3.10 | 1.44% | 119,872 |
| 3.11 | 0.39% | 32,629 |
| 3.4 | 0.03% | 2,903 |
| 3.12 | 0.00% | 350 |
| Total | | 8,313,548 | |
Personally, I wouldn't trust those numbers much (although of course they give an idea). But more importantly, what's our minimum supported Whether it's okay or not to flat out drop support for older |
This is important question. If this requires anything newer than 21.3.1 as a minimum, that means we drop Python 3.6 support. Which is ok, but then we could first do that in a separate smaller PR, so that people notice. |
After investigation, it comes down to And since it requires Python 3.7+, If no one disagree, I will update requirements accordingly. |
I did not remember but: |
Merging. From the discussions we've had, there is no disagreement on doing this, but, for sure we need to pay attention to if any small errors crop up from the change. I'll again ping @openoms @nixbitcoin in an effort to alert people who are doing anything with (shell) scripts running Joinmarket. |
Post-merge ACK. Will continue to test, but we likely will not do new release too soon, have time for that. And with this being open in parallel with other PRs, that would add a lot of unnecessary rebase work all the time. |
I am getting the following when I try to build Jams dev environment:
Notice it runs Have not tried building the production image yet, but I suppose, it is the same. I have read https://setuptools.pypa.io/en/latest/userguide/development_mode.html, but still a bit lost. @roshii Can you guide me in the right direction? |
@theborakompanioni Could you try if this change works for you? diff --git a/install.sh b/install.sh
index 16afd2c..b31e878 100755
--- a/install.sh
+++ b/install.sh
@@ -443,8 +443,11 @@ joinmarket_install ()
reqs+=',test'
fi
- if [ "$with_jmvenv" == 1 ]; then pip_command=pip; else pip_command=pip3; fi
- $pip_command install -e ".[${reqs}]" || return 1
+ if [ "$with_jmvenv" == 1 ]; then
+ pip install -e ".[${reqs}]" || return 1
+ else
+ pip3 install ".[${reqs}]" || return 1
+ fi
if [[ ${with_qt} == "1" ]]; then
if [[ -d ~/.local/share/icons ]] && [[ -d ~/.local/share/applications ]]; then |
See #1484 (comment) We may need to adapt install script to ensure proper setuptools version is available. It should work in a fresh venv though. |
@roshi Docker installs doesn't use virtualenv, it's meant to build Docker image for JM. Just also found (forgot about your comment in July) that reason is |
@theborakompanioni Forgot about previous one, try this patch instead: diff --git a/install.sh b/install.sh
index 16afd2c..da68976 100755
--- a/install.sh
+++ b/install.sh
@@ -176,6 +176,12 @@ check_skip_build ()
return 1
}
+upgrade_setuptools ()
+{
+ pip install --upgrade pip
+ pip install --upgrade setuptools
+}
+
venv_setup ()
{
if check_skip_build 'jmvenv'; then
@@ -186,8 +192,7 @@ venv_setup ()
"${python}" -m venv "${jm_source}/jmvenv" || return 1
# shellcheck source=/dev/null
source "${jm_source}/jmvenv/bin/activate" || return 1
- pip install --upgrade pip
- pip install --upgrade setuptools
+ upgrade_setuptools
deactivate
}
@@ -621,6 +626,8 @@ main ()
fi
# shellcheck source=/dev/null
source "${jm_root}/bin/activate"
+ else
+ upgrade_setuptools
fi
if [[ ${build_local_tor} == "1" ]]; then
if ! tor_deps_install; then |
That did the trick with debian Just fyi, on
|
Then this cannot be used longterm, it's new release, we need to support it. This needs some research, but for Jam probably until that my patch could be applied manually for now? |
If there is no other way, then yes. Of course, I would prefer it if it was patched. Is there anything against applying it in master? edit: I don't know how many users make use of |
Not strongly. It's ok if you say so, Jam is the main user of this feature. |
I will open a PR. |
@theborakompanioni setuptools v66 is available from debian packages https://packages.debian.org/bookworm/python3-setuptools Your image may just need an |
I think that is already being done, no? |
This is already done indeed. While I suspected an issue with You can however amend your Dockerfile as follows to address
|
7181512 Upgrade setuptools also with --docker-install (Kristaps Kaupe) Pull request description: This was missed in #1484. ACKs for top commit: roshii: tACK 7181512 Tree-SHA512: 4e7d3fb139558d24992bf78b22b8a191fdbf99de14abc34adfd370b7bd2d3ff8b1ceaf1c6c2ccf1b000107e83c87420e73b4fc1cb1453883502f1e83f137737f
Works perfectly 👌 In the dev env it is okay, but I am a little reluctant with using |
* refactor: consistent use of displayName vs walletFileName * refactor: Settings component from jsx to tsx * refactor: Wallets component from jsx to tsx * refactor: Onboarding component from jsx to tsx * refactor: ScheduleProgress component from jsx to tsx * chore(i18n): consistent use of global.errors.reason_unknown * refactor: CreateWallet component from jsx to tsx * refactor: BitcoinQR from jsx to tsx * refactor: Receive component from jsx to tsx * refactor: Earn component from jsx to tsx * dev(regtest): switch to python:3.11-slim-bookworm as base image see JoinMarket-Org/joinmarket-clientserver#1484 (comment) * chore(dev): do not log error when fetch was aborted
Since you control how the image is built, I see no issue but I also see your point. Installation script could be amended to cope with (e.g.)
It may be difficult with |
joinmarket
namespace distribution package in line with https://packaging.python.org/en/latest/guides/packaging-namespace-packages/pyproject.toml
file for project configuration instead of legacysetup.py
In practice:
src
folder, with their respective test moved totest
folder at project rootreactor
is somehow left unclean by the latter., the former test definitions are therefore moved to a dedicatedunified
folder.jmqtui
to be run upon UI update (not tested)Fixes #1491