Skip to content

Commit 3fa17ad

Browse files
committed
update package2
1 parent f18ab78 commit 3fa17ad

7 files changed

Lines changed: 60 additions & 15 deletions

File tree

.github/workflows/debug.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ jobs:
4545
- name: Install minimal dependencies
4646
run: |
4747
python -m pip install --upgrade pip
48-
python -m pip install numpy pandas scipy matplotlib seaborn statsmodels IPython pytest parameterized
48+
# Install core dependencies in order to avoid import issues
49+
python -m pip install numpy
50+
python -m pip install pandas
51+
python -m pip install scipy matplotlib seaborn statsmodels IPython pytest parameterized
4952
python -m pip install -U "git+https://github.com/cloudQuant/empyrical.git"
5053
5154
- name: Install package

.github/workflows/tests.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- name: Install dependencies step by step
4747
shell: bash
4848
run: |
49-
# Install core dependencies first
49+
# Install core dependencies first (in order)
5050
pip install "numpy>=1.11.0" || pip install numpy
5151
pip install "pandas>=0.18.0" || pip install pandas
5252
pip install "scipy>=0.17.0" || pip install scipy
@@ -127,7 +127,10 @@ jobs:
127127
- name: Install core dependencies
128128
run: |
129129
python -m pip install --upgrade pip
130-
pip install numpy pandas scipy matplotlib seaborn statsmodels IPython pytest parameterized
130+
# Install in correct order to avoid import issues
131+
pip install numpy
132+
pip install pandas
133+
pip install scipy matplotlib seaborn statsmodels IPython pytest parameterized
131134
pip install -U "git+https://github.com/cloudQuant/empyrical.git"
132135
133136
- name: Install package
@@ -185,7 +188,10 @@ jobs:
185188
- name: Install dependencies
186189
run: |
187190
python -m pip install --upgrade pip
188-
pip install numpy pandas scipy matplotlib seaborn statsmodels IPython
191+
# Install core dependencies in order
192+
pip install numpy
193+
pip install pandas
194+
pip install scipy matplotlib seaborn statsmodels IPython
189195
pip install -U "git+https://github.com/cloudQuant/empyrical.git"
190196
pip install pytest pytest-cov pytest-xdist parameterized
191197
pip install -e .

CLAUDE.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,24 @@ Alphalens is a performance analysis library for predictive (alpha) stock factors
1010

1111
### Installation
1212
```bash
13-
# Install dependencies (empyrical from git repository)
13+
# Install dependencies (numpy/pandas first, then empyrical from git)
1414
pip install -r requirements.txt
1515

16-
# Or install empyrical manually first:
16+
# Or install manually in correct order:
17+
pip install numpy pandas # Core dependencies first
1718
pip install -U git+https://github.com/cloudQuant/empyrical.git # International
1819
pip install -U git+https://gitee.com/yunjinqi/empyrical.git # China
20+
pip install scipy matplotlib seaborn statsmodels ipython pytest parameterized
1921

2022
# Install alphalens in development mode
2123
pip install -U -e .
2224
```
2325

26+
### Installation Notes
27+
- **Dependency Order**: numpy and pandas must be installed before alphalens to avoid circular import issues during setup.py execution
28+
- **CI/CD Compatibility**: The setup.py has been modified to handle missing dependencies gracefully during automated builds
29+
- **Version Management**: Uses a simplified version system that doesn't require importing the main package during installation
30+
2431
### Running Tests
2532
```bash
2633
# Run all tests with parallel execution

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ Alphalens is a Python library for performance analysis of predictive (alpha) sto
5050
git clone https://github.com/cloudQuant/alphalens.git # International users
5151
git clone https://gitee.com/yunjinqi/alphalens.git # China users
5252

53-
# Install dependencies (empyrical will be installed from git)
53+
# Install dependencies (numpy and pandas first, then empyrical from git)
5454
pip install -r requirements.txt # International users
5555
# pip install -r requirements-cn.txt # China users (uses Gitee mirror)
5656

57-
# Or install empyrical manually first:
57+
# Or install manually in order:
58+
pip install numpy pandas # Install core dependencies first
5859
pip install -U git+https://github.com/cloudQuant/empyrical.git # International users
5960
# pip install -U git+https://gitee.com/yunjinqi/empyrical.git # China users
61+
pip install scipy matplotlib seaborn statsmodels ipython pytest parameterized
6062

6163
# Install alphalens in development mode
6264
pip install -e .
@@ -236,13 +238,15 @@ Alphalens 是一个用于预测性(alpha)股票因子性能分析的 Python
236238
git clone https://github.com/cloudQuant/alphalens.git # 国外用户
237239
git clone https://gitee.com/yunjinqi/alphalens.git # 国内用户
238240

239-
# 安装依赖(empyrical将从git安装
241+
# 安装依赖(先安装numpy和pandas,然后从git安装empyrical
240242
pip install -r requirements-cn.txt # 国内用户(使用Gitee镜像)
241243
# pip install -r requirements.txt # 国外用户
242244

243-
# 或者先手动安装empyrical:
245+
# 或者按顺序手动安装:
246+
pip install numpy pandas # 先安装核心依赖
244247
pip install -U git+https://gitee.com/yunjinqi/empyrical.git # 国内用户
245248
# pip install -U git+https://github.com/cloudQuant/empyrical.git # 国外用户
249+
pip install scipy matplotlib seaborn statsmodels ipython pytest parameterized
246250

247251
# 以开发模式安装 alphalens
248252
pip install -e .

requirements-cn.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
matplotlib
1+
# Core dependencies (install in order)
22
numpy
33
pandas
44
scipy
5+
matplotlib
56
seaborn
67
statsmodels
78
ipython
89
# Install empyrical from Gitee mirror for China users
910
git+https://gitee.com/yunjinqi/empyrical.git
11+
# Test dependencies
1012
pytest
1113
pytest-benchmark
1214
pytest-sugar

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
matplotlib
1+
# Core dependencies (install in order)
22
numpy
33
pandas
44
scipy
5+
matplotlib
56
seaborn
67
statsmodels
78
ipython
89
# Install empyrical from cloudQuant repository
910
# International users: git+https://github.com/cloudQuant/empyrical.git
1011
# China users: git+https://gitee.com/yunjinqi/empyrical.git
1112
git+https://github.com/cloudQuant/empyrical.git
13+
# Test dependencies
1214
pytest
1315
pytest-benchmark
1416
pytest-sugar

setup.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
11
#!/usr/bin/env python
22
from setuptools import setup, find_packages
3-
from alphalens import versioneer
43
import sys
4+
import os
5+
6+
# Simple version management to avoid dependency issues during CI
7+
def get_version():
8+
"""Get version from _version.py or fallback to default"""
9+
try:
10+
# Try to read version from _version.py
11+
version_file = os.path.join(os.path.dirname(__file__), 'alphalens', '_version.py')
12+
if os.path.exists(version_file):
13+
with open(version_file, 'r') as f:
14+
content = f.read()
15+
# Extract version from the file
16+
for line in content.split('\n'):
17+
if line.strip().startswith('version ='):
18+
return line.split('=')[1].strip().strip('"\'')
19+
except:
20+
pass
21+
return "1.0.0+dev"
22+
23+
def get_cmdclass():
24+
"""Return empty cmdclass to avoid versioneer dependency"""
25+
return {}
526

627
long_description = ''
728

@@ -38,8 +59,8 @@
3859
if __name__ == "__main__":
3960
setup(
4061
name='alphalens',
41-
version=versioneer.get_version(),
42-
cmdclass=versioneer.get_cmdclass(),
62+
version=get_version(),
63+
cmdclass=get_cmdclass(),
4364
description='Performance analysis of predictive (alpha) stock factors',
4465
author='Quantopian Inc. and cloudQuant',
4566
author_email='yunjinqi@gmail.com',

0 commit comments

Comments
 (0)