Skip to content

Commit

Permalink
Fix install (#14)
Browse files Browse the repository at this point in the history
* Add the needed bits to fix the install from pip

* Remove pylistenbrainz refs

* Use importlib.metadata to get package __version__

Co-authored-by: Alastair Porter <[email protected]>
  • Loading branch information
mayhem and alastair authored Jun 29, 2022
1 parent 0827c6b commit f66414d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
14 changes: 13 additions & 1 deletion pylistenbrainz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

__version__ = '0.5.0'
import sys

if sys.version_info >= (3, 10):
from importlib.metadata import version, PackageNotFoundError
else:
# importlib.metadata's API changed in 3.10, so use a backport for versions less than this.
from importlib_metadata import version, PackageNotFoundError

try:
__version__ = version(__name__)
except PackageNotFoundError:
# package is not installed?
__version__ = "unknown"

from pylistenbrainz.client import ListenBrainz
from pylistenbrainz.listen import Listen
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ requests == 2.23.0
pytest == 5.4.1
pytest-cov == 2.8.1
sphinx == 3.0.1
importlib-metadata >= 3.10.0;python_version<"3.10"
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import setuptools
import pylistenbrainz

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name="pylistenbrainz",
version=pylistenbrainz.__version__,
author="Param Singh",
author_email="[email protected]",
description="A simple ListenBrainz client library for Python",
Expand All @@ -22,5 +20,8 @@
python_requires='>=3.5',
install_requires=[
'requests >= 2.23.0',
'importlib-metadata>=3.10.0;python_version<"3.10"',
],
use_scm_version=True,
setup_requires=['setuptools_scm'],
)

0 comments on commit f66414d

Please sign in to comment.