Skip to content

Commit

Permalink
Pin new library versions as suggested by Github contributor
Browse files Browse the repository at this point in the history
  • Loading branch information
saibot94 committed Jun 4, 2022
1 parent bac9f25 commit 69c8230
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 24 deletions.
11 changes: 5 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: python:3.8-slim
image: python:3.10-slim
variables:
NAMESPACE_PROD: captcha
APP_NAME: captcha-api
Expand Down Expand Up @@ -35,11 +35,11 @@ stages:

### Linting
flake8:
image: python:3.8-slim
image: python:3.10-slim
stage: lint
before_script:
- apt-get update && apt-get install -y -qq gcc
- pip install -r dev-requirements.txt
- pip install flake8
script:
- python -m flake8 *.py captcha_api tests
allow_failure: true
Expand All @@ -50,9 +50,8 @@ test:
stage: test
before_script:
- export PIP_CONFIG_FILE=$(pwd)/pip.conf
- apt-get update && apt-get install -y -qq libfreetype6 fontconfig-config espeak ffmpeg
- pip install -r dev-requirements.txt
- pip install -r requirements.txt
- apt-get update && apt-get install -y -qq libfreetype6 fontconfig-config espeak ffmpeg libtiff5-dev libopenjp2-7-dev zlib1g-dev python3-tk gcc libfreetype6-dev
- pip install -e '.[dev]'
script:
- coverage run -m pytest
- coverage html
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.8-slim
FROM docker.io/library/python:3.10-slim

RUN apt-get update && apt-get install -y -qq libfreetype6 fontconfig-config espeak ffmpeg
RUN apt-get update && apt-get install -y -qq libfreetype6 fontconfig-config espeak ffmpeg libtiff5-dev libopenjp2-7-dev zlib1g-dev python3-tk gcc libfreetype6-dev

WORKDIR /app
COPY . .
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,46 @@ docker run -d --name captcha -p 8080:8080 -e CAPTCHA_API_CONFIG=captcha.cfg capt

Navigate to `http://localhost:8080/swagger-ui`

## Running locally

This guide is written for users of Debian-based systems, the package names might differ on other operating systems such as CentOS.

For usage on Windows, please use the WSL2 distribution in order to build and run the application.

### Installing the required libraries

Unfortunately we need some binary dependencies, since PIL and the audio CAPTCHA generation require them. Run the following command:

```bash
sudo apt-get install libtiff5-dev libopenjp2-7-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \
libharfbuzz-dev libfribidi-dev libxcb1-dev ffmpeg espeak python3-dev
```

### Installing and running the application

Run

```bash
pip install -e '.[dev]'
```

in order to install all the required dependencies for development.

To start the server locally, you need to create a `captcha.cfg` file. Just `cp captcha_api/captcha.cfg.example captcha_api/captcha.cfg` to get started.

Running the server is done by running:

```
flask run
```

or

```
gunicorn --bind 0.0.0.0:5000 wsgi:app
```

## Audio CAPTCHA

For accessibility reasons, one might one to listen to the CAPTCHA message. In order to do yhat, you can point to the following endpoint:
Expand Down
5 changes: 0 additions & 5 deletions dev-requirements.txt

This file was deleted.

13 changes: 6 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
Flask==1.1.1
gunicorn>=19.5.0
Flask==2.1.0
gunicorn==20.1.0
requests==2.23.*
flask-restx==0.2.0
certifi==2019.11.28
werkzeug==0.16.1
flask-restx==0.5.1
flask_cors==3.0.*
python-dotenv==0.12.0
Flask-SQLAlchemy==2.4.4
SQLAlchemy==1.3.19
Flask-SQLAlchemy==2.5.1
SQLAlchemy==1.4.37
pillow==7.2.0
celery==4.4.7
redis==3.5.3
pyttsx3==2.90
flask-migrate==2.5.3
itsdangerous==2.0.1
certifi
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def load_requirements():

setup(
name="captcha-api",
version="0.1.0",
version="0.2.0",
description="CERN CAPTCHA service",
url="https://github.com/CERN/captcha-api",
author="MALT IAM team",
Expand All @@ -27,11 +27,14 @@ def load_requirements():
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
install_requires=load_requirements(),
keywords=["captcha", "service", "Flask", "SQLAlchemy", "CLI"],
packages=find_packages(exclude=("tests*", "*tests", "tests")),
include_package_data=True
extras_require={
"dev": ["pytest", "flake8", "coverage", "black==22.3.0", "isort"]
},
include_package_data=True,
)

0 comments on commit 69c8230

Please sign in to comment.