Projektstruktur
Meine Projektstruktur ist wie folgt:Text
Code: Select all
Quant-trading-journey/
├── .gitignore
├── Phase-0/
│ └── Basic financial analysis.ipynb
├── README.md
├── data/
│ ├── spy.pkl
│ └── tickers_20y.pkl
├── pyproject.toml
└── src/
└── quant_utils/
├── __init__.py (empty file)
├── data.py
└── perf.py
pyproject.toml-Inhalt
tomlCode: Select all
[build-system]
requires = ["setuptools>=45", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "quant-trading-journey"
version = "0.1.0"
description = "My journey to become a systematic quant trader"
authors = [{name = "Sergio"}]
[project.optional-dependencies]
full = [
"pandas",
"numpy",
"yfinance",
"matplotlib",
"seaborn",
"plotly",
"vectorbt",
"scikit-learn",
"xgboost",
"jupyter",
"ipykernel"
]
[tool.setuptools.packages.find]
where = ["src"]
include = ["quant_utils*"]
Debugging-Protokolle und verwendete Befehle
Ich habe die Installation in der Eingabeaufforderung ausgeführt:Code: Select all
cd "C:\Users\Sergio\Documents\GitHub\Quant-trading-journey"
"C:\Users\Sergio\AppData\Local\Programs\Python\Python313\python.exe" -m pip install -e .
Code: Select all
Obtaining file:///C:/Users/Sergio/Documents/GitHub/Quant-trading-journey
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: quant-trading-journey
Building editable for quant-trading-journey (pyproject.toml) ... done
Created wheel for quant-trading-journey: filename=quant_trading_journey-0.1.0-0.editable-py3-none-any.whl size=3023 sha256=f20897b37e1fed7f460a0e20d108900424dd3865ff59a20f9e57fc4112fcaee6
Stored in directory: C:\Users\Sergio\AppData\Local\Temp\pip-ephem-wheel-cache-7xr3encu\wheels\69\44\70\524231754e134a85e4dd82010d6ce3613f53070c94d274b02a
Successfully built quant-trading-journey
Installing collected packages: quant-trading-journey
Successfully installed quant-trading-journey-0.1.0
Code: Select all
from quant_utils.data import download_data
Code: Select all
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 1
----> 1 from quant_utils.data import download_data
ModuleNotFoundError: No module named 'quant_utils'
Test mit env PYTHONPATH: Ich habe den Befehl set PYTHONPATH=src;%PYTHONPATH% & "C:\Users\Sergio\AppData\Local\Programs\Python\Python313\python.exe" src\quant_utils\perf.py ausprobiert. Es wurde ohne Fehler oder Ausgabe ausgeführt und kehrte zur Eingabeaufforderung zurück. Zur Bestätigung habe ich perf.py eine print-Anweisung hinzugefügt (print("Hello from perf.py!")), und der Befehl gab „Hello from perf.py!“ aus. erfolgreich.
Zusätzliche Details
- Python-Version: 3.13
- Die Installation gelingt ohne Fehler, aber der Import schlägt fehl, wenn das Notebook in einem Unterverzeichnis wie Phase-0/ verwendet wird.
- Ich habe versucht, das Paket neu zu installieren, Jupyter neu zu starten und Stellen Sie sicher, dass keine alten Installationen vorhanden sind.
- Der Import funktioniert, wenn ich die .py-Dateien in dasselbe Verzeichnis wie das Notebook verschiebe, aber das ist nicht das, was ich für ein modulares Projekt möchte.
GitHub Repo
https://github.com/ImSeekingAlpha/Quant-trading-journeySie werden nicht sehen:
Code: Select all
from quant_utils.data import download_data
Mobile version