Skip to content

Commit af04fa4

Browse files
authored
Fix 720 (#726)
* update dev-dependencies * fix INP001 * rework docs (closes #720) * update .readthedocs.yml
1 parent e41e1a3 commit af04fa4

File tree

14 files changed

+83
-25
lines changed

14 files changed

+83
-25
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
tests/*.json
44
tests/setup/*.json
55
docs/build
6+
docs/source/reference/api
67
test.cfg
78
**.mp3
89
.coverage

.readthedocs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ build:
44
os: ubuntu-22.04
55
tools:
66
python: "3.10"
7+
jobs:
8+
pre_build:
9+
- sphinx-apidoc -o docs/source/reference/api ytmusicapi
710

811
python:
912
install:

docs/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ help:
1717
# Catch-all target: route all unknown targets to Sphinx using the new
1818
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1919
%: Makefile
20+
sphinx-apidoc -o source/reference/api ../ytmusicapi
2021
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if errorlevel 9009 (
2525
exit /b 1
2626
)
2727

28+
sphinx-apidoc -o source/reference/api ../ytmusicapi
2829
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
2930
goto end
3031

docs/source/_static/css/custom.css

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.wy-nav-content {
2+
max-width: 1080px !important;
3+
}
4+
/* Newlines (\a) and spaces (\20) before each parameter */
5+
.sig-param::before {
6+
content: "\a\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20";
7+
white-space: pre;
8+
}
9+
10+
/* Newline after the last parameter (so the closing bracket is on a new line) */
11+
dt em.sig-param:last-of-type::after {
12+
content: "\a";
13+
white-space: pre;
14+
}
15+
16+
/* To have blue background of width of the block (instead of width of content) */
17+
dl.class > dt:first-of-type {
18+
display: block !important;
19+
}

docs/source/_static/style.css

-3
This file was deleted.

docs/source/conf.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
# Add any Sphinx extension module names here, as strings. They can be
3737
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3838
# ones.
39-
extensions = ["sphinx.ext.autodoc"]
39+
extensions = ["sphinx.ext.autodoc", "sphinx_autodoc_typehints"]
40+
41+
typehints_use_signature = True
42+
typehints_use_signature_return = True
4043

4144
# The suffix of source filenames.
4245
source_suffix = ".rst"
@@ -51,6 +54,9 @@
5154
# relative to this directory. They are copied after the builtin static files,
5255
# so a file named "default.css" will overwrite the builtin "default.css".
5356
html_static_path = ["_static"]
57+
html_css_files = [
58+
"css/custom.css",
59+
]
5460

5561
# List of patterns, relative to source directory, that match files and
5662
# directories to ignore when looking for source files.

docs/source/reference/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ Reference for the YTMusic class.
1616
playlists
1717
podcasts
1818
uploads
19+
api/modules

docs/source/reference/library.rst

+20-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
Library
22
-------
33

4-
.. currentmodule:: ytmusicapi
5-
.. automethod:: YTMusic.get_library_playlists
6-
.. automethod:: YTMusic.get_library_songs
7-
.. automethod:: YTMusic.get_library_albums
8-
.. automethod:: YTMusic.get_library_artists
9-
.. automethod:: YTMusic.get_library_subscriptions
10-
.. automethod:: YTMusic.get_library_podcasts
11-
.. automethod:: YTMusic.get_library_channels
12-
.. automethod:: YTMusic.get_liked_songs
13-
.. automethod:: YTMusic.get_saved_episodes
14-
.. automethod:: YTMusic.get_history
15-
.. automethod:: YTMusic.add_history_item
16-
.. automethod:: YTMusic.remove_history_items
17-
.. automethod:: YTMusic.rate_song
18-
.. automethod:: YTMusic.edit_song_library_status
19-
.. automethod:: YTMusic.rate_playlist
20-
.. automethod:: YTMusic.subscribe_artists
21-
.. automethod:: YTMusic.unsubscribe_artists
22-
.. automethod:: YTMusic.get_account_info
4+
.. automodule:: ytmusicapi
5+
6+
.. automethod:: YTMusic.get_library_playlists
7+
.. automethod:: YTMusic.get_library_songs
8+
.. automethod:: YTMusic.get_library_albums
9+
.. automethod:: YTMusic.get_library_artists
10+
.. automethod:: YTMusic.get_library_subscriptions
11+
.. automethod:: YTMusic.get_library_podcasts
12+
.. automethod:: YTMusic.get_library_channels
13+
.. automethod:: YTMusic.get_liked_songs
14+
.. automethod:: YTMusic.get_saved_episodes
15+
.. automethod:: YTMusic.get_history
16+
.. automethod:: YTMusic.add_history_item
17+
.. automethod:: YTMusic.remove_history_items
18+
.. automethod:: YTMusic.rate_song
19+
.. automethod:: YTMusic.edit_song_library_status
20+
.. automethod:: YTMusic.rate_playlist
21+
.. automethod:: YTMusic.subscribe_artists
22+
.. automethod:: YTMusic.unsubscribe_artists
23+
.. automethod:: YTMusic.get_account_info

docs/source/reference/oauth.rst

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
OAuth
2+
=====
3+
4+
.. automodule:: ytmusicapi.auth.oauth
5+
:ignore-module-all:
6+
:members:
7+
:undoc-members:
8+
:show-inheritance:
9+
:imported-members:

docs/source/requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
sphinx<7
2-
sphinx-rtd-theme
2+
sphinx-rtd-theme
3+
sphinx-autodoc-typehints>=1.23.0

pdm.lock

+15-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,5 @@ dev = [
8282
"pytest-cov>=4.1.0",
8383
"types-requests>=2.31.0.20240218",
8484
"pytest-retry>=1.6.3",
85+
"sphinx-autodoc-typehints>=1.23.0",
8586
]

ytmusicapi/auth/oauth/credentials.py

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class OAuthCredentials(Credentials):
4343
Class for handling OAuth credential retrieval and refreshing.
4444
"""
4545

46+
client_id: str
47+
client_secret: str
48+
4649
def __init__(
4750
self,
4851
client_id: str,

0 commit comments

Comments
 (0)