Skip to content

Commit

Permalink
v2.25 - Optimized Docker Image size and minor cosmetic changes
Browse files Browse the repository at this point in the history
[Screenipy Test] New Features Added - Test Passed - Merge OK
  • Loading branch information
pranjal-joshi authored Feb 10, 2025
2 parents 5458ec3 + ed01e80 commit 2f05a50
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 63 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.git
.github
actions-data-download
patterns
screenshots
test
.dockerignore
.gitignore
**/*.md
**/*.spec
Dockerfile
Makefile
*.code-workspace
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ stock*.pkl
results*.pkl
*.spec
.DS_Store
.history/
.history/
*.code-workspace
65 changes: 33 additions & 32 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,61 @@
# Created : 17/08/2023
# Description : Dockerfile to build Screeni-py image for GUI release

# FROM ubuntu:latest as base
# FROM tensorflow/tensorflow:2.9.2 as base
# FROM python:3.10.6-slim as base
FROM python:3.11.6-slim-bookworm as base
FROM python:3.11.6-slim-bookworm AS base

ARG DEBIAN_FRONTEND=noninteractive

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

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

ENV LANG C.UTF-8
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=TRUE \
PYTHONDONTWRITEBYTECODE=TRUE \
SCREENIPY_DOCKER=TRUE \
SCREENIPY_GUI=TRUE \
PATH=/opt/program:$PATH

ADD . /opt/program/
##############
# Build Phase
##############
FROM base AS build

ENV PATH="/opt/program:${PATH}"
ARG PIP_DISABLE_PIP_VERSION_CHECK=1
ARG PIP_NO_CACHE_DIR=1

WORKDIR /opt/program

RUN chmod +x *

# Removed build ta-lib from source as we're using [pip3 install TA-Lib-Precompiled] for faster docker build
RUN python3 -m venv /venv
ENV PATH=/venv/bin:$PATH

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

# WORKDIR /opt/program/.github/dependencies/ta-lib/
# RUN ./configure --prefix=/usr --build=$(uname -m)-unknown-linux-gnu
# RUN make
# RUN make install
RUN --mount=type=cache,target=/root/.cache/pip pip3 install -r requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip pip3 install --no-deps advanced-ta

WORKDIR /opt/program/
RUN python3 -m pip install --upgrade pip
##############
# Package Phase
##############
FROM base AS app

RUN pip3 install -r "requirements.txt"
RUN pip3 install --no-deps advanced-ta
COPY --from=build /venv /venv
ENV PATH=/venv/bin:$PATH

ENV PYTHONUNBUFFERED=TRUE
ENV PYTHONDONTWRITEBYTECODE=TRUE
WORKDIR /opt/program

ENV SCREENIPY_DOCKER = TRUE
COPY . .

ENV SCREENIPY_GUI = TRUE
RUN chmod +x ./*

EXPOSE 8000

EXPOSE 8501

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

WORKDIR /opt/program/src/
ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
WORKDIR /opt/program/src

ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
# ENTRYPOINT ["tail", "-f", "/dev/null"]
43 changes: 43 additions & 0 deletions LICENSE_Third_Party
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
The MIT License (MIT)

Copyright (c) 2023 pkjmesra

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

The MIT License (MIT)

Copyright (c) 2025 smitpsanghavi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 26 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

## What is Screeni-py?

### A Python-based stock screener for NSE, India.
### A Python-based stock screener for NSE, India

**Screenipy** is an advanced stock screener to find potential breakout stocks from NSE and tell its possible breakout values. It also helps to find the stocks that are consolidating and may breakout, or the particular chart patterns that you're looking for specifically to make your decisions.
Screenipy is totally customizable and it can screen stocks with the settings that you have provided.
Expand All @@ -26,8 +26,7 @@ Screenipy is totally customizable and it can screen stocks with the settings tha

[![Screeni-py - Detailed Installation Guide](https://markdown-videos-api.jorgenkh.no/url?url=https%3A%2F%2Fyoutu.be%2F2HMN0ac4H20)](https://youtu.be/2HMN0ac4H20)
[![Screeni-py - Configuration and Usage | Screenipy - Python NSE Stock Screener](https://markdown-videos-api.jorgenkh.no/url?url=https%3A%2F%2Fyoutu.be%2FJCn6z1A7INI)](https://youtu.be/JCn6z1A7INI)
[![Screeni-py - How to install Software Updates? | Screenipy - Python NSE Stock Screener](https://markdown-videos-api.jorgenkh.no/url?url=https%3A%2F%2Fyoutu.be%2FT41m13iMyJc)](https://youtu.be/T41m13iMyJc)

[![Screeni-py - How to install Software Updates? | Screenipy - Python NSE Stock Screener](https://markdown-videos-api.jorgenkh.no/url?url=https%3A%2F%2Fyoutu.be%2FT41m13iMyJc)](https://youtu.be/T41m13iMyJc)

* Install Docker Desktop and pull the `latest` docker image from the [release](https://github.com/pranjal-joshi/Screeni-py/releases/latest) page.
* Checkout this [YouTube Video](https://youtu.be/2HMN0ac4H20) for detailed installation guide.
Expand All @@ -38,27 +37,27 @@ Screenipy is totally customizable and it can screen stocks with the settings tha
<img width="1438" alt="image" src="https://github.com/pranjal-joshi/Screeni-py/assets/6128978/360b5faa-f4f4-4df6-bec1-90985889bee6">
<img width="1438" alt="image" src="https://github.com/pranjal-joshi/Screeni-py/assets/6128978/99903d67-d450-4c04-93ae-1f5bb4b905a5">


## How to use? (Older Version - CLI Based - DEPRECATED)

* 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` has `execute` permission.
* **Run** the file. The following window will appear after a brief delay.

![home](https://raw.githubusercontent.com/pranjal-joshi/Screeni-py/new-features/screenshots/screenipy_demo.gif)
![home](screenshots/screenipy_demo.gif)

* **Configure** the parameters as per your requirement using `Option > 8`.

![config](https://raw.githubusercontent.com/pranjal-joshi/Screeni-py/new-features/screenshots/config.png)
![config](screenshots/config.png)

* Following are the screenshots of screening and output results.

![screening](https://raw.githubusercontent.com/pranjal-joshi/Screeni-py/new-features/screenshots/screening.png)
![results](https://raw.githubusercontent.com/pranjal-joshi/Screeni-py/new-features/screenshots/results.png)
![done](https://raw.githubusercontent.com/pranjal-joshi/Screeni-py/new-features/screenshots/done.png)
![screening](screenshots/screening.png)
![results](screenshots/results.png)
![done](screenshots/done.png)

* Once done, you can also save the results in an Excel file.

## Understanding the Result Table:
## Understanding the Result Table

The Result table contains a lot of different parameters which can be pretty overwhelming to the new users, so here's the description and significance of each parameter.

Expand All @@ -74,9 +73,11 @@ The Result table contains a lot of different parameters which can be pretty over
|8|**Trend**|By using advanced algorithms, the average trendlines are computed for `N` days and their strength is displayed depending on the steepness of the trendlines. (This does NOT show any trendline on a chart, it is calculated internally)|`Strong Up`, `Weak Down` etc.|
|9|**Pattern**|If the chart or the candle itself forming any important pattern in the recent timeframe or as per the selected screening option, various important patterns will be indicated here.|`Momentum Gainer`, `Inside Bar (N)`,`Bullish Engulfing` etc.|

## Hack it your way:
## Hack it your way

Feel free to Edit the parameters in the `screenipy.ini` file which will be generated by the application.
```

```ini
[config]
period = 300d
daystolookback = 30
Expand All @@ -90,31 +91,31 @@ cachestockdata = y
onlystagetwostocks = y
useema = n
```

Try to tweak these parameters as per your trading styles. For example, If you're comfortable with weekly charts, make `duration=5d` and so on.

## Installation Guide:
## Installation Guide

**YouTube Video of Detailed Installation Guide**
### YouTube Video of Detailed Installation Guide

[![YouTube Video Views](https://img.shields.io/youtube/views/2HMN0ac4H20?style=for-the-badge&logo=youtube)](https://youtu.be/2HMN0ac4H20)


[![Screeni-py - Detailed Installation Guide](https://markdown-videos-api.jorgenkh.no/url?url=https%3A%2F%2Fyoutu.be%2F2HMN0ac4H20)](https://youtu.be/2HMN0ac4H20)

![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)

**Why we shifted to Docker from the Good old EXEs?**
### Why we shifted to Docker from the Good old EXEs?

| 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) |
| [![GitHub Downloads](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 (DEPRECATED) | 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 |
| You may face errors/warnings due to different CPU arch of your system ⚠️ | Compatible with all x86_64/amd64/arm64 CPUs irrespective of OS (including Mac M1/M2) |
| 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 |
| 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 |
| Incompatible with Vector Database ⚠️ | Compatible with all Python libraries |
Expand All @@ -127,8 +128,9 @@ Try to tweak these parameters as per your trading styles. For example, If you're
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 -p 8501:8501 joshipranjal/screeni-py:latest

```bash
docker run -p 8501:8501 -p 8000:8000 joshipranjal/screeni-py:latest

OR

Expand All @@ -137,11 +139,13 @@ Try to tweak these parameters as per your trading styles. For example, If you're

Check out this [YouTube Video](https://youtu.be/2HMN0ac4H20) for a detailed installation guide.

## Contributing:
## Contributing

* Please feel free to Suggest improvements/report 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.

## Disclaimer:
## Disclaimer

* DO NOT use the result provided by the software 'solely' to make your trading decisions.
* Always backtest and analyze the stocks manually before you trade.
* The Author and the software will not be held liable for your losses.
5 changes: 0 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@ pep517
pip
pip-chill
progress
# pyinstaller==5.6.2
pytest-mock
pytoml
retrying
scipy==1.11.2
# ta-lib
TA-Lib-Precompiled
tabulate
# yfinance==0.1.87
yfinance==0.2.32
alive-progress==1.6.2
Pillow
Expand Down Expand Up @@ -60,9 +57,7 @@ toml # Installed as dependency for pep517, pytest
urllib3 # Installed as dependency for requests
webencodings # Installed as dependency for html5lib
pandas_ta
# protobuf==3.19.6
protobuf
# streamlit==1.26.0
streamlit
tensorflow
chromadb==0.4.10
Expand Down
5 changes: 4 additions & 1 deletion 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 = "2.24"
VERSION = "2.25"

changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + '''
[1.00 - Beta]
Expand Down Expand Up @@ -299,4 +299,7 @@
[2.24]
1. Added Filters to Result Table (Special Thanks to https://github.com/koalyptus/TableFilter)
[2.25]
1. Reduced docker image size by 50% (Special Thanks to https://github.com/smitpsanghavi)
''' + colorText.END
4 changes: 2 additions & 2 deletions src/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Screeni-py is now on **YouTube** for additional help! - Thank You for your suppo
| | Tag | Pull Command | Run Mode | Run Command |
|:-: | :-: | --- | --- | --- |
| ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white) | `latest` | `docker pull joshipranjal/screeni-py:latest` | Command Line | `docker run -it --entrypoint /bin/bash joshipranjal/screeni-py:latest -c "run_screenipy.sh --cli"` |
| ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white) | `latest` | `docker pull joshipranjal/screeni-py:latest` | GUI WebApp | `docker run -p 8501:8501 joshipranjal/screeni-py:latest` |
| ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white) | `latest` | `docker pull joshipranjal/screeni-py:latest` | GUI WebApp | `docker run -p 8501:8501 -p 8000:8000 joshipranjal/screeni-py:latest` |
| ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white) | `dev` | `docker pull joshipranjal/screeni-py:dev` | Command Line | `docker run -it --entrypoint /bin/bash joshipranjal/screeni-py:dev -c "run_screenipy.sh --cli"` |
| ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white) | `dev` | `docker pull joshipranjal/screeni-py:dev` | GUI WebApp | `docker run -p 8501:8501 joshipranjal/screeni-py:dev` |
| ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white) | `dev` | `docker pull joshipranjal/screeni-py:dev` | GUI WebApp | `docker run -p 8501:8501 -p 8000:8000 joshipranjal/screeni-py:dev` |

### Docker Issues? Troubleshooting Guide:

Expand Down
9 changes: 9 additions & 0 deletions src/streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,15 @@ def get_extra_inputs(tickerOption, executeOption, c_index=None, c_criteria=None,
else:
execute_inputs = [tickerOption, executeOption, select_pattern, 'N']

header_padding = """
<style>
header {
padding-bottom: 16px;
}
</style>
"""
st.markdown(header_padding, unsafe_allow_html=True)

ac, bc = st.columns([13,1])

ac.title('📈 Screeni-py')
Expand Down

0 comments on commit 2f05a50

Please sign in to comment.