Skip to content

Commit f0d9c32

Browse files
committed
Release 0.2.0
- Use pyproject.toml instead of setup.py - Update constants (mainly seasons and maps) - Rename Api to BallchasingApi (but add Api alias so both are available) - Update stat_info and replace parse_replay method with parse_replay_stats - Add get_maps.py for finding maps of different kinds
1 parent e05a773 commit f0d9c32

File tree

8 files changed

+421
-285
lines changed

8 files changed

+421
-285
lines changed

ballchasing/__init__.py

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,37 @@
2222
# SOFTWARE.
2323

2424
"""A library that provides a Python interface to the Ballchasing API."""
25-
from __future__ import absolute_import
25+
import sys
2626

27-
__author__ = 'Rolv-Arild Braaten'
28-
__email__ = '[email protected]'
29-
__copyright__ = 'Copyright (c) 2020 Rolv-Arild Braaten'
30-
__license__ = 'Apache License 2.0'
31-
__version__ = '0.1.22'
32-
__url__ = 'https://github.com/Rolv-Arild/python-ballchasing'
33-
__download_url__ = 'https://pypi.python.org/pypi/python-ballchasing'
34-
__description__ = 'A Python wrapper around the Ballchasing API'
27+
# In Python 3.8+, importlib.metadata is in the standard library.
28+
# For older versions, a backport is available as importlib_metadata.
29+
if sys.version_info >= (3, 8):
30+
from importlib.metadata import version, metadata
31+
else:
32+
from importlib_metadata import version, metadata
3533

36-
from .api import Api # noqa
37-
from .constants import ( # noqa
34+
try:
35+
# This will read the version from the installed package's metadata
36+
# (which is defined in pyproject.toml)
37+
__version__ = version("python-ballchasing")
38+
39+
# You can also get other metadata in a similar way
40+
pkg_metadata = metadata("python-ballchasing")
41+
__author__ = pkg_metadata.get("Author-Email")
42+
__description__ = pkg_metadata.get("Summary")
43+
except Exception:
44+
# If the package is not installed (e.g., when running in a development
45+
# environment without an editable install), you can fall back to defaults.
46+
__version__ = "0.0.0-dev"
47+
__description__ = 'A Python wrapper around the Ballchasing API'
48+
__author__ = 'Rolv-Arild Braaten <[email protected]>'
49+
50+
# Import the main classes and constants to make them easily accessible to users.
51+
from .api import BallchasingApi
52+
53+
Api = BallchasingApi # For importing like `import ballchasing; api = ballchasing.Api`
54+
55+
from .constants import (
3856
Playlist,
3957
Rank,
4058
Season,

0 commit comments

Comments
 (0)