numerapi 2.23.0.dev3__tar.gz → 2.23.2__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.
Files changed (25) hide show
  1. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/PKG-INFO +1 -1
  2. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi/__init__.py +2 -2
  3. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi/base_api.py +2 -9
  4. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi/utils.py +4 -2
  5. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi.egg-info/PKG-INFO +1 -1
  6. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/setup.py +1 -1
  7. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/tests/test_base_api.py +3 -3
  8. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/tests/test_cli.py +19 -0
  9. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/LICENSE +0 -0
  10. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/README.md +0 -0
  11. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi/cli.py +0 -0
  12. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi/cryptoapi.py +0 -0
  13. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi/numerapi.py +0 -0
  14. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi/py.typed +0 -0
  15. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi/signalsapi.py +0 -0
  16. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi.egg-info/SOURCES.txt +0 -0
  17. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi.egg-info/dependency_links.txt +0 -0
  18. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi.egg-info/entry_points.txt +0 -0
  19. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi.egg-info/requires.txt +0 -0
  20. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/numerapi.egg-info/top_level.txt +0 -0
  21. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/setup.cfg +0 -0
  22. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/tests/test_cryptoapi.py +0 -0
  23. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/tests/test_numerapi.py +0 -0
  24. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/tests/test_signalsapi.py +0 -0
  25. {numerapi-2.23.0.dev3 → numerapi-2.23.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: numerapi
3
- Version: 2.23.0.dev3
3
+ Version: 2.23.2
4
4
  Summary: Automatically download and upload data for the Numerai machine learning competition
5
5
  Home-page: https://github.com/uuazed/numerapi
6
6
  Maintainer: uuazed
@@ -3,9 +3,9 @@
3
3
  from importlib.metadata import version, PackageNotFoundError
4
4
 
5
5
  try:
6
- __version__ = version("package-name")
6
+ __version__ = version("numerapi")
7
7
  except PackageNotFoundError:
8
- __version__ = 'unknown'
8
+ __version__ = "unknown"
9
9
 
10
10
 
11
11
  # pylint: disable=wrong-import-position
@@ -14,7 +14,6 @@ import requests
14
14
  from numerapi import utils
15
15
 
16
16
  API_TOURNAMENT_URL = "https://api-tournament.numer.ai"
17
- _DEFAULT_TOURNAMENT = object()
18
17
 
19
18
 
20
19
  class Api:
@@ -623,7 +622,6 @@ class Api:
623
622
 
624
623
  def list_rounds(
625
624
  self,
626
- tournament: int | None | object = _DEFAULT_TOURNAMENT,
627
625
  number: int | None = None,
628
626
  target: str | None = None,
629
627
  status: str | None = None,
@@ -632,8 +630,6 @@ class Api:
632
630
  """List rounds with the filters supported by the round resolver.
633
631
 
634
632
  Args:
635
- tournament (int, optional): tournament filter, defaults to the API
636
- instance tournament. Pass `None` to omit the tournament filter
637
633
  number (int, optional): round number filter
638
634
  target (str, optional): round target filter
639
635
  status (str, optional): round status filter. One of `upcoming`,
@@ -677,10 +673,8 @@ class Api:
677
673
  }
678
674
  }
679
675
  """
680
- if tournament is _DEFAULT_TOURNAMENT:
681
- tournament = self.tournament_id if self.tournament_id else None
682
676
  arguments = {
683
- "tournament": tournament,
677
+ "tournament": self.tournament_id,
684
678
  "number": number,
685
679
  "target": target,
686
680
  "status": None if status is None else status.upper(),
@@ -1133,7 +1127,6 @@ class Api:
1133
1127
  version: str | None = None,
1134
1128
  day: int | None = None,
1135
1129
  resolved: bool | None = None,
1136
- tournament: int | None = None,
1137
1130
  last_n_rounds: int | None = None,
1138
1131
  distinct_on_round: bool | None = None,
1139
1132
  ) -> List[Dict]:
@@ -1195,7 +1188,7 @@ class Api:
1195
1188
  "version": version,
1196
1189
  "day": day,
1197
1190
  "resolved": resolved,
1198
- "tournament": self.tournament_id if tournament is None else tournament,
1191
+ "tournament": self.tournament_id,
1199
1192
  "lastNRounds": last_n_rounds,
1200
1193
  "distinctOnRound": distinct_on_round,
1201
1194
  }
@@ -14,6 +14,8 @@ import tqdm
14
14
 
15
15
  logger = logging.getLogger(__name__)
16
16
 
17
+ DOWNLOAD_CHUNK_SIZE = 1024 * 1024 # 1 MiB
18
+
17
19
 
18
20
  def load_secrets() -> tuple:
19
21
  """load secrets from environment variables or dotenv file"""
@@ -96,9 +98,9 @@ def download_file(url: str, dest_path: str, show_progress_bars: bool = True):
96
98
  # Update progress bar to reflect how much of the file is already downloaded
97
99
  pbar.update(file_size)
98
100
  with open(temp_path, "ab") as dest_file:
99
- for chunk in req.iter_content(1024):
101
+ for chunk in req.iter_content(DOWNLOAD_CHUNK_SIZE):
100
102
  dest_file.write(chunk)
101
- pbar.update(1024)
103
+ pbar.update(len(chunk))
102
104
  # move temp file to target destination
103
105
  os.replace(temp_path, dest_path)
104
106
  return dest_path
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: numerapi
3
- Version: 2.23.0.dev3
3
+ Version: 2.23.2
4
4
  Summary: Automatically download and upload data for the Numerai machine learning competition
5
5
  Home-page: https://github.com/uuazed/numerapi
6
6
  Maintainer: uuazed
@@ -5,7 +5,7 @@ def load(path):
5
5
  return open(path, "r").read()
6
6
 
7
7
 
8
- numerapi_version = "2.23.0.dev3"
8
+ numerapi_version = "2.23.2"
9
9
 
10
10
 
11
11
  classifiers = [
@@ -230,15 +230,15 @@ def test_list_rounds(api):
230
230
 
231
231
 
232
232
  @responses.activate
233
- def test_list_rounds_without_tournament_filter(api):
233
+ def test_list_rounds_uses_api_tournament_id_by_default(api):
234
234
  api.tournament_id = 11
235
235
  data = {"data": {"rounds": []}}
236
236
  responses.add(responses.POST, base_api.API_TOURNAMENT_URL, json=data)
237
237
 
238
- api.list_rounds(tournament=None)
238
+ api.list_rounds()
239
239
 
240
240
  request_body = json.loads(responses.calls[0].request.body)
241
- assert request_body["variables"]["tournament"] is None
241
+ assert request_body["variables"]["tournament"] == 11
242
242
 
243
243
 
244
244
  @responses.activate
@@ -1,8 +1,11 @@
1
+ import importlib
2
+ import importlib.metadata
1
3
  import os
2
4
  import pytest
3
5
  from click.testing import CliRunner
4
6
  from unittest.mock import patch
5
7
 
8
+ import numerapi
6
9
  from numerapi import cli
7
10
 
8
11
 
@@ -117,3 +120,19 @@ def test_version():
117
120
  result = CliRunner().invoke(cli.version)
118
121
  # just testing if calling works fine
119
122
  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)
File without changes
File without changes
File without changes