-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add test for find track * fix type hint * fix test * add windows run example * support wheel build * setup proper long description for pypi * add classifiers * update makefile with publish * add github action to publish * update contributing * bump version Co-authored-by: Radu <[email protected]>
- Loading branch information
Showing
10 changed files
with
97 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
pip install -r requirements.txt | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
prune test* | ||
include README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,15 @@ Currently works for m3u files; m3u8 support to come! | |
existing playlist with this id | ||
### Example | ||
tospotify --verbose "[email protected]" "D:/playlist/name.m3u" | ||
* Linux/MacOS | ||
|
||
tospotify --verbose "[email protected]" "D:/playlist/name.m3u" | ||
* Windows* | ||
|
||
python -m tospotify "[email protected]" "D:/playlist/name.m3u" | ||
\*`entry_points` does not seem to simply work on Windows | ||
|
||
|
||
## Requirements | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
from setuptools import setup, find_packages | ||
from setuptools import setup | ||
|
||
|
||
def readme(): | ||
with open('README.md') as f: | ||
return f.read() | ||
|
||
|
||
# TODO: add long_description ~ pypi readme | ||
setup( | ||
name='tospotify', | ||
version='0.1', | ||
version='0.2', | ||
description='Create/update a Spotify playlist from a local m3u playlist', | ||
url='https://github.com/radujica/tospotify', | ||
author='Radu Jica', | ||
author_email='[email protected]', | ||
license='GPL-3.0', | ||
packages=find_packages(), | ||
long_description=readme(), | ||
long_description_content_type='text/markdown', | ||
classifiers=[ | ||
'Development Status :: 3 - Alpha', | ||
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Topic :: Multimedia :: Sound/Audio', | ||
'Operating System :: OS Independent' | ||
], | ||
packages=['tospotify', 'tospotify.types'], | ||
include_package_data=True, | ||
zip_safe=True, | ||
install_requires=['spotipy', 'm3u8'], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import os | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
||
from tospotify.run import _parse_path | ||
|
||
|
||
@patch('os.sep', '/') | ||
@patch('os.getcwd', lambda: '/test/path') | ||
@pytest.mark.parametrize('path,expected', [ | ||
('/abs/path', '/abs/path'), | ||
('relative/path', '/test/path/relative/path') | ||
('/abs/path', ['/abs/path']), | ||
('relative/path', ['/test/path', 'relative/path']) | ||
]) | ||
def test__parse_path(path, expected): | ||
assert _parse_path(path) == expected | ||
assert _parse_path(path) == os.sep.join(expected) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from unittest.mock import patch, Mock | ||
|
||
import pytest | ||
|
||
import tospotify | ||
|
||
|
||
@patch('tospotify.search._run_query') | ||
@pytest.mark.parametrize('song,_run_query_results,expected', [ | ||
('Sting - Every Breath You Take', [None, 'uri1'], 'uri1'), | ||
('Sting - Every Breath You Take', ['uri1', 'uri2'], 'uri1'), | ||
]) | ||
def test__find_track(mock__run_query, song, _run_query_results, expected): | ||
mock_song = Mock() | ||
mock_song.title.return_value = song | ||
mock__run_query.side_effect = _run_query_results | ||
|
||
actual = tospotify.search._find_track(None, mock_song) | ||
|
||
assert actual == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters