Skip to content
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
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
language: python
python:
- "3.6"
- "3.6-dev" # 3.6 development branch
- "3.7"
- "3.7-dev" # 3.7 development branch
install:
- pip install -r requirements.txt --no-cache
- pip install poetry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the poetry docs, the recommended method to install poetry is not to use pip rather their own script

- poetry install --no-interaction --no-ansi
script: pytest
env:
- API_NAME=api PORT=8000
46 changes: 33 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
FROM tiangolo/uwsgi-nginx-flask:python3.7
# maybe we want to move to:
# FROM tiangolo/meinheld-gunicorn-flask:python3.6
FROM python:3.7.6-alpine3.11 as base

MAINTAINER Akshay Dahiya <xadahiya@gmail.com>
ENV PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PYTHONUNBUFFERED=1

COPY ./requirements.txt requirements.txt
# install certificates which were not installed in the base image
RUN apt-get update && apt-get install -y ca-certificates
RUN pip install -U pip && pip install --upgrade pip setuptools \
&& pip install -r requirements.txt && rm -rf *
#
# building stage
#
FROM base as builder

COPY . /app
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
POETRY_VERSION=1.0.5 \
PATH=/root/.local/bin:$PATH

ENV PYTHONPATH $PYTHONPATH:/app:/app/hydrus
RUN apk add --no-cache gcc libffi-dev musl-dev \
py3-virtualenv git postgresql-dev \
libxml2 libxml2-dev libxslt-dev

RUN mv /app/hydrus/uwsgi.ini /app/uwsgi.ini
COPY . ./app
WORKDIR /app
# Poetry requires a virtualenv
RUN pip install --user "poetry==$POETRY_VERSION"
RUN virtualenv -p $(which python) .venv
# Build wheels with Poetry
RUN poetry build && .venv/bin/pip install dist/*.whl

ENV MESSAGE "Hail Hydra"
#
# running stage
#
FROM base as final
RUN apk add --no-cache libffi libpq
# copy virtualenv and application
COPY --from=builder /app/.venv /.venv
COPY . ./app
WORKDIR /app
CMD ["/.venv/bin/gunicorn --bind 0.0.0.0:8080 --forwarded-allow-ips='*' hydrus:app"]
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ git checkout -b develop origin/develop

Install hydrus using:
```bash
pip3 install -r requirements.txt
poetry install

python3 setup.py install
```
Expand All @@ -76,7 +76,7 @@ and run the server using:
hydrus serve
```

The demo should be up and running on `http://localhost:8080/serverapi/`.
The demo should be up and running on `http://localhost:8080/api/`.

<a name="usage"></a>
Usage
Expand All @@ -87,6 +87,8 @@ For more info, head to the [Usage](http://www.hydraecosystem.org/01-Usage.html)
Development
-------------

The suggested way of running `hydrus` is via Docker-Compose: `docker-compose up --build`.

From the `hydrus` directory:
* To run formatter: `pip install black && black *.py`
* To test for formatting: `flake8 *.py`
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ services:
build: ./
ports:
- "8080:8080"
# command:
# - /.venv/bin/uwsgi --http :8080 /app/hydrus/uwsgi.ini
environment:
# - HYDRUS_SERVER_URL=http://192.168.99.100:8081/ ## For windows 10
# - HYDRUS_SERVER_URL=http://54.169.232.177:8080/
Expand Down
84 changes: 45 additions & 39 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ flake8 = "~3.8.3"
[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
requires = ["poetry-core>=1.0.5"]
build-backend = "poetry.core.masonry.api"
37 changes: 0 additions & 37 deletions requirements.txt

This file was deleted.

25 changes: 0 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,6 @@

from setuptools import setup, find_packages

try:
# pip >=20
from pip._internal.network.session import PipSession
from pip._internal.req import parse_requirements

install_requires = parse_requirements("requirements.txt", session=PipSession())
dependencies = [str(package.requirement) for package in install_requires]
except ImportError:
try:
# 10.0.0 <= pip <= 19.3.1
from pip._internal.download import PipSession
from pip._internal.req import parse_requirements
except ImportError:
# pip <= 9.0.3
from pip.download import PipSession
from pip.req import parse_requirements

install_requires = parse_requirements("requirements.txt", session=PipSession())
dependencies = [str(package.req) for package in install_requires]

for package_index in range(len(dependencies)):
if dependencies[package_index].startswith("git+"):
dependencies[package_index] = dependencies[package_index].split("=")[1]

setup(
name="hydrus",
include_package_data=True,
Expand All @@ -39,7 +15,6 @@
url="https://github.com/HTTP-APIs/hydrus",
py_modules=["cli"],
python_requires=">=3.5.2",
install_requires=dependencies,
packages=find_packages(exclude=["contrib", "docs", "tests*", "hydrus.egg-info"]),
package_dir={"hydrus": "hydrus"},
entry_points="""
Expand Down