Skip to content

Commit 68ded7c

Browse files
authored
Use bumpversion for epidata client (#1436)
1 parent 2a481f5 commit 68ded7c

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

.bumpversion.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ tag = False
99

1010
[bumpversion:file:src/client/delphi_epidata.R]
1111

12+
[bumpversion:file:src/client/delphi_epidata.py]
13+
1214
[bumpversion:file:src/client/packaging/npm/package.json]
1315

1416
[bumpversion:file:src/client/packaging/pypi/setup.py]
1517

16-
[bumpversion:file:src/client/packaging/pypi/delphi_epidata/__init__.py]
17-
1818
[bumpversion:file:dev/local/setup.cfg]

src/client/delphi_epidata.py

+3-10
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,12 @@
1515
from tenacity import retry, stop_after_attempt
1616

1717
from aiohttp import ClientSession, TCPConnector, BasicAuth
18-
from importlib.metadata import version, PackageNotFoundError
1918

2019
from delphi.epidata.common.logger import get_structured_logger
2120

22-
# Obtain package version for the user-agent. Uses the installed version by
23-
# preference, even if you've installed it and then use this script independently
24-
# by accident.
25-
try:
26-
_version = version("delphi-epidata")
27-
except PackageNotFoundError:
28-
_version = "0.script"
21+
__version__ = "4.1.20"
2922

30-
_HEADERS = {"user-agent": "delphi_epidata/" + _version + " (Python)"}
23+
_HEADERS = {"user-agent": "delphi_epidata/" + __version__ + " (Python)"}
3124

3225

3326
class EpidataException(Exception):
@@ -50,7 +43,7 @@ class Epidata:
5043
BASE_URL = "https://api.delphi.cmu.edu/epidata"
5144
auth = None
5245

53-
client_version = _version
46+
client_version = __version__
5447

5548
logger = get_structured_logger('delphi_epidata_client')
5649
debug = False # if True, prints extra logging statements

src/client/packaging/pypi/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
77

88
### Includes
99
- https://github.com/cmu-delphi/delphi-epidata/pull/1418
10+
- https://github.com/cmu-delphi/delphi-epidata/pull/1436
1011

1112
### Added
1213
- Adds two debug flags:
1314
- `debug` logs info about HTTP requests and responses
1415
- `sandbox` prevents any HTTP requests from actually executing, allowing for tests that do not incur server load.
16+
- Fixes the `user-agent` version so that it is correctly set to match the current client release.
1517

1618
## [4.1.17] - 2024-01-30
1719

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from .delphi_epidata import Epidata
1+
from .delphi_epidata import Epidata, __version__
22

33
name = "delphi_epidata"
4-
__version__ = "4.1.20"

0 commit comments

Comments
 (0)