Skip to content

Commit

Permalink
v1.46 - Dockerized for easy release, improved performance and better …
Browse files Browse the repository at this point in the history
…compatibility

v1.46 - Dockerized Screeni-py for release on Dockerhub (joshipranjal/screeni-py:latest)
* Dockerization added, TA-Lib re-enabled for better results
* req and workflow modified
* OTA disabled inside docker
* runner/launch script added
* Docker and workflow fixed
* add dev docker build, isDocker added to utility, OtaUpdater modified for docker
* dev docker build merged into test
* docker build added to existing build workflow
* docker build added to existing build workflow
* watchlist disabled for docker
* docs updated for docker
* numpy MKL disabled
* test workflow fixed
* req fixed
* test script fixed
---------
Co-authored-by: github-actions <[email protected]>
Co-authored-by: pranjal-joshi <[email protected]>
  • Loading branch information
github-actions[bot] authored Sep 18, 2023
1 parent 8318d74 commit 654a250
Show file tree
Hide file tree
Showing 14 changed files with 237 additions and 48 deletions.
74 changes: 59 additions & 15 deletions .github/workflows/workflow-build-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:

# Job for builing packages
Build:
Build_Executables:
name: Build Packages
#needs: Create-Release
runs-on: ${{ matrix.os }}
Expand All @@ -24,8 +24,15 @@ jobs:
- os: windows-latest
TARGET: Windows
CMD_BUILD: |
pyinstaller --onefile --icon=src\icon.ico src\screenipy.py --hidden-import cmath --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress
pyinstaller --onefile --icon=src\icon.ico src\screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress
DEP_BUILD: |
python -m pip install --upgrade pip
echo Installing TA-lib...
cd .github/dependencies/
echo %cd%
pip install TA_Lib-0.4.19-cp39-cp39-win_amd64.whl
cd ..
cd ..
python -m pip install --upgrade pip
pip install -r requirements.txt
TEST_BUILD: |
Expand All @@ -37,13 +44,21 @@ jobs:
- os: ubuntu-20.04
TARGET: Linux
CMD_BUILD: |
pyinstaller --onefile --icon=src/icon.ico src/screenipy.py --hidden-import cmath --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress
pyinstaller --onefile --icon=src/icon.ico src/screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress
mv /home/runner/work/Screeni-py/Screeni-py/dist/screenipy /home/runner/work/Screeni-py/Screeni-py/dist/screenipy.bin
chmod +x /home/runner/work/Screeni-py/Screeni-py/dist/screenipy.bin
DEP_BUILD: |
cd .github/dependencies/
pwd
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure --prefix=/usr
make
sudo make install
cd /home/runner/work/Screeni-py/Screeni-py/
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install ta-lib==0.4.24
TEST_BUILD: |
/home/runner/work/Screeni-py/Screeni-py/dist/screenipy.bin --testbuild
exit $?
Expand All @@ -53,19 +68,21 @@ jobs:
- os: macos-latest
TARGET: MacOS
CMD_BUILD: |
pyinstaller --onefile --windowed --icon=src/icon.ico src/screenipy.py --hidden-import cmath --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress
pyinstaller --onefile --windowed --icon=src/icon.ico src/screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress
mv /Users/runner/work/Screeni-py/Screeni-py/dist/screenipy /Users/runner/work/Screeni-py/Screeni-py/dist/screenipy.run
DEP_BUILD: |
brew install ta-lib
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install ta-lib==0.4.24
TEST_BUILD: |
/Users/runner/work/Screeni-py/Screeni-py/dist/screenipy.run --testbuild
exit $?
OUT_PATH: /Users/runner/work/Screeni-py/Screeni-py/dist/screenipy.run
FILE_NAME: screenipy.run

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Get the GitHub Tag version
id: get_version
Expand All @@ -77,16 +94,16 @@ jobs:
with:
python-version: 3.9.4

# - name: Load Cache for Linux Dependencies
# uses: actions/cache@v2
# if: startsWith(runner.os, 'Linux')
# with:
# path: |
# /usr/include/ta-lib
# /usr/bin/ta-lib-config
# key: ${{ runner.os }}-talib
# restore-keys: |
# ${{ runner.os }}-talib
- name: Load Cache for Linux Dependencies
uses: actions/cache@v2
if: startsWith(runner.os, 'Linux')
with:
path: |
/usr/include/ta-lib
/usr/bin/ta-lib-config
key: ${{ runner.os }}-talib
restore-keys: |
${{ runner.os }}-talib
- name: Install dependencies for ${{ matrix.TARGET }}
run: ${{ matrix.DEP_BUILD }}
Expand Down Expand Up @@ -126,3 +143,30 @@ jobs:
body: |
${{ steps.read_release.outputs.RELEASE_BODY }}
overwrite: true

Docker_Build:
name: Build and Release Docker
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}


- name: Build and Push latest image
run: |
ver=$(grep 'VERSION = ' src/classes/Changelog.py | awk -F'"' '{print $2}')
echo $ver
if [ -z "$ver" ]; then
ver="latest"
fi
docker build -t screeni-py:$ver .
docker tag screeni-py:$ver joshipranjal/screeni-py:$ver
docker push joshipranjal/screeni-py:$ver
docker tag screeni-py:$ver joshipranjal/screeni-py:latest
docker push joshipranjal/screeni-py:latest
42 changes: 34 additions & 8 deletions .github/workflows/workflow-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python 3.9.4
uses: actions/setup-python@v2
Expand All @@ -35,12 +35,12 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
# - name: Install dependencies for TA-Lib
# run: |
# python -m pip install --upgrade pip
# cd .github/dependencies/
# echo %cd%
# pip install TA_Lib-0.4.19-cp39-cp39-win_amd64.whl
- name: Install dependencies for TA-Lib
run: |
python -m pip install --upgrade pip
cd .github/dependencies/
echo %cd%
pip install TA_Lib-0.4.19-cp39-cp39-win_amd64.whl
# - name: Install Numpy-MKL for Windows
# run: |
Expand All @@ -52,6 +52,8 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-mock
pip install numpy==1.21.0
pip install ta-lib
pip install -r requirements.txt
- name: Lint with flake8
Expand All @@ -66,6 +68,28 @@ jobs:
cd test/
pytest -v
Dev_Docker_Build:

runs-on: ubuntu-latest
needs: [Test-Source]

steps:
- uses: actions/checkout@v4
with:
ref: new-features

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Dev Build and Docker Push
run: |
docker build -t screeni-py:dev .
docker tag screeni-py:dev joshipranjal/screeni-py:dev
docker push joshipranjal/screeni-py:dev
# Job to create PR
Create-Pull-Request:

Expand All @@ -74,7 +98,9 @@ jobs:

steps:
- name: Checkout Repo before PR
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: new-features

- name: Create Pull Request (new-features -> main)
id: create_pr
Expand Down
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Project : Screenipy
# Author : Pranjal Joshi
# Created : 17/08/2023
# Description : Dockerfile to build Screeni-py image for release

# FROM ubuntu:latest as base
FROM tensorflow/tensorflow:2.9.2 as base

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y software-properties-common

RUN add-apt-repository ppa:deadsnakes/ppa

RUN apt-get update && apt-get install -y --no-install-recommends \
python3.8 \
python3-pip \
build-essential \
git \
vim nano wget curl \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

ENV LANG C.UTF-8

ADD . /opt/program/

ENV PATH="/opt/program:${PATH}"

WORKDIR /opt/program

RUN chmod +x *

WORKDIR /opt/program/.github/dependencies/
RUN tar -xzf ta-lib-0.4.0-src.tar.gz

WORKDIR /opt/program/.github/dependencies/ta-lib/
RUN ./configure --prefix=/usr --build=x86_64-unknown-linux-gnu
RUN make
RUN make install

WORKDIR /opt/program/
RUN python3 -m pip install --upgrade pip
# RUN pip3 install ta-lib==0.4.24

RUN pip3 install -r "requirements.txt"

ENV PYTHONUNBUFFERED=TRUE
ENV PYTHONDONTWRITEBYTECODE=TRUE

WORKDIR /opt/program/src/
# ENTRYPOINT [ "python3","screenipy.py" ]
45 changes: 38 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
| |
| :-: |
| ![Screeni-py](https://user-images.githubusercontent.com/6128978/217816268-74c40180-fc47-434d-938b-3639898ee3e0.png) |
| [![GitHub release (latest by date)](https://img.shields.io/github/v/release/pranjal-joshi/Screeni-py?style=for-the-badge)](https://github.com/pranjal-joshi/Screeni-py/releases/latest) [![GitHub all releases](https://img.shields.io/github/downloads/pranjal-joshi/Screeni-py/total?color=Green&label=Downloads&style=for-the-badge)](#) [![GitHub](https://img.shields.io/github/license/pranjal-joshi/Screeni-py?style=for-the-badge)](https://github.com/pranjal-joshi/Screeni-py/blob/main/LICENSE) [![CodeFactor](https://www.codefactor.io/repository/github/pranjal-joshi/screeni-py/badge?style=for-the-badge)](https://www.codefactor.io/repository/github/pranjal-joshi/screeni-py) [![MADE-IN-INDIA](https://img.shields.io/badge/MADE%20WITH%20%E2%9D%A4%20IN-INDIA-orange?style=for-the-badge)](https://en.wikipedia.org/wiki/India) [![BADGE](https://img.shields.io/badge/PULL%20REQUEST-GUIDELINES-red?style=for-the-badge)](https://github.com/pranjal-joshi/Screeni-py/blob/new-features/CONTRIBUTING.md) |
| [![GitHub release (latest by date)](https://img.shields.io/github/v/release/pranjal-joshi/Screeni-py?style=for-the-badge)](https://github.com/pranjal-joshi/Screeni-py/releases/latest) [![GitHub all releases](https://img.shields.io/github/downloads/pranjal-joshi/Screeni-py/total?color=Green&label=Downloads&style=for-the-badge)](#) ![Docker Pulls](https://img.shields.io/docker/pulls/joshipranjal/screeni-py?style=for-the-badge&logo=docker) [![GitHub](https://img.shields.io/github/license/pranjal-joshi/Screeni-py?style=for-the-badge)](https://github.com/pranjal-joshi/Screeni-py/blob/main/LICENSE) [![CodeFactor](https://www.codefactor.io/repository/github/pranjal-joshi/screeni-py/badge?style=for-the-badge)](https://www.codefactor.io/repository/github/pranjal-joshi/screeni-py) [![MADE-IN-INDIA](https://img.shields.io/badge/MADE%20WITH%20%E2%9D%A4%20IN-INDIA-orange?style=for-the-badge)](https://en.wikipedia.org/wiki/India) [![BADGE](https://img.shields.io/badge/PULL%20REQUEST-GUIDELINES-red?style=for-the-badge)](https://github.com/pranjal-joshi/Screeni-py/blob/new-features/CONTRIBUTING.md) |
| [![Screenipy Test - New Features](https://github.com/pranjal-joshi/Screeni-py/actions/workflows/workflow-test.yml/badge.svg?branch=new-features)](https://github.com/pranjal-joshi/Screeni-py/actions/workflows/workflow-test.yml) [![Screenipy Build - New Release](https://github.com/pranjal-joshi/Screeni-py/actions/workflows/workflow-build-matrix.yml/badge.svg)](https://github.com/pranjal-joshi/Screeni-py/actions/workflows/workflow-build-matrix.yml) |
| ![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) ![Mac OS](https://img.shields.io/badge/mac%20os-D3D3D3?style=for-the-badge&logo=apple&logoColor=000000) |
| ![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) ![Mac OS](https://img.shields.io/badge/mac%20os-D3D3D3?style=for-the-badge&logo=apple&logoColor=000000) ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white) |
| <img width="240" src="https://user-images.githubusercontent.com/6128978/217814499-7934edf6-fcc3-46d7-887e-7757c94e1632.png"><h2>Scan QR Code to join [Official Telegram Group](https://t.me/+0Tzy08mR0do0MzNl) for Additional Discussions</h2> |

| **Download** | **Discussion** | **Bugs/Issues** | **Documentation** |
| :---: | :---: | :---: | :---: |
| [![cloud-computing (1)](https://user-images.githubusercontent.com/6128978/149935359-ca0a7155-d1e3-4e47-98e8-67f879e707e7.png)](https://github.com/pranjal-joshi/Screeni-py/releases/latest) | [![meeting](https://user-images.githubusercontent.com/6128978/149935812-31266023-cc5b-4c98-a416-1d4cf8800c0c.png)](https://github.com/pranjal-joshi/Screeni-py/discussions) | [![warning](https://user-images.githubusercontent.com/6128978/149936142-04d7cf1c-5bc5-45c1-a8e4-015454a2de48.png)](https://github.com/pranjal-joshi/Screeni-py/issues?q=is%3Aissue) | [![help](https://user-images.githubusercontent.com/6128978/149937331-5ee5c00a-748d-4fbf-a9f9-e2273480d8a2.png)](https://github.com/pranjal-joshi/Screeni-py/blob/main/README.md#what-is-screeni-py) |
| Download the Latest Version | Join/Read the Community Discussion | Raise an Issue about a Problem | Get Help about Usage |
| **Download** | **Use** | **Discussion** | **Bugs/Issues** | **Documentation** |
| :---: | :---: | :---: | :---: | :---: |
| [![cloud-computing (1)](https://user-images.githubusercontent.com/6128978/149935359-ca0a7155-d1e3-4e47-98e8-67f879e707e7.png)](https://github.com/pranjal-joshi/Screeni-py/releases/latest) | [![docker](https://github.com/pranjal-joshi/Screeni-py/assets/6128978/f44054b8-9fcb-465c-a38b-63f6ecc4a0c9)](https://hub.docker.com/r/joshipranjal/screeni-py/tags) | [![meeting](https://user-images.githubusercontent.com/6128978/149935812-31266023-cc5b-4c98-a416-1d4cf8800c0c.png)](https://github.com/pranjal-joshi/Screeni-py/discussions) | [![warning](https://user-images.githubusercontent.com/6128978/149936142-04d7cf1c-5bc5-45c1-a8e4-015454a2de48.png)](https://github.com/pranjal-joshi/Screeni-py/issues?q=is%3Aissue) | [![help](https://user-images.githubusercontent.com/6128978/149937331-5ee5c00a-748d-4fbf-a9f9-e2273480d8a2.png)](https://github.com/pranjal-joshi/Screeni-py/blob/main/README.md#what-is-screeni-py) |
| Download the Latest Version | Get started quickly using Docker | Join/Read the Community Discussion | Raise an Issue about a Problem | Get Help about Usage |

<!-- ## [**Click to Download the Latest Version**](https://github.com/pranjal-joshi/Screeni-py/releases/latest) -->

Expand All @@ -23,7 +23,7 @@
Screenipy is totally customizable and it can screen stocks with the settings that you have provided.

## How to use?
* Download the suitable file according to your OS.
* Download the suitable file according to your OS or install Docker Desktop and pull the `latest` docker image.
* Linux & Mac users should make sure that the `screenipy.bin or screenipy.run` is having `execute` permission.
* **Run** the file. Following window will appear after a brief delay.

Expand Down Expand Up @@ -75,6 +75,37 @@ useema = n
```
Try to tweak this parameters as per your trading styles. For example, If you're comfortable with weekly charts, make `duration=5d` and so on.

## Installation Guide:

![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) ![Mac OS](https://img.shields.io/badge/mac%20os-D3D3D3?style=for-the-badge&logo=apple&logoColor=000000) ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white)

**Should I download the Exe/Bin file? Or Should I use Docker?**

| Executable/Binary File | Docker |
| :-- | :-- |
| [![GitHub all releases](https://img.shields.io/github/downloads/pranjal-joshi/Screeni-py/total?color=Green&label=Downloads&style=for-the-badge)](#) | ![Docker Pulls](https://img.shields.io/docker/pulls/joshipranjal/screeni-py?style=for-the-badge&logo=docker) |
| Download Directly from the [Release](https://github.com/pranjal-joshi/Screeni-py/releases/latest) page | Need to Install [Docker Desktop](https://www.docker.com/products/docker-desktop/) ⚠️|
| May take a long time to open the app | Loads quickly |
| Slower screening | Performance boosted as per your CPU capabilities |
| Supports Excel Watchlist screening, Export results as excel | Excel features are not supported ⚠️ |
| You may face errors/warnings due to different CPU arch of your system ⚠️ | Compatible with all x86/x86_64 CPUs irrespective of OS (Mac M1/M2 not yet supported ⚠️) |
| Works only with Windows 10/11 ⚠️ | Works with older versions of Windows as well |
| Different file for each OS | Same container is compatible with everyone |
| Antivirus may block this as untrusted file ⚠️ | No issues with Antivirus |
| Need to download new file for every update | Updates quickly with minimal downloading |
| No need of commands/technical knowledge | Very basic command execution skills may be required |
| Custom configuration works and persisted accross the runs/restarts | Works only with default configuration as config file resets at every run ⚠️ |

### How to setup and use Screeni-py with Docker?

1. Download and Install [Docker Desktop](https://www.docker.com/products/docker-desktop/) with default settings
2. If you are using windows, update WSL (Windows subsystem for linux) by running `wsl --update` command in command prompt
3. Restart your computer after installation
4. Open Docker Desktop and keep it as it is
5. Open Command Prompt (Windows) or Terminal (Mac/Linux) and run command `docker pull joshipranjal/screeni-py:latest`
6. Once installed, always start screenipy by running this command:
`docker run -it joshipranjal/screeni-py:latest run_screenipy.sh`

## Contributing:
* Please feel free to Suggest improvements bugs by creating an issue.
* Please follow the [Guidelines for Contributing](https://github.com/pranjal-joshi/Screeni-py/blob/new-features/CONTRIBUTING.md) while making a Pull Request.
Expand Down
11 changes: 7 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
numpy==1.21.0 # Installed as dependency for yfinance, scipy, matplotlib, pandas
numpy==1.24.4 # Installed as dependency for yfinance, scipy, matplotlib, pandas
# numpy==1.21.0 # Installed as dependency for yfinance, scipy, matplotlib, pandas
appdirs
cachecontrol
contextlib2
Expand All @@ -17,14 +18,16 @@ pyinstaller==5.6.2
pytest-mock
pytoml
retrying
scipy==1.7.3
# ta-lib
scipy==1.10.1
# ta-lib==0.4.24
ta-lib
tabulate
yfinance==0.1.87
alive-progress==1.6.2
Pillow
scikit-learn==1.1.1
tensorflow==2.9.2
# tensorflow
joblib
altgraph # Installed as dependency for pyinstaller
atomicwrites # Installed as dependency for pytest
Expand Down Expand Up @@ -57,4 +60,4 @@ six # Installed as dependency for cycler, nsetools, packaging, retrying, python-
toml # Installed as dependency for pep517, pytest
urllib3 # Installed as dependency for requests
webencodings # Installed as dependency for html5lib
pandas_ta
pandas_ta
4 changes: 4 additions & 0 deletions run_screenipy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

cd src
python3 screenipy.py
7 changes: 5 additions & 2 deletions src/classes/Changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from classes.ColorText import colorText

VERSION = "1.45"
VERSION = "1.46"

changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + '''
[1.00 - Beta]
Expand Down Expand Up @@ -199,5 +199,8 @@
[1.45]
1. Minor bug fixes after dependency change
--- END ---
[1.46]
1. TA-Lib reanabled. Dockerized for better distribution of the tool
''' + colorText.END
Loading

0 comments on commit 654a250

Please sign in to comment.