Skip to content

Commit

Permalink
Fixed init file error in project structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco Silva authored and Francisco Silva committed Nov 17, 2024
1 parent 7b8cdb2 commit 2ef1738
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
- name: Run tests
run: |
pytest tests/ -v
pytest
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@ The stock classifier is trained using financial ratios and growth features deriv
chmod +x scripts/install-hooks.sh
./scripts/install-hooks.sh
```
This setup will:
- Format your code using ruff
- Run linting checks
- Check for common issues like trailing whitespace and merge conflicts
- Validate your YAML and TOML files
- Run your pytest suite before each commit
- Verify your poetry configuration

The hooks will run automatically before each commit. If any checks fail, the commit will be blocked until you fix the issues.

To manually run all pre-commit hooks on all files:
```bash
Expand Down
7 changes: 4 additions & 3 deletions notebooks/mock_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[32m2024-11-16 19:34:08.463\u001b[0m | \u001b[32m\u001b[1mSUCCESS \u001b[0m | \u001b[36mdatabase_handler.schema\u001b[0m:\u001b[36mcreate_tables\u001b[0m:\u001b[36m122\u001b[0m - \u001b[32m\u001b[1mTables created successfully\u001b[0m\n"
"\u001b[32m2024-11-17 17:17:05.118\u001b[0m | \u001b[32m\u001b[1mSUCCESS \u001b[0m | \u001b[36mstocksense.database_handler.schema\u001b[0m:\u001b[36mcreate_tables\u001b[0m:\u001b[36m122\u001b[0m - \u001b[32m\u001b[1mTables created successfully\u001b[0m\n"
]
}
],
"source": [
"from pathlib import Path\n",
"\n",
"import polars as pl\n",
"from database_handler import DatabaseHandler\n",
"\n",
"from stocksense.database_handler import DatabaseHandler\n",
"\n",
"FIXTURE_PATH = Path(\"../tests/fixtures\")\n",
"\n",
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies = [
"requests",
"PyYAML",
"numpy",
"polars",
"polars<1.13.0",
"loguru",
"tqdm",
"streamlit",
Expand Down Expand Up @@ -49,8 +49,8 @@ omit = [
[tool.coverage.report]
fail_under = 80

[tool.setuptools.packages.find]
where = ["stocksense"]
[tool.setuptools]
packages = ["stocksense"]

[tool.ruff]
line-length = 100
Expand Down
2 changes: 1 addition & 1 deletion stocksense/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from config.manager import ConfigManager
from .manager import ConfigManager

config = ConfigManager()

Expand Down
5 changes: 3 additions & 2 deletions stocksense/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import click
from model import ModelHandler
from pipeline import ETL, clean, engineer_features

from stocksense.model import ModelHandler
from stocksense.pipeline import ETL, clean, engineer_features


@click.command()
Expand Down
4 changes: 2 additions & 2 deletions stocksense/model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from model.model_handler import ModelHandler
from model.xgboost_model import XGBoostModel
from .model_handler import ModelHandler
from .xgboost_model import XGBoostModel

__all__ = ["XGBoostModel", "ModelHandler"]
5 changes: 3 additions & 2 deletions stocksense/pipeline/etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from typing import Optional

import polars as pl
from config import config
from database_handler import DatabaseHandler
from loguru import logger
from tqdm import tqdm

from stocksense.config import config
from stocksense.database_handler import DatabaseHandler

from .scraper import Scraper

PACKAGE_DIR = Path(__file__).parents[1]
Expand Down
5 changes: 3 additions & 2 deletions stocksense/pipeline/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import numpy as np
import polars as pl
import polars_talib as plta
from config import config
from database_handler import DatabaseHandler
from loguru import logger

from stocksense.config import config
from stocksense.database_handler import DatabaseHandler

DATA_PATH = Path(__file__).parents[1] / "data"
FIXTURE_PATH = Path(__file__).parents[2] / "tests" / "fixtures"

Expand Down
3 changes: 2 additions & 1 deletion stocksense/pipeline/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
import requests
import yfinance as yf
from bs4 import BeautifulSoup as bs
from config import config
from pyrate_limiter import Duration, Limiter, RequestRate
from requests import Session
from requests_cache import CacheMixin, SQLiteCache
from requests_ratelimiter import LimiterMixin, MemoryQueueBucket

from stocksense.config import config

# Suppress logging from the yfinance and requests libraries
logging.getLogger("yfinance").setLevel(logging.CRITICAL)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_demo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from config import config
from stocksense.config import config


def test_config():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_processing.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import datetime as dt

import polars as pl
from config import config
from polars.testing import assert_frame_equal

from stocksense.config import config
from stocksense.pipeline.preprocess import (
clean,
compute_trade_date,
Expand Down

0 comments on commit 2ef1738

Please sign in to comment.