Skip to content

Commit e7d3f47

Browse files
authored
fix version lookup (#125)
2 parents d04aad0 + a5d2942 commit e7d3f47

4 files changed

Lines changed: 26 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
Notable changes to this project.
33

44

5+
## [2.23.1] - 2026-04-23
6+
- fix package version lookup
7+
8+
59
## [2.22.0] - 2026-01-05
610
-- added `get_leaderboard` for crypto tournament
711

numerapi/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
from importlib.metadata import version, PackageNotFoundError
44

55
try:
6-
__version__ = version("package-name")
6+
__version__ = version("numerapi")
77
except PackageNotFoundError:
8-
__version__ = 'unknown'
8+
__version__ = "unknown"
99

1010

1111
# pylint: disable=wrong-import-position

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def load(path):
55
return open(path, "r").read()
66

77

8-
numerapi_version = "2.23.0"
8+
numerapi_version = "2.23.1"
99

1010

1111
classifiers = [

tests/test_cli.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import importlib
2+
import importlib.metadata
13
import os
24
import pytest
35
from click.testing import CliRunner
46
from unittest.mock import patch
57

8+
import numerapi
69
from numerapi import cli
710

811

@@ -117,3 +120,19 @@ def test_version():
117120
result = CliRunner().invoke(cli.version)
118121
# just testing if calling works fine
119122
assert result.exit_code == 0
123+
124+
125+
def test_version_uses_numerapi_distribution_name(monkeypatch):
126+
called_package_names = []
127+
128+
def mock_version(package_name):
129+
called_package_names.append(package_name)
130+
return "2.23.1"
131+
132+
with monkeypatch.context() as context:
133+
context.setattr(importlib.metadata, "version", mock_version)
134+
importlib.reload(numerapi)
135+
assert called_package_names == ["numerapi"]
136+
assert numerapi.__version__ == "2.23.1"
137+
138+
importlib.reload(numerapi)

0 commit comments

Comments
 (0)