python-quanta 0.2.2__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_quanta-0.2.2 → python_quanta-0.2.4}/PKG-INFO +1 -1
- {python_quanta-0.2.2 → python_quanta-0.2.4}/pyproject.toml +2 -3
- {python_quanta-0.2.2 → python_quanta-0.2.4}/src/python_quanta.egg-info/PKG-INFO +1 -1
- {python_quanta-0.2.2 → python_quanta-0.2.4}/src/python_quanta.egg-info/SOURCES.txt +3 -1
- python_quanta-0.2.4/src/quanta/__init__.py +0 -0
- python_quanta-0.2.4/src/quanta/config/__init__.py +1 -0
- python_quanta-0.2.4/src/quanta/config/_internal.py +94 -0
- python_quanta-0.2.2/src/quanta/__init__.py +0 -1
- {python_quanta-0.2.2 → python_quanta-0.2.4}/README.md +0 -0
- {python_quanta-0.2.2 → python_quanta-0.2.4}/setup.cfg +0 -0
- {python_quanta-0.2.2 → python_quanta-0.2.4}/src/python_quanta.egg-info/dependency_links.txt +0 -0
- {python_quanta-0.2.2 → python_quanta-0.2.4}/src/python_quanta.egg-info/requires.txt +0 -0
- {python_quanta-0.2.2 → python_quanta-0.2.4}/src/python_quanta.egg-info/top_level.txt +0 -0
- {python_quanta-0.2.2 → python_quanta-0.2.4}/src/quanta/duckui.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-quanta
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: A quantitative analysis project for financial data.
|
|
5
5
|
Author-email: Porco Rosso <porcorossobaojiel@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/porcorossobaojie/quanta.git
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# D:\codes\quanta\pyproject.toml
|
|
2
2
|
[project]
|
|
3
3
|
name = "python-quanta" # 你的项目名称,建议与你的顶级包名(例如 src/quanta)一致
|
|
4
|
-
version = "0.2.
|
|
4
|
+
version = "0.2.4" # 项目版本号
|
|
5
5
|
description = "A quantitative analysis project for financial data." # 项目的简短描述
|
|
6
6
|
readme = "README.md" # 指向你的 README 文件
|
|
7
7
|
requires-python = ">=3.9" # 项目所需的 Python 版本
|
|
@@ -54,8 +54,7 @@ build-backend = "setuptools.build_meta"
|
|
|
54
54
|
# 告诉 setuptools 在 'src' 目录中查找包
|
|
55
55
|
# 如果你的代码是直接放在 src/quanta 这样的结构下,且 quanta 是顶层包名
|
|
56
56
|
package-dir = {"" = "src"}
|
|
57
|
-
packages = ["
|
|
58
|
-
# packages = {find = {where = ["src"]}}
|
|
57
|
+
packages = {find = {where = ["src"]}}
|
|
59
58
|
|
|
60
59
|
# 其他工具的配置,例如 Black
|
|
61
60
|
[tool.black]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-quanta
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: A quantitative analysis project for financial data.
|
|
5
5
|
Author-email: Porco Rosso <porcorossobaojiel@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/porcorossobaojie/quanta.git
|
|
@@ -6,4 +6,6 @@ src/python_quanta.egg-info/dependency_links.txt
|
|
|
6
6
|
src/python_quanta.egg-info/requires.txt
|
|
7
7
|
src/python_quanta.egg-info/top_level.txt
|
|
8
8
|
src/quanta/__init__.py
|
|
9
|
-
src/quanta/duckui.py
|
|
9
|
+
src/quanta/duckui.py
|
|
10
|
+
src/quanta/config/__init__.py
|
|
11
|
+
src/quanta/config/_internal.py
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from ._internal import *
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created on Tue Feb 10 17:22:33 2026
|
|
4
|
+
|
|
5
|
+
@author: Porco Rosso
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from dotenv import load_dotenv, find_dotenv # Import dotenv functions
|
|
11
|
+
from box import Box
|
|
12
|
+
import yaml
|
|
13
|
+
|
|
14
|
+
# Load environment variables from .env file, searching from the current working directory
|
|
15
|
+
load_dotenv(find_dotenv(usecwd=True))
|
|
16
|
+
|
|
17
|
+
MODULE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
18
|
+
|
|
19
|
+
def _find_project_root_containing_env_folder():
|
|
20
|
+
"""
|
|
21
|
+
Finds the project root by searching upwards from the current working directory
|
|
22
|
+
for a directory that contains a '.env' folder.
|
|
23
|
+
"""
|
|
24
|
+
current_dir = Path(os.getcwd())
|
|
25
|
+
while True:
|
|
26
|
+
if (current_dir / '.env').is_dir():
|
|
27
|
+
return current_dir
|
|
28
|
+
|
|
29
|
+
# Stop if we reach the filesystem root or the drive root
|
|
30
|
+
if current_dir == current_dir.parent:
|
|
31
|
+
break
|
|
32
|
+
|
|
33
|
+
current_dir = current_dir.parent
|
|
34
|
+
|
|
35
|
+
# Fallback: if no '.env' folder found, use the current working directory
|
|
36
|
+
return Path(os.getcwd())
|
|
37
|
+
|
|
38
|
+
PROJECT_ROOT = _find_project_root_containing_env_folder()
|
|
39
|
+
|
|
40
|
+
def _yaml_config(files):
|
|
41
|
+
config = Box(default_box=False)
|
|
42
|
+
for i in files:
|
|
43
|
+
with open(str(i), 'r', encoding = 'utf-8') as f:
|
|
44
|
+
x = yaml.safe_load_all(f)
|
|
45
|
+
for j in x:
|
|
46
|
+
if j:
|
|
47
|
+
config.merge_update(j)
|
|
48
|
+
return config
|
|
49
|
+
|
|
50
|
+
__all__ = ['settings', 'login_info']
|
|
51
|
+
|
|
52
|
+
def settings(yaml_file, env_file=None):
|
|
53
|
+
if yaml_file[-5:].lower() != '.yaml':
|
|
54
|
+
yaml_file = f"{yaml_file}.yaml"
|
|
55
|
+
|
|
56
|
+
config_files = []
|
|
57
|
+
|
|
58
|
+
# 1. Add default config file from quanta package
|
|
59
|
+
default_config_path = Path(MODULE_DIR) / yaml_file
|
|
60
|
+
if default_config_path.is_file():
|
|
61
|
+
config_files.append(default_config_path)
|
|
62
|
+
|
|
63
|
+
# 2. Add override config file from project's .env folder
|
|
64
|
+
override_filename = yaml_file if env_file is None else env_file
|
|
65
|
+
override_config_path = PROJECT_ROOT / '.env' / override_filename
|
|
66
|
+
if override_config_path.is_file():
|
|
67
|
+
config_files.append(override_config_path)
|
|
68
|
+
|
|
69
|
+
if not config_files:
|
|
70
|
+
raise FileNotFoundError(f"No configuration files found for '{yaml_file}' in quanta or project's .env folder.")
|
|
71
|
+
|
|
72
|
+
base = _yaml_config(config_files)
|
|
73
|
+
return base
|
|
74
|
+
|
|
75
|
+
def login_info(env_file):
|
|
76
|
+
if env_file[-5:].lower() != '.yaml':
|
|
77
|
+
env_file = f"{env_file}.yaml"
|
|
78
|
+
|
|
79
|
+
config_files = []
|
|
80
|
+
|
|
81
|
+
# This function seems specifically designed to load from the project's .env folder
|
|
82
|
+
# However, if there's a default login_info.yaml in quanta/config, we should include it first.
|
|
83
|
+
# For now, let's assume login_info only comes from the project's .env folder as per original intent.
|
|
84
|
+
# If there's a default, it would be Path(MODULE_DIR) / env_file
|
|
85
|
+
|
|
86
|
+
override_config_path = PROJECT_ROOT / '.env' / env_file
|
|
87
|
+
if override_config_path.is_file():
|
|
88
|
+
config_files.append(override_config_path)
|
|
89
|
+
|
|
90
|
+
if not config_files:
|
|
91
|
+
raise FileNotFoundError(f"Login info file '{env_file}' not found in project's .env folder.")
|
|
92
|
+
|
|
93
|
+
base = _yaml_config(config_files)
|
|
94
|
+
return base
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .config._internal import settings, login_info
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|