Skip to content

Commit 0840b13

Browse files
committed
Update requirements, packaging
1 parent 9aa992b commit 0840b13

14 files changed

+159
-45
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ __pycache__/
2020

2121
# py.test stuff
2222
.pytest_cache/
23+
*~
24+
.#*

GNUmakefile

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
SHELL = /bin/bash
22
PY3 ?= $(shell python3 --version >/dev/null 2>&1 && echo python3 || echo python )
3-
VERSION = $(shell $(PY3) -c 'from hdwallet import __version__; print( __version__.strip("v"))')
3+
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 )
4+
VERSION = $(shell $(PY3) -c 'exec(open("hdwallet/version.py", "r").read()); print( __version__.strip("v"))')
45
WHEEL = dist/hdwallet-$(VERSION)-py3-none-any.whl
56

67
PY3TEST = $(PY3) -m pytest
78

9+
GHUB_NAME = python-hdwallet
10+
VENV_DIR = $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/.. )
11+
VENV_NAME = $(GHUB_NAME)-$(VERSION)-$(PY3_V)
12+
VENV = $(VENV_DIR)/$(VENV_NAME)
13+
VENV_OPTS =
14+
815
.PHONY: all test build build-check wheel install-dev install clean FORCE
916

1017
all: build
@@ -19,28 +26,30 @@ test-%:
1926
unit-%:
2027
$(PY3TEST) -k $*
2128

22-
build: clean wheel
29+
nix-%:
30+
nix-shell --pure --run "make $*"
2331

24-
build-check:
25-
@$(PY3) -m build --version \
26-
|| ( \
27-
echo -e "\n\n!!! Missing Python modules; run:"; \
28-
echo -e "\n\n $(PY3) -m pip install --upgrade pip setuptools wheel build\n"; \
29-
false; \
30-
)
32+
build: clean wheel
3133

3234
wheel: $(WHEEL)
3335

34-
$(WHEEL): build-check FORCE
36+
$(WHEEL): FORCE
37+
$(PY3) -m pip install -r requirements-dev.txt
3538
$(PY3) -m build
3639
@ls -last dist
3740

38-
# Install from wheel, including all optional extra dependencies (except dev)
39-
install-dev: $(WHEEL) FORCE
40-
$(PY3) -m pip install --upgrade $<[tests]
41-
4241
install: $(WHEEL) FORCE
43-
$(PY3) -m pip install --force-reinstall $<[cli,docs]
42+
$(PY3) -m pip install --force-reinstall .[cli,docs]
4443

4544
clean:
4645
@rm -rf build dist *.egg-info $(shell find . -name '__pycache__' )
46+
47+
venv: $(VENV)
48+
@echo; echo "*** Activating $< VirtualEnv for Interactive $(SHELL)"
49+
@bash --init-file $</bin/activate -i
50+
51+
$(VENV):
52+
@echo; echo "*** Building $@ VirtualEnv..."
53+
@rm -rf $@ && $(PY3) -m venv $(VENV_OPTS) $@ \
54+
&& source $@/bin/activate \
55+
&& make install

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
include LICENSE
22
include README.md
3-
include requirements.txt
3+
include requirements*.txt
44

5+
global-exclude *~
56
recursive-exclude * __pycache__
67
recursive-exclude * *.py[co]

default.nix

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{ pkgs ? import ./nixpkgs.nix {} }:
2+
3+
with pkgs;
4+
5+
let
6+
in
7+
{
8+
py313 = stdenv.mkDerivation rec {
9+
name = "python313-with-pytest";
10+
11+
buildInputs = [
12+
git
13+
openssh
14+
python313
15+
python313Packages.pytest
16+
];
17+
};
18+
19+
py312 = stdenv.mkDerivation rec {
20+
name = "python312-with-pytest";
21+
22+
buildInputs = [
23+
git
24+
openssh
25+
python312
26+
python312Packages.pytest
27+
];
28+
};
29+
30+
py311 = stdenv.mkDerivation rec {
31+
name = "python311-with-pytest";
32+
33+
buildInputs = [
34+
git
35+
openssh
36+
python311
37+
python311Packages.pytest
38+
];
39+
};
40+
41+
py310 = stdenv.mkDerivation rec {
42+
name = "python310-with-pytest";
43+
44+
buildInputs = [
45+
git
46+
openssh
47+
python310
48+
python310Packages.pytest
49+
];
50+
};
51+
52+
py39 = stdenv.mkDerivation rec {
53+
name = "python39-with-pytest";
54+
55+
buildInputs = [
56+
git
57+
openssh
58+
python39
59+
python39Packages.pytest
60+
];
61+
};
62+
}

hdwallet/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
)
1111

1212
# HDWallet Information's
13-
__version__: str = "v2.2.1"
13+
from .version import (
14+
__version__,
15+
__version_info__
16+
)
1417
__license__: str = "MIT"
1518
__author__: str = "Meheret Tesfaye Batu"
1619
__email__: str = "[email protected]"
@@ -19,6 +22,7 @@
1922

2023
__all__: list = [
2124
"__version__",
25+
"__version_info__",
2226
"__license__",
2327
"__author__",
2428
"__email__",

hdwallet/version.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__version_info__ = ( 2, 2, 0 )
2+
__version__ = 'v' + '.'.join( map( str, __version_info__ ))

nixpkgs.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import (fetchTarball {
2+
url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/23.11.tar.gz";
3+
sha256 = "1ndiv385w1qyb3b18vw13991fzb9wg4cl21wglk89grsfsnra41k";
4+
})

requirements-cli.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
click >=8.1.3,<9
2+
click-aliases >=1.0.1,<2
3+
tabulate >=0.9.0,<1

requirements-dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build
2+
packaging
3+
setuptools
4+
wheel

requirements-docs.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sphinx >=5.3.0,<6
2+
furo ==2022.12.7
3+
sphinx-click >=4.4.0,<5

0 commit comments

Comments
 (0)