Skip to content

Commit 71bc469

Browse files
Update base.py to remove setuptools and use standard library (#694)
* Update base.py to remove setuptools and use standard library * Update version to version number * Update readme to remove pip install setuptools
1 parent b47b852 commit 71bc469

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ Welcome to the official Python client library for the [Polygon](https://polygon.
77

88
## Prerequisites
99

10-
Before installing the Polygon Python client, ensure your environment has Python 3.8 or higher. While most Python environments come with setuptools installed, it is a dependency for this library. In the rare case it's not already present, you can install setuptools using pip:
11-
12-
```
13-
pip install setuptools
14-
```
10+
Before installing the Polygon Python client, ensure your environment has Python 3.8 or higher.
1511

1612
## Install
1713

polygon/rest/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
from enum import Enum
88
from typing import Optional, Any, Dict
99
from datetime import datetime
10-
import pkg_resources # part of setuptools
10+
from importlib.metadata import version, PackageNotFoundError
1111
from .models.request import RequestOptionBuilder
1212
from ..logging import get_logger
1313
import logging
1414
from urllib.parse import urlencode
1515
from ..exceptions import AuthError, BadResponse
1616

1717
logger = get_logger("RESTClient")
18-
version = "unknown"
18+
version_number = "unknown"
1919
try:
20-
version = pkg_resources.require("polygon-api-client")[0].version
21-
except:
20+
version_number = version("polygon-api-client")
21+
except PackageNotFoundError:
2222
pass
2323

2424

@@ -46,7 +46,7 @@ def __init__(
4646
self.headers = {
4747
"Authorization": "Bearer " + self.API_KEY,
4848
"Accept-Encoding": "gzip",
49-
"User-Agent": f"Polygon.io PythonClient/{version}",
49+
"User-Agent": f"Polygon.io PythonClient/{version_number}",
5050
}
5151

5252
# initialize self.retries with the parameter value before using it

0 commit comments

Comments
 (0)