Merge branch 'master' into feature/fix_for_userloved_userplaycount

This commit is contained in:
Koen van Zuijlen 2021-01-12 10:19:24 +01:00
commit 10803a0a63
10 changed files with 84 additions and 29 deletions

View file

@ -12,8 +12,11 @@
Please include **code** that reproduces the issue.
The [best reproductions](https://stackoverflow.com/help/minimal-reproducible-example) are [self-contained scripts](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/) with minimal dependencies.
The [best reproductions](https://stackoverflow.com/help/minimal-reproducible-example)
are
[self-contained scripts](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/)
with minimal dependencies.
```python
code goes here
# code goes here
```

8
.github/labels.yml vendored
View file

@ -97,12 +97,18 @@
- color: 0366d6
description: "For dependencies"
name: dependencies
- color: 0052cc
description: "Documentation"
name: docs
- color: f4660e
description: ""
name: Hacktoberfest
- color: f4660e
description: "To credit accepted Hacktoberfest PRs"
name: hacktoberfest-accepted
- color: d65e88
description: "Deploy and release"
name: release
- color: fef2c0
description: ""
description: "Unit tests, linting, CI, etc."
name: test

View file

@ -23,7 +23,6 @@ exclude-labels:
- "changelog: skip"
template: |
## Changes
$CHANGES

View file

@ -3,7 +3,7 @@ name: Lint
on: [push, pull_request]
jobs:
build:
lint:
runs-on: ubuntu-20.04
steps:

View file

@ -47,7 +47,6 @@ jobs:
python -m pip install -U tox
- name: Tox tests
shell: bash
run: |
tox -e py
env:

View file

@ -14,8 +14,15 @@ repos:
files: \.pyi?$
types: []
- repo: https://github.com/asottile/blacken-docs
rev: v1.9.1
hooks:
- id: blacken-docs
args: ["--target-version", "py36"]
additional_dependencies: [black==20.8b1]
- repo: https://github.com/PyCQA/isort
rev: 5.6.4
rev: 5.7.0
hooks:
- id: isort
@ -31,7 +38,7 @@ repos:
- id: python-check-blanket-noqa
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
rev: v3.4.0
hooks:
- id: check-merge-conflict
- id: check-yaml

View file

@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [4.1.0] - 2021-01-04
## Added
* Add support for streaming (#336) @kvanzuijlen
* Add Python 3.9 final to Travis CI (#350) @sheetalsingala
## Changed
* Update copyright year (#360) @hugovk
* Replace Travis CI with GitHub Actions (#352) @hugovk
* [pre-commit.ci] pre-commit autoupdate (#359) @pre-commit-ci
## Fixed
* Set limit to 50 by default, not 1 (#355) @hugovk
## [4.0.0] - 2020-10-07
## Added
@ -96,6 +113,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Support for Python 2.7 ([#265])
[4.1.0]: https://github.com/pylast/pylast/compare/4.0.0...4.1.0
[4.0.0]: https://github.com/pylast/pylast/compare/3.3.0...4.0.0
[3.3.0]: https://github.com/pylast/pylast/compare/3.2.1...3.3.0
[3.2.1]: https://github.com/pylast/pylast/compare/3.2.0...3.2.1

View file

@ -9,7 +9,8 @@ pyLast
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![DOI](https://zenodo.org/badge/7803088.svg)](https://zenodo.org/badge/latestdoi/7803088)
A Python interface to [Last.fm](https://www.last.fm/) and other API-compatible websites such as [Libre.fm](https://libre.fm/).
A Python interface to [Last.fm](https://www.last.fm/) and other API-compatible websites
such as [Libre.fm](https://libre.fm/).
Use the pydoc utility for help on usage or see [tests/](tests/) for examples.
@ -18,25 +19,31 @@ Installation
Install via pip:
pip install pylast
```sh
python3 -m pip install pylast
```
Install latest development version:
pip install -U git+https://github.com/pylast/pylast
```sh
python3 -m pip install -U git+https://github.com/pylast/pylast
```
Or from requirements.txt:
-e git://github.com/pylast/pylast.git#egg=pylast
```txt
-e git://github.com/pylast/pylast.git#egg=pylast
```
Note:
* pyLast 4.0.0+ supports Python 3.6-3.9.
* pyLast 3.2.0 - 3.3.0 supports Python 3.5-3.8.
* pyLast 3.0.0 - 3.1.0 supports Python 3.5-3.7.
* pyLast 2.2.0 - 2.4.0 supports Python 2.7.10+, 3.4-3.7.
* pyLast 2.0.0 - 2.1.0 supports Python 2.7.10+, 3.4-3.6.
* pyLast 1.7.0 - 1.9.0 supports Python 2.7, 3.3-3.6.
* pyLast 1.0.0 - 1.6.0 supports Python 2.7, 3.3-3.4.
* pyLast 4.0+ supports Python 3.6-3.9.
* pyLast 3.2 - 3.3 supports Python 3.5-3.8.
* pyLast 3.0 - 3.1 supports Python 3.5-3.7.
* pyLast 2.2 - 2.4 supports Python 2.7.10+, 3.4-3.7.
* pyLast 2.0 - 2.1 supports Python 2.7.10+, 3.4-3.6.
* pyLast 1.7 - 1.9 supports Python 2.7, 3.3-3.6.
* pyLast 1.0 - 1.6 supports Python 2.7, 3.3-3.4.
* pyLast 0.5 supports Python 2, 3.
* pyLast < 0.5 supports Python 2.
@ -55,7 +62,10 @@ Features
Getting started
---------------
Here's some simple code example to get you started. In order to create any object from pyLast, you need a `Network` object which represents a social music network that is Last.fm or any other API-compatible one. You can obtain a pre-configured one for Last.fm and use it as follows:
Here's some simple code example to get you started. In order to create any object from
pyLast, you need a `Network` object which represents a social music network that is
Last.fm or any other API-compatible one. You can obtain a pre-configured one for Last.fm
and use it as follows:
```python
import pylast
@ -69,8 +79,12 @@ API_SECRET = "425b55975eed76058ac220b7b4e8a054"
username = "your_user_name"
password_hash = pylast.md5("your_password")
network = pylast.LastFMNetwork(api_key=API_KEY, api_secret=API_SECRET,
username=username, password_hash=password_hash)
network = pylast.LastFMNetwork(
api_key=API_KEY,
api_secret=API_SECRET,
username=username,
password_hash=password_hash,
)
# Now you can use that object everywhere
artist = network.get_artist("System of a Down")
@ -85,14 +99,20 @@ track.add_tags(("awesome", "favorite"))
# to get more help about anything and see examples of how it works
```
More examples in <a href="https://github.com/hugovk/lastfm-tools">hugovk/lastfm-tools</a> and [tests/](tests/).
More examples in
<a href="https://github.com/hugovk/lastfm-tools">hugovk/lastfm-tools</a> and
[tests/](https://github.com/pylast/pylast/tree/master/tests).
Testing
-------
The [tests/](tests/) directory contains integration and unit tests with Last.fm, and plenty of code examples.
The [tests/](https://github.com/pylast/pylast/tree/master/tests) directory contains
integration and unit tests with Last.fm, and plenty of code examples.
For integration tests you need a test account at Last.fm that will become cluttered with test data, and an API key and secret. Either copy [example_test_pylast.yaml](example_test_pylast.yaml) to test_pylast.yaml and fill out the credentials, or set them as environment variables like:
For integration tests you need a test account at Last.fm that will become cluttered with
test data, and an API key and secret. Either copy
[example_test_pylast.yaml](example_test_pylast.yaml) to test_pylast.yaml and fill out
the credentials, or set them as environment variables like:
```sh
export PYLAST_USERNAME=TODO_ENTER_YOURS_HERE
@ -102,17 +122,20 @@ export PYLAST_API_SECRET=TODO_ENTER_YOURS_HERE
```
To run all unit and integration tests:
```sh
pip install -e ".[tests]"
python3 -m pip install -e ".[tests]"
pytest
```
Or run just one test case:
```sh
pytest -k test_scrobble
```
To run with coverage:
```sh
pytest -v --cov pylast --cov-report term-missing
coverage report # for command-line report

View file

@ -3,7 +3,7 @@
# A Python interface to Last.fm and Libre.fm
#
# Copyright 2008-2010 Amr Hassan
# Copyright 2013-2020 hugovk
# Copyright 2013-2021 hugovk
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -35,7 +35,7 @@ from xml.dom import Node, minidom
import pkg_resources
__author__ = "Amr Hassan, hugovk, Mice Pápai"
__copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2020 hugovk, 2017 Mice Pápai"
__copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2021 hugovk, 2017 Mice Pápai"
__license__ = "apache2"
__email__ = "amr.hassan@gmail.com"
__version__ = pkg_resources.get_distribution(__name__).version

View file

@ -11,7 +11,7 @@ from flaky import flaky
import pylast
WRITE_TEST = sys.version_info[:2] == (3, 8)
WRITE_TEST = sys.version_info[:2] == (3, 9)
def load_secrets(): # pragma: no cover