Skip to content

Commit 7e26470

Browse files
committed
find latest version is now robust to use of "-" and "_" without distinction
1 parent d546d5d commit 7e26470

5 files changed

Lines changed: 273 additions & 2 deletions

File tree

src/dac/_version_management.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ def find_latest_version(pkg_name: str, major: Optional[int] = None) -> str:
1616
],
1717
stderr=subprocess.DEVNULL,
1818
)
19-
last_line = output.decode("utf-8").splitlines()[-1]
19+
output_lines = output.decode("utf-8").splitlines()
20+
would_install_line = [line for line in output_lines if "Would install" in line][0]
2021
regex_rule = f"{pkg_name.replace('_', '-')}-{major if major is not None else ''}.[^ ]+"
21-
match = re.search(regex_rule, last_line)
22+
match = re.search(regex_rule, would_install_line.replace("_", "-"))
2223
assert match is not None
2324
return match[0][len(f"{pkg_name}-") :]
2425

test/data/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ def get_sample_pandas_df() -> pd.DataFrame:
8989
)
9090

9191

92+
def get_pip_log_with_dash() -> str:
93+
return (Path(__file__).parent / "pip_log" / "log_for_investing_algorithm_framework_with_dash.txt").read_text()
94+
95+
96+
def get_pip_log_with_underscore() -> str:
97+
return (Path(__file__).parent / "pip_log" / "log_for_investing_algorithm_framework_with_underscore.txt").read_text()
98+
99+
92100
def generate_random_project_name() -> str:
93101
return "".join(random.choice(string.ascii_lowercase) for _ in range(16))
94102

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
Looking in indexes: https://****:****@****/simple, https://pypi.org/simple
2+
Collecting investing-algorithm-framework
3+
Downloading investing_algorithm_framework-2.3.2-py3-none-any.whl.metadata (29 kB)
4+
Requirement already satisfied: wrapt>=1.11.2 in ./venv/lib/python3.10/site-packages (from investing-algorithm-framework) (1.15.0)
5+
Collecting Flask>=2.3.2 (from investing-algorithm-framework)
6+
Downloading flask-3.0.2-py3-none-any.whl.metadata (3.6 kB)
7+
Collecting Flask-Migrate>=2.6.0 (from investing-algorithm-framework)
8+
Downloading Flask_Migrate-4.0.5-py3-none-any.whl.metadata (3.1 kB)
9+
Collecting Flask-Cors>=3.0.9 (from investing-algorithm-framework)
10+
Downloading Flask_Cors-4.0.0-py2.py3-none-any.whl.metadata (5.4 kB)
11+
Collecting SQLAlchemy>=2.0.18 (from investing-algorithm-framework)
12+
Downloading SQLAlchemy-2.0.26-cp310-cp310-macosx_11_0_arm64.whl.metadata (9.6 kB)
13+
Collecting marshmallow>=3.5.0 (from investing-algorithm-framework)
14+
Using cached marshmallow-3.20.2-py3-none-any.whl.metadata (7.5 kB)
15+
Requirement already satisfied: setuptools>=60.9.0 in ./venv/lib/python3.10/site-packages (from investing-algorithm-framework) (68.0.0)
16+
Collecting ccxt>=3.0.57 (from investing-algorithm-framework)
17+
Downloading ccxt-4.2.44-py2.py3-none-any.whl.metadata (107 kB)
18+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 107.6/107.6 kB 8.1 MB/s eta 0:00:00
19+
Requirement already satisfied: python-dateutil>=2.8.2 in ./venv/lib/python3.10/site-packages (from investing-algorithm-framework) (2.8.2)
20+
Requirement already satisfied: MarkupSafe>=2.1.2 in ./venv/lib/python3.10/site-packages (from investing-algorithm-framework) (2.1.3)
21+
Collecting dependency-injector>=4.40.0 (from investing-algorithm-framework)
22+
Downloading dependency-injector-4.41.0.tar.gz (913 kB)
23+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 913.2/913.2 kB 29.1 MB/s eta 0:00:00
24+
Preparing metadata (setup.py) ... done
25+
Collecting schedule>=1.1.0 (from investing-algorithm-framework)
26+
Downloading schedule-1.2.1-py2.py3-none-any.whl.metadata (3.3 kB)
27+
Requirement already satisfied: pandas>=2.0.0 in ./venv/lib/python3.10/site-packages (from investing-algorithm-framework) (2.1.4)
28+
Collecting tqdm>=4.66.1 (from investing-algorithm-framework)
29+
Downloading tqdm-4.66.2-py3-none-any.whl.metadata (57 kB)
30+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.6/57.6 kB 7.5 MB/s eta 0:00:00
31+
Collecting tabulate>=0.9.0 (from investing-algorithm-framework)
32+
Using cached tabulate-0.9.0-py3-none-any.whl (35 kB)
33+
Collecting polars==0.20.5 (from polars[numpy,pandas]==0.20.5->investing-algorithm-framework)
34+
Downloading polars-0.20.5-cp38-abi3-macosx_11_0_arm64.whl.metadata (15 kB)
35+
Requirement already satisfied: numpy>=1.16.0 in ./venv/lib/python3.10/site-packages (from polars[numpy,pandas]==0.20.5->investing-algorithm-framework) (1.26.1)
36+
Requirement already satisfied: pyarrow>=7.0.0 in ./venv/lib/python3.10/site-packages (from polars[numpy,pandas]==0.20.5->investing-algorithm-framework) (11.0.0)
37+
Requirement already satisfied: certifi>=2018.1.18 in ./venv/lib/python3.10/site-packages (from ccxt>=3.0.57->investing-algorithm-framework) (2023.7.22)
38+
Requirement already satisfied: requests>=2.18.4 in ./venv/lib/python3.10/site-packages (from ccxt>=3.0.57->investing-algorithm-framework) (2.28.2)
39+
Requirement already satisfied: cryptography>=2.6.1 in ./venv/lib/python3.10/site-packages (from ccxt>=3.0.57->investing-algorithm-framework) (41.0.7)
40+
Requirement already satisfied: typing-extensions>=4.4.0 in ./venv/lib/python3.10/site-packages (from ccxt>=3.0.57->investing-algorithm-framework) (4.8.0)
41+
Requirement already satisfied: aiohttp>=3.8 in ./venv/lib/python3.10/site-packages (from ccxt>=3.0.57->investing-algorithm-framework) (3.9.1)
42+
Collecting aiodns>=1.1.1 (from ccxt>=3.0.57->investing-algorithm-framework)
43+
Downloading aiodns-3.1.1-py3-none-any.whl.metadata (4.0 kB)
44+
Requirement already satisfied: yarl>=1.7.2 in ./venv/lib/python3.10/site-packages (from ccxt>=3.0.57->investing-algorithm-framework) (1.9.4)
45+
Requirement already satisfied: six<=1.16.0,>=1.7.0 in ./venv/lib/python3.10/site-packages (from dependency-injector>=4.40.0->investing-algorithm-framework) (1.16.0)
46+
Collecting Werkzeug>=3.0.0 (from Flask>=2.3.2->investing-algorithm-framework)
47+
Downloading werkzeug-3.0.1-py3-none-any.whl.metadata (4.1 kB)
48+
Requirement already satisfied: Jinja2>=3.1.2 in ./venv/lib/python3.10/site-packages (from Flask>=2.3.2->investing-algorithm-framework) (3.1.2)
49+
Collecting itsdangerous>=2.1.2 (from Flask>=2.3.2->investing-algorithm-framework)
50+
Using cached itsdangerous-2.1.2-py3-none-any.whl (15 kB)
51+
Requirement already satisfied: click>=8.1.3 in ./venv/lib/python3.10/site-packages (from Flask>=2.3.2->investing-algorithm-framework) (8.1.6)
52+
Collecting blinker>=1.6.2 (from Flask>=2.3.2->investing-algorithm-framework)
53+
Downloading blinker-1.7.0-py3-none-any.whl.metadata (1.9 kB)
54+
Collecting Flask-SQLAlchemy>=1.0 (from Flask-Migrate>=2.6.0->investing-algorithm-framework)
55+
Downloading flask_sqlalchemy-3.1.1-py3-none-any.whl.metadata (3.4 kB)
56+
Collecting alembic>=1.9.0 (from Flask-Migrate>=2.6.0->investing-algorithm-framework)
57+
Using cached alembic-1.13.1-py3-none-any.whl.metadata (7.4 kB)
58+
Requirement already satisfied: packaging>=17.0 in ./venv/lib/python3.10/site-packages (from marshmallow>=3.5.0->investing-algorithm-framework) (23.2)
59+
Requirement already satisfied: pytz>=2020.1 in ./venv/lib/python3.10/site-packages (from pandas>=2.0.0->investing-algorithm-framework) (2023.3.post1)
60+
Requirement already satisfied: tzdata>=2022.1 in ./venv/lib/python3.10/site-packages (from pandas>=2.0.0->investing-algorithm-framework) (2023.4)
61+
Collecting pycares>=4.0.0 (from aiodns>=1.1.1->ccxt>=3.0.57->investing-algorithm-framework)
62+
Downloading pycares-4.4.0-cp310-cp310-macosx_10_9_universal2.whl.metadata (4.1 kB)
63+
Requirement already satisfied: attrs>=17.3.0 in ./venv/lib/python3.10/site-packages (from aiohttp>=3.8->ccxt>=3.0.57->investing-algorithm-framework) (23.2.0)
64+
Requirement already satisfied: multidict<7.0,>=4.5 in ./venv/lib/python3.10/site-packages (from aiohttp>=3.8->ccxt>=3.0.57->investing-algorithm-framework) (6.0.4)
65+
Requirement already satisfied: frozenlist>=1.1.1 in ./venv/lib/python3.10/site-packages (from aiohttp>=3.8->ccxt>=3.0.57->investing-algorithm-framework) (1.4.1)
66+
Requirement already satisfied: aiosignal>=1.1.2 in ./venv/lib/python3.10/site-packages (from aiohttp>=3.8->ccxt>=3.0.57->investing-algorithm-framework) (1.3.1)
67+
Requirement already satisfied: async-timeout<5.0,>=4.0 in ./venv/lib/python3.10/site-packages (from aiohttp>=3.8->ccxt>=3.0.57->investing-algorithm-framework) (4.0.3)
68+
Collecting Mako (from alembic>=1.9.0->Flask-Migrate>=2.6.0->investing-algorithm-framework)
69+
Downloading Mako-1.3.2-py3-none-any.whl.metadata (2.9 kB)
70+
Requirement already satisfied: cffi>=1.12 in ./venv/lib/python3.10/site-packages (from cryptography>=2.6.1->ccxt>=3.0.57->investing-algorithm-framework) (1.16.0)
71+
Requirement already satisfied: charset-normalizer<4,>=2 in ./venv/lib/python3.10/site-packages (from requests>=2.18.4->ccxt>=3.0.57->investing-algorithm-framework) (3.2.0)
72+
Requirement already satisfied: idna<4,>=2.5 in ./venv/lib/python3.10/site-packages (from requests>=2.18.4->ccxt>=3.0.57->investing-algorithm-framework) (3.4)
73+
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./venv/lib/python3.10/site-packages (from requests>=2.18.4->ccxt>=3.0.57->investing-algorithm-framework) (1.26.18)
74+
Requirement already satisfied: pycparser in ./venv/lib/python3.10/site-packages (from cffi>=1.12->cryptography>=2.6.1->ccxt>=3.0.57->investing-algorithm-framework) (2.21)
75+
Downloading investing_algorithm_framework-2.3.2-py3-none-any.whl (115 kB)
76+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 115.4/115.4 kB 17.1 MB/s eta 0:00:00
77+
Downloading polars-0.20.5-cp38-abi3-macosx_11_0_arm64.whl (24.4 MB)
78+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 24.4/24.4 MB 25.2 MB/s eta 0:00:00
79+
Downloading ccxt-4.2.44-py2.py3-none-any.whl (4.2 MB)
80+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 27.0 MB/s eta 0:00:00
81+
Downloading flask-3.0.2-py3-none-any.whl (101 kB)
82+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 101.3/101.3 kB 12.5 MB/s eta 0:00:00
83+
Downloading Flask_Cors-4.0.0-py2.py3-none-any.whl (14 kB)
84+
Downloading Flask_Migrate-4.0.5-py3-none-any.whl (21 kB)
85+
Using cached marshmallow-3.20.2-py3-none-any.whl (49 kB)
86+
Downloading schedule-1.2.1-py2.py3-none-any.whl (11 kB)
87+
Downloading SQLAlchemy-2.0.26-cp310-cp310-macosx_11_0_arm64.whl (2.1 MB)
88+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 25.2 MB/s eta 0:00:00
89+
Downloading tqdm-4.66.2-py3-none-any.whl (78 kB)
90+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.3/78.3 kB 11.9 MB/s eta 0:00:00
91+
Downloading aiodns-3.1.1-py3-none-any.whl (5.4 kB)
92+
Using cached alembic-1.13.1-py3-none-any.whl (233 kB)
93+
Downloading blinker-1.7.0-py3-none-any.whl (13 kB)
94+
Downloading flask_sqlalchemy-3.1.1-py3-none-any.whl (25 kB)
95+
Downloading werkzeug-3.0.1-py3-none-any.whl (226 kB)
96+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 226.7/226.7 kB 17.4 MB/s eta 0:00:00
97+
Downloading pycares-4.4.0-cp310-cp310-macosx_10_9_universal2.whl (136 kB)
98+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 136.8/136.8 kB 18.0 MB/s eta 0:00:00
99+
Downloading Mako-1.3.2-py3-none-any.whl (78 kB)
100+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.7/78.7 kB 10.4 MB/s eta 0:00:00
101+
Would install Flask-3.0.2 Flask-Cors-4.0.0 Flask-Migrate-4.0.5 Flask-SQLAlchemy-3.1.1 Mako-1.3.2 SQLAlchemy-2.0.26 Werkzeug-3.0.1 aiodns-3.1.1 alembic-1.13.1 blinker-1.7.0 ccxt-4.2.44 dependency-injector-4.41.0 investing-algorithm-framework-2.3.2 itsdangerous-2.1.2 marshmallow-3.20.2 polars-0.20.5 pycares-4.4.0 schedule-1.2.1 tabulate-0.9.0 tqdm-4.66.2
102+
103+
[notice] A new release of pip is available: 23.3.2 -> 24.0
104+
[notice] To update, run: pip install --upgrade pip

0 commit comments

Comments
 (0)