Skip to content
Merged
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
11 changes: 8 additions & 3 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential

pip3 install --upgrade pip
pip3 install pylint
for f in $(find -type f -name "requirements.txt"); do
pip3 install -r $f
done

- name: Analyzing the python code
run: |
set -ex
export PYTHONPATH=$PWD/src/tia/
find . -type f -name "*.py" | xargs pylint
export PYTHONPATH=$PWD/src/gentrade/
make lint
7 changes: 2 additions & 5 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ recursive=no
# source root.
source-roots=

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
Expand Down Expand Up @@ -457,7 +453,8 @@ disable=raw-checker-failed,
import-error,
duplicate-code,
redefined-outer-name,
logging-fstring-interpolation
logging-fstring-interpolation,
abstract-class-instantiated

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
56 changes: 56 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

CURRENT_DIR := $(shell pwd)

PYTHON_VERSION := "3.11"
PYTHON_VERSION_OK := $(shell python -c "import sys; print(sys.version_info >= (3,11) and sys.version_info < (3,12))")

# Pylint configuration
PYLINT_ARGS = --rcfile=.pylintrc
PYLINT_VERSION = 4.0.4
PYLINT_INSTALLED := $(shell python -c "import pkg_resources; print('pylint' in {pkg.key for pkg in pkg_resources.working_set})" 2>/dev/null || echo "False")
PYLINT_VERSION_OK := $(shell python -c "import pylint; print(pylint.__version__ == '$(PYLINT_VERSION)')" 2>/dev/null || echo "False")

# Default target
all: lint

ensure-pylint:
@if [ "$(PYLINT_INSTALLED)" = "False" ] || [ "$(PYLINT_VERSION_OK)" = "False" ]; then \
echo "Installing/upgrading pylint to version $(PYLINT_VERSION)..."; \
pip install pylint=="$(PYLINT_VERSION)"; \
else \
echo "✅ pylint $(PYLINT_VERSION) is already installed"; \
fi

# Lint all Python files
lint: check-python ensure-pylint
@echo "Running Pylint ..."
@export PYTHONPATH=$(CURRENT_DIR)/src
find . -type f -name "*.py" | xargs pylint $(PYLINT_ARGS)

# Lint specific file(s)
lint-file:
@if [ -z "$(FILE)" ]; then \
echo "Usage: make lint-file FILE=path/to/file.py"; \
exit 1; \
fi
pip install pylint=="$(PYLINT_VERSION)"
pylint $(PYLINT_ARGS) $(FILE)

# Check python version
check-python:
@echo "Checking Python version..."
@if [ "$(PYTHON_VERSION_OK)" = "True" ]; then \
echo "✅ Python version is $(PYTHON_VERSION) (compatible)"; \
else \
echo "❌ Error: Python $(PYTHON_VERSION) is required (found $(shell python --version | cut -d' ' -f2))"; \
exit 1; \
fi

# Clean up
clean:
@echo "Cleaning in: $(CURRENT_DIR)..."
find $(CURRENT_DIR) -type d -name "__pycache__" -exec rm -rf {} +
find $(CURRENT_DIR) -type f -name "*.pyc" -delete
find $(CURRENT_DIR) -type f -name ".pylint-cache" -exec rm -rf {} +

.PHONY: all lint lint-file clean check-python ensure-pylint
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ backtrader
ag2
mplfinance
ntplib
loguru

langchain_openai
langchain_core
langchain_tavily
langchain
langgraph

lxml[html_clean]
newspaper3k
4 changes: 2 additions & 2 deletions src/gentrade/llm/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
from pydantic import Field

from langchain_openai import ChatOpenAI
from langchain.schema import (
from langchain_core.messages import (
AIMessage,
BaseMessage
)
from langchain.schema.runnable import RunnableConfig
from langchain_core.runnables import RunnableConfig


LOG = logging.getLogger(__name__)
Expand Down
Loading