Skip to content

Commit

Permalink
Reduce stuff installed for non-developers.
Browse files Browse the repository at this point in the history
  • Loading branch information
richardkiss committed Mar 27, 2020
1 parent b319691 commit ef59bb2
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 69 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,31 @@ jobs:
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
- name: Install Mac dependencies
if: startsWith(matrix.os, 'mac')
run: |
brew update && brew install gmp boost openssl
- name: Install ubuntu dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get install libboost-all-dev libssl-dev
- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
brew update && brew install gmp boost openssl || echo ""
sudo apt-get install libboost-all-dev || echo ""
sudo apt-get install libssl-dev || echo ""
sh install.sh
- name: Install time lord
run: |
sh install-timelord.sh
- name: Install developer requirements
run: |
venv/bin/python -m pip install -r requirements-dev.txt
- name: Lint source with flake8
run: |
./venv/bin/flake8 src --exclude src/electron-ui/node_modules
- name: Lint source with mypy
run: |
./venv/bin/mypy src tests
- name: Install chiavdf from source
if: matrix['python-version'] == '3.7' && startsWith(matrix.os, 'ubuntu')
run: |
source venv/bin/activate
pip install --force --no-binary chiavdf chiavdf==0.12.1
- name: Test blockchain code with pytest
run: |
./venv/bin/py.test tests -s -v
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The first time the tests are run, BlockTools will create and persist many plots.
proofs of space during testing. The next time tests are run, this won't be necessary.

```bash
pip install -r requirements-dev.txt # you only need to do this once
black src tests && flake8 src --exclude src/wallet/electron/node_modules && mypy src tests
py.test tests -s -v
```
Expand Down
17 changes: 11 additions & 6 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,24 @@ sh install.sh

### Debian/Ubuntu

On Ubuntu 18.04, you need python 3.7.
On Ubuntu 18.04, you need python 3.7. It's not available in the default
repository, so you need to add an alternate source.

```bash
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7-venv python3.7-dev
sudo -s
apt install software-properties-common -y # for add-apt-repository
add-apt-repository ppa:deadsnakes/ppa -y
exit
```

Install dependencies.

```bash
sudo apt-get update
sudo apt-get install build-essential git cmake libgmp3-dev python3-dev -y
sudo apt-get install python3-venv libssl-dev libboost-all-dev -y
sudo -s
apt-get update
apt-get install python3.7-venv python3.7-dev -y # install python3.7 with venv and headers
apt-get install build-essential git cmake libgmp3-dev libssl-dev libboost-all-dev -y
exit

git clone https://github.com/Chia-Network/chia-blockchain.git
cd chia-blockchain
Expand Down
16 changes: 16 additions & 0 deletions install-timelord.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

THE_PATH=`python -c 'import pkg_resources; print( pkg_resources.get_distribution("chiavdf").location)' 2> /dev/null`/vdf_client

if [ -e $THE_PATH ]
then
echo "vdf_client already exists, no action taken"
else
if [ -e venv/bin/python ]
then
echo "installing chiavdf from source"
echo venv/bin/python -m pip install --force --no-binary chiavdf chiavdf==0.12.1
venv/bin/python -m pip install --force --no-binary chiavdf chiavdf==0.12.1
else
echo "no venv created yet, please run install.sh"
fi
fi
9 changes: 6 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
#!/bin/bash
set -e

if [ `uname` = "Linux" ] && type apt-get; then
# Debian/Ubuntu
sudo apt-get install -y libgmp3-dev libboost-dev libboost-system-dev npm python3-dev cmake
fi

python3 -m venv venv
# this fancy syntax sets INSTALL_PYTHON_PATH to "python3.7" unless INSTALL_PYTHON_VERSION is defined
# if INSTALL_PYTHON_VERSION=3.8, then INSTALL_PYTHON_PATH becomes python3.8

INSTALL_PYTHON_PATH=python${INSTALL_PYTHON_VERSION:-3.7}

$INSTALL_PYTHON_PATH -m venv venv
ln -s venv/bin/activate
. ./activate
# pip 20.x+ supports Linux binary wheels
pip install --upgrade pip
pip install wheel
pip install -e .
pip install -r requirements.txt

Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.5.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
local_scheme = "no-local-version"
37 changes: 37 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Click==7.0
PyYAML==5.3
appdirs==1.4.3
autoflake==1.3.1
black==19.10b0
cbor2==5.0.1
cffi==1.13.2
cryptography==2.8
entrypoints==0.3
flake8==3.7.9
idna==2.8
importlib-metadata==1.4.0
isort==4.3.21
mccabe==0.6.1
more-itertools==8.1.0
multidict==4.7.4
mypy-extensions==0.4.3
mypy==0.761
packaging==20.0
pathspec==0.7.0
pluggy==0.13.1
py==1.8.1
pycodestyle==2.5.0
pycparser==2.19
pyflakes==2.1.1
pyparsing==2.4.6
pytest-asyncio==0.10.0
pytest==5.3.4
regex==2020.1.8
setuptools-scm==3.4.2
six==1.14.0
toml==0.10.0
typed-ast==1.4.1
typing-extensions==3.7.4.1
wcwidth==0.1.8
websockets==8.1.0
zipp==2.0.0
51 changes: 0 additions & 51 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,54 +1,3 @@
aiohttp==3.6.2
aiosqlite==0.11.0
aiter==0.13.20191203
appdirs==1.4.3
async-timeout==3.0.1
attrs==19.3.0
autoflake==1.3.1
black==19.10b0
blspy==0.1.14
cbor2==5.0.1
cffi==1.13.2
chardet==3.0.4
chiabip158==0.12
chiapos==0.12
chiavdf==0.12.1
Click==7.0
colorlog==4.1.0
cryptography==2.8
entrypoints==0.3
flake8==3.7.9
idna==2.8
importlib-metadata==1.4.0
isort==4.3.21
mccabe==0.6.1
miniupnpc==2.0.2
more-itertools==8.1.0
multidict==4.7.4
mypy==0.761
mypy-extensions==0.4.3
packaging==20.0
pathspec==0.7.0
pluggy==0.13.1
py==1.8.1
pycodestyle==2.5.0
pycparser==2.19
pyflakes==2.1.1
pyparsing==2.4.6
pytest==5.3.4
pytest-asyncio==0.10.0
PyYAML==5.3
regex==2020.1.8
setuptools-scm==3.4.2
six==1.14.0
toml==0.10.0
typed-ast==1.4.1
typing-extensions==3.7.4.1
wcwidth==0.1.8
yarl==1.4.2
zipp==2.0.0
sortedcontainers==2.1.0
websockets==8.1.0
-e git+https://github.com/Chia-Network/py-setproctitle.git@d2ed86c5080bb645d8f6b782a4a86706c860d9e6#egg=py-setproctitle
-e git+https://github.com/Chia-Network/clvm.git@b912f3a0e0bd18a5ecbb29124a00fc68d8b03adb#egg=clvm
-e git+https://github.com/Chia-Network/clvm_tools.git@6ff53bcfeb0c970647b6cfdde360d32b316b1326#egg=clvm_tools
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"chiavdf", # timelord and vdf verification
"chiabip158", # bip158-style wallet filters
"chiapos", # proof of space
"sortedcontainers",
]
dev_dependencies = [
"pytest",
Expand Down

0 comments on commit ef59bb2

Please sign in to comment.