Use python venv (#1920)

* Automatically install requirements.txt in setup

* Remove extra copy of requirements.txt in dockerfile
This commit is contained in:
Jonathan Zernik 2021-12-29 18:48:53 -08:00 committed by GitHub
parent ce5cd6287c
commit 058240841d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 10 additions and 17 deletions

View file

@ -35,7 +35,6 @@ jobs:
python-version: 3.8
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install tox
- name: Run tests and collect coverage
@ -105,7 +104,6 @@ jobs:
- name: Install dependencies and build
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI

1
.gitignore vendored
View file

@ -9,6 +9,7 @@ htmlcov/
dist/
/build/
*.egg-info/
.eggs/
.idea/
*.swp
*~

View file

@ -13,10 +13,7 @@ RUN python -m venv /opt/venv
# Make sure we use the virtualenv:
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt /
RUN pip install --upgrade pip && \
pip install -r requirements.txt
RUN pip install --upgrade pip
WORKDIR /app

View file

@ -71,9 +71,8 @@ pip install squeaknode
Or install from source
```
virtualenv venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install .
```

View file

@ -15,9 +15,8 @@ To change any database model, follow these steps.
```
- Run the command to generate a new alembic migration:
```
virtualenv venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -e .
alembic -c squeaknode/db/alembic.ini revision --autogenerate -m "<YOUR_MESSAGE>"
```

View file

@ -27,9 +27,8 @@ You can also run your own squeaknode on your host machine.
- Install squeaknode:
```
virtualenv venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install .
```

View file

@ -9,9 +9,8 @@
```
- Start the backend with the `SQUEAKNODE_WEBADMIN_ENABLED`, `SQUEAKNODE_WEBADMIN_LOGIN_DISABLED`, and `SQUEAKNODE_WEBADMIN_ALLOW_CORS` environment variables:
```
virtualenv venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install .
SQUEAKNODE_WEBADMIN_ENABLED=TRUE SQUEAKNODE_WEBADMIN_LOGIN_DISABLED=TRUE SQUEAKNODE_WEBADMIN_ALLOW_CORS=TRUE SQUEAKNODE_NETWORK=testnet squeaknode --config config.ini
```

View file

@ -4,8 +4,6 @@ flask-cors==3.0.10
flask-login==0.5.0
Flask-WTF==0.15.1
googleapis-common-protos==1.53.0
grpcio==1.39.0
grpcio-tools==1.39.0
importlib_resources==1.4.0
mypy-protobuf==2.9
protobuf==3.17.3

View file

@ -27,7 +27,6 @@ from typing import Tuple
import pkg_resources
import setuptools.command.build_py
import setuptools.command.test
from grpc_tools import protoc
from setuptools import Command
from setuptools import find_packages
from setuptools import setup
@ -48,6 +47,9 @@ class BuildPyCommand(setuptools.command.build_py.build_py):
def build_package_protos(package_root, strict_mode=False):
# Import grpc_tools here because it is not available at top of module.
from grpc_tools import protoc
proto_files = []
inclusion_root = os.path.abspath(package_root)
for root, _, files in os.walk(inclusion_root):
@ -100,6 +102,7 @@ setup(
packages=find_packages(),
include_package_data=True,
zip_safe=False,
setup_requires=['grpcio-tools==1.39.0', 'wheel==0.37.1'],
install_requires=requirements,
extras_require={
"test": ["pytest", "coverage"],