Skip to content

Commit

Permalink
Upgrade PySimpleGUI, hdwallet and tabulate, fix double-sided printing
Browse files Browse the repository at this point in the history
  • Loading branch information
pjkundert committed Nov 5, 2024
1 parent 3f9ff7c commit f8b329b
Show file tree
Hide file tree
Showing 21 changed files with 344 additions and 3,023 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
# Requires Python3 w/ Type Annotations
python-version: ['3.9', '3.10', '3.11', '3.x']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
Expand Down
70 changes: 25 additions & 45 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ CXFREEZE_EXT ?= win-$(CXFREEZE_ARCH)-$(CXFREEZE_VER)
#SIGNTOOL ?= "/c/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86"
SIGNTOOL ?= "c:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\signtool.exe"

NIX_OPTS ?= --pure

# PY[3] is the target Python interpreter; require 3.11+. Detect if it is named python3 or python.
PY3 ?= $(shell python3 --version >/dev/null 2>&1 && echo python3 || echo python )
PY3_V = $(shell $(PY3) -c "import sys; print('-'.join((next(iter(filter(None,sys.executable.split('/')))),sys.platform,sys.implementation.cache_tag)))" 2>/dev/null )
VERSION = $(shell $(PY3) -c 'exec(open("slip39/version.py").read()); print( __version__ )')
WHEEL = dist/slip39-$(VERSION)-py3-none-any.whl
PLATFORM ?= $(shell $(PY3) -c "import sys; print( sys.platform )" )
ifeq ($(PLATFORM),darwin)
INSTALLER := pkg
Expand All @@ -68,16 +71,15 @@ PY3TEST = $(PY3) -m pytest $(PYTESTOPTS)
# VirtualEnv: Build them in eg. ~/src/python-slip39-1.2.3/
# o Will use the *current* git branch when creating a venv and populating it

VENV_LOCAL ?= ~/src/

GHUB_NAME = python-slip39
GHUB_REPO = [email protected]:pjkundert/$(GHUB_NAME)
GHUB_BRCH = $(shell git rev-parse --abbrev-ref HEAD )
VENV_NAME = $(GHUB_NAME)-$(VERSION)

VENV_DIR = $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/.. )
VENV_NAME = $(GHUB_NAME)-$(VERSION)-$(PY3_V)
VENV = $(VENV_DIR)/$(VENV_NAME)
VENV_OPTS = # --copies # Doesn't help; still references some system libs.


.PHONY: all help test doctest analyze pylint build-check build install upload clean FORCE
.PHONY: all help test doctest analyze pylint build install upload clean FORCE

all: help

Expand Down Expand Up @@ -106,14 +108,6 @@ pylint:
cd .. && pylint slip39 --disable=W,C,R


build-check:
@$(PY3) -m build --version \
|| ( \
echo -e "\n\n!!! Missing Python modules; run:"; \
echo -e "\n\n $(PY3) -m pip install --break-system-packages --user --upgrade pip setuptools wheel build\n"; \
false; \
)

signing-check:
$(SIGNTOOL)

Expand Down Expand Up @@ -209,46 +203,30 @@ perry-kundert: GRANTS="{\"crypto-licensing-server\": {\
# VirtualEnv build, install and activate
#

venv: $(VENV_LOCAL)/$(VENV_NAME)
venv-activate: $(VENV_LOCAL)/$(VENV_NAME)-activate
venv: $(VENV)
@echo; echo "*** Activating $< VirtualEnv for Interactive $(SHELL)"
@bash --init-file $</bin/activate -i

$(VENV_LOCAL)/$(VENV_NAME):
@git diff --quiet || ( \
echo -e "\n\n!!! Git repo branch $(GHUB_BRCH) is dirty; cannot create venv!"; false \
)
$(VENV):
@echo; echo "*** Building $@ VirtualEnv..."
@rm -rf $@ && $(PY3) -m venv $(VENV_OPTS) $@ \
&& cd $@ && git clone $(GHUB_REPO) -b $(GHUB_BRCH) \
&& . ./bin/activate \
&& make -C $(GHUB_NAME) install-tests install

# Activate a given VirtualEnv, and go to its python-slip39 installation
# o Creates a custom venv-activate.sh script in the venv, and uses it start
# start a sub-shell in that venv, with a CWD in the contained python-slip39 installation
$(VENV_LOCAL)/$(VENV_NAME)-activate: $(VENV_LOCAL)/$(VENV_NAME)
@echo; echo "*** Activating $@ VirtualEnv"
@[ -s $</venv-activate.sh ] || ( \
echo "PS1='[\u@\h \W)]\\$$ '"; \
echo "[ ! -r ~/.git-completion.bash ] || source ~/.git-completion.bash"; \
echo "[ ! -r ~/.git-prompt.sh ] || source ~/.git-prompt.sh && PS1='[\u@\h \W\$$(__git_ps1 \" (%s)\")]\\$$ '"; \
echo "source $</bin/activate"; \
echo "cd $</$(GHUB_NAME)"; \
) > $</venv-activate.sh
@bash --init-file $</venv-activate.sh -i


wheel: deps dist/slip39-$(VERSION)-py3-none-any.whl

dist/slip39-$(VERSION)-py3-none-any.whl: build-check FORCE
&& source $@/bin/activate \
&& make install


wheel: deps $(WHEEL)

$(WHEEL): FORCE
$(PY3) -m pip install -r requirements-tests.txt
$(PY3) -m build
@ls -last dist

# Install from wheel, including all optional extra dependencies (except dev)
install: dist/slip39-$(VERSION)-py3-none-any.whl FORCE
$(PY3) -m pip install --break-system-packages --user --force-reinstall $<[all]
install: $(WHEEL) FORCE
$(PY3) -m pip install --force-reinstall $<[all]

install-tests:
$(PY3) -m pip install --upgrade --break-system-packages --user -r requirements-tests.txt
$(PY3) -m pip install --upgrade -r requirements-tests.txt

# Building / Signing / Notarizing and Uploading the macOS or win32 App
# o TODO: no signed and notarized package yet accepted for upload by macOS App Store
Expand Down Expand Up @@ -769,6 +747,8 @@ test-%:
unit-%:
$(PY3TEST) -k $*

nix-%:
nix-shell $(NIX_OPTS) --run "make $*"

#
# Target to allow the printing of 'make' variables, eg:
Expand Down
28 changes: 24 additions & 4 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -2285,13 +2285,33 @@ f"MultiPayoutERC20 Contract & Forwarder Details:\n\n{mp}\n\n"

* Building & Installing

If you =git clone [email protected]:pjkundert/python-slip39.git= and have the source code, you can use
the supplied GNU =make= targets to create a venv Virtual Environment and build then install.

The =python-slip39= project is tested under both homebrew:
: $ brew install [email protected]
and using [[https://www.python.org/downloads/][the official python.org/downloads installer]].

Either of these methods will get you a =python3= executable running version 3.9+, usable for
: $ brew install [email protected]
: $ PY3=python3.12 make venv
: ...
: (python-slip39-13.0.0-usr-darwin-cpython-312) bash-3.2$
and using [[https://www.python.org/downloads/][the official python.org/downloads installer]]. It is also supported under Nix (optionally
prefixed with a =TARGET\=py310= and/or =NIX_OPTS\=""= to avoid --pure and gain access to locally
installed applications like emacs, but using the nix-supplied Python3 interpreter):
: $ make nix-venv
: ...
: *** Activating /Users/perry/src/python-slip39-13.0.0-nix-darwin-cpython-312 VirtualEnv for Interactive /bin/bash
: (python-slip39-13.0.0-nix-darwin-cpython-312) Perrys-MBP:python-slip39 perry$

Either of these methods will get you a =python3= executable running version 3.12+, usable for
running the =slip39= module, and the =slip39.gui= GUI.

To manually create your own venv and install from pypi using the Python 3.9 to 3.12 (+ TK if using
the GUI) you have at hand:
: $ python3.12 -m venv python-slip39-venv
: $ . ./python-slip39-venv/bin/activate
: (python-slip39-venv) [you@yourhost src]$ python3 -m pip install slip39[gui]
: ...
: (python-slip39-venv) [you@yourhost src]$ python3 -m slip39.gui

** The =slip39= Module

To build the wheel and install =slip39= manually:
Expand Down
Binary file modified README.pdf
Binary file not shown.
Loading

0 comments on commit f8b329b

Please sign in to comment.