При выполнении некоторых модульных тестов при попытке импорта по абсолютному пути возникла следующая ошибка:
Код: Выделить всё
tests/unit/test_parameter_combinations.py:3: in
from TradingPlatform.core.parameter_combinations import ParameterCombinations
E ModuleNotFoundError: No module named 'TradingPlatform'
Я также хотел отправить это в пакете будущее.
Я создал следующий файл toml:
Код: Выделить всё
[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "TradingPlatform"
version = "0.1.0"
description = "A platform for trading infrastructure and strategy testing."
dependencies = [
"pandas",
"numpy",
"scikit-learn",
"statsmodels",
]
[tool.setuptools]
packages = ["TradingPlatform"]
[tools.setuptools.packages.find]
where = ["."]
include = ["TradingPlatform*"]
Код: Выделить всё
TradingPlatform
├── __init__.py
├── core
│ ├── __init__.py
│ ├── base_trading_strategy.py
├── notebooks
│ └── main.ipynb
├── pyproject.toml
├── tests
│ ├── integration
│ │ └── __init__.py
│ └── unit
│ ├── __init__.py
│ └── test_strategy_performance_evaluation.py
└── utils
├── __init__.py
├── helper_funcs.py
└── logging_setup.py
Что я пробовал h1>
Я уже давно застрял на этой ошибке, пытаясь перенастроить файл toml, удалив и переустановив пакет, но безрезультатно. Ниже приведены несколько различных конфигураций файлов toml, которые я пробовал:
1.
Код: Выделить всё
[tool.setuptools]
packages = ["TradingPlatform", "TradingPlatform.core", "TradingPlatform.utils", "TradingPlatform.tests"]
[tool.setuptools.package-dir]
# Explicitly tell setuptools where to find the root package directory
TradingPlatform = "TradingPlatform"
Код: Выделить всё
[tool.setuptools]
packages = ["TradingPlatform", "TradingPlatform.core", "TradingPlatform.utils", "TradingPlatform.tests"]
Код: Выделить всё
[tool.setuptools.packages.find]
where = ["."]
Код: Выделить всё
core
tests
utils
Я совершенно не знаком с доставкой посылки, поэтому буду очень признателен за любые советы по решению этой проблемы. Если я могу предоставить дополнительную информацию, пожалуйста, дайте мне знать.
Подробнее здесь: https://stackoverflow.com/questions/792 ... oject-toml
Мобильная версия