Skip to content

Faster pypi update script #133

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include buidl/bip39_words.txt
include buidl/slip39_words.txt
graft docs*
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $ multiwallet.py
Welcome to multiwallet...
```

For more information on installing multiwallet, see [multiwallet.md](docs/multiwallet.md) or check out [this demo](https://twitter.com/mflaxman/status/1321503036724989952).
For more information on installing multiwallet, see [docs/multiwallet.md](https://github.com/buidl-bitcoin/buidl-python/blob/main/docs/multiwallet.md) or check out [this demo](https://twitter.com/mflaxman/status/1321503036724989952).

`singlesweep.py` works the same way for sweeping out of paper wallets, but is intentionally undocumented.

Expand Down Expand Up @@ -100,3 +100,4 @@ $ sudo make install
$ git clone [email protected]:buidl-bitcoin/buidl-python.git && cd buidl-python && python3 -m pip install -r requirements-libsec.txt && python3 -m pip install --editable . && cd buidl && python3 libsec_build.py && cd .. && python3 -c "from buidl import *; print('success') if is_libsec_enabled() else print('LIBSEC INSTALL FAIL')"

```
(Or run the included [`install_libsec.sh`](https://github.com/buidl-bitcoin/buidl-python/blob/main/install_libsec.sh) script)
5 changes: 1 addition & 4 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#! /usr/bin/env bash

set -o xtrace

pip3 uninstall buidl -y
rm -rf .venv3/
rm -rf dist/
rm -rf build/
rm -rf buidl.egg-info/
rm buidl/_libsec.c
rm buidl/_libsec.cpython-*-darwin.so
rm buidl/_libsec.o
rm buidl/_libsec.so

find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
8 changes: 8 additions & 0 deletions clean_libsec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /usr/bin/env bash

set -o xtrace

rm -f buidl/_libsec.c
rm -f buidl/_libsec.cpython-*-darwin.so
rm -f buidl/_libsec.o
rm -f buidl/_libsec.so
13 changes: 13 additions & 0 deletions install_libsec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#! /usr/bin/env bash

# This assumes libsecp256k1 is already installed on the OS

set -o xtrace

python3 -m pip install -r requirements-libsec.txt
python3 -m pip install --editable .
cd buidl
python3 libsec_build.py
cd ..
# TODO: should this fail if libsec doesn't work?
python3 -c "from buidl import *; print('success') if is_libsec_enabled() else print('LIBSEC INSTALL FAIL')"
38 changes: 25 additions & 13 deletions update_pypi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,33 @@ deactivate
# Abandon if anything errors
set -e;

# Remove old files
rm -rf .venv3/
rm -rf dist/
rm -rf build/
rm -rf buidl.egg-info/
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf

# Tests
# Cleanup before getting started
./clean.sh
./clean_libsec.sh

## RUN TESTS ##

# To make tests fast
./install_libsec.sh

# Install testing requirements
if [ -f requirements-test.txt ]; then python3 -m pip install -r requirements-test.txt; fi

# Run tests
black --check .
flake8 .
pytest -v buidl/test/
pytest -v test_*.py

# Cleanup and reinstall build for pypi
./clean.sh
./clean_libsec.sh

# Safety
git push

## UPDATE PYPI ##

# Virtualenv
python3 --version
# Install virtualenv (if not installed)
Expand All @@ -42,13 +52,15 @@ python3 -m pip freeze
python3 setup.py sdist bdist_wheel
# Upload to PyPI
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*
# Use this line to upload to pypi testing repo instead:
# python3 -m twine upload --repository testpypi dist/*
python3 -m twine testpypi dist/*

# Cleanup
rm -rfv dist/
rm -rfv buidl.egg-info/
rm -rfv build/
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
./clean.sh

# Libsec is nice to have installed by default
./install_libsec.sh

# Hackey timer
# https://askubuntu.com/questions/1028924/how-do-i-use-seconds-inside-a-bash-script
Expand Down