Skip to content

Commit

Permalink
Fix 720 (#726)
Browse files Browse the repository at this point in the history
* update dev-dependencies

* fix INP001

* rework docs (closes #720)

* update .readthedocs.yml
  • Loading branch information
sigma67 authored Jan 17, 2025
1 parent e41e1a3 commit af04fa4
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
tests/*.json
tests/setup/*.json
docs/build
docs/source/reference/api
test.cfg
**.mp3
.coverage
Expand Down
3 changes: 3 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ build:
os: ubuntu-22.04
tools:
python: "3.10"
jobs:
pre_build:
- sphinx-apidoc -o docs/source/reference/api ytmusicapi

python:
install:
Expand Down
1 change: 1 addition & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
sphinx-apidoc -o source/reference/api ../ytmusicapi
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1 change: 1 addition & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if errorlevel 9009 (
exit /b 1
)

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

Expand Down
19 changes: 19 additions & 0 deletions docs/source/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.wy-nav-content {
max-width: 1080px !important;
}
/* Newlines (\a) and spaces (\20) before each parameter */
.sig-param::before {
content: "\a\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20";
white-space: pre;
}

/* Newline after the last parameter (so the closing bracket is on a new line) */
dt em.sig-param:last-of-type::after {
content: "\a";
white-space: pre;
}

/* To have blue background of width of the block (instead of width of content) */
dl.class > dt:first-of-type {
display: block !important;
}
3 changes: 0 additions & 3 deletions docs/source/_static/style.css

This file was deleted.

8 changes: 7 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["sphinx.ext.autodoc"]
extensions = ["sphinx.ext.autodoc", "sphinx_autodoc_typehints"]

typehints_use_signature = True
typehints_use_signature_return = True

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

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
1 change: 1 addition & 0 deletions docs/source/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Reference for the YTMusic class.
playlists
podcasts
uploads
api/modules
39 changes: 20 additions & 19 deletions docs/source/reference/library.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
Library
-------

.. currentmodule:: ytmusicapi
.. automethod:: YTMusic.get_library_playlists
.. automethod:: YTMusic.get_library_songs
.. automethod:: YTMusic.get_library_albums
.. automethod:: YTMusic.get_library_artists
.. automethod:: YTMusic.get_library_subscriptions
.. automethod:: YTMusic.get_library_podcasts
.. automethod:: YTMusic.get_library_channels
.. automethod:: YTMusic.get_liked_songs
.. automethod:: YTMusic.get_saved_episodes
.. automethod:: YTMusic.get_history
.. automethod:: YTMusic.add_history_item
.. automethod:: YTMusic.remove_history_items
.. automethod:: YTMusic.rate_song
.. automethod:: YTMusic.edit_song_library_status
.. automethod:: YTMusic.rate_playlist
.. automethod:: YTMusic.subscribe_artists
.. automethod:: YTMusic.unsubscribe_artists
.. automethod:: YTMusic.get_account_info
.. automodule:: ytmusicapi

.. automethod:: YTMusic.get_library_playlists
.. automethod:: YTMusic.get_library_songs
.. automethod:: YTMusic.get_library_albums
.. automethod:: YTMusic.get_library_artists
.. automethod:: YTMusic.get_library_subscriptions
.. automethod:: YTMusic.get_library_podcasts
.. automethod:: YTMusic.get_library_channels
.. automethod:: YTMusic.get_liked_songs
.. automethod:: YTMusic.get_saved_episodes
.. automethod:: YTMusic.get_history
.. automethod:: YTMusic.add_history_item
.. automethod:: YTMusic.remove_history_items
.. automethod:: YTMusic.rate_song
.. automethod:: YTMusic.edit_song_library_status
.. automethod:: YTMusic.rate_playlist
.. automethod:: YTMusic.subscribe_artists
.. automethod:: YTMusic.unsubscribe_artists
.. automethod:: YTMusic.get_account_info
9 changes: 9 additions & 0 deletions docs/source/reference/oauth.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
OAuth
=====

.. automodule:: ytmusicapi.auth.oauth
:ignore-module-all:
:members:
:undoc-members:
:show-inheritance:
:imported-members:
3 changes: 2 additions & 1 deletion docs/source/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sphinx<7
sphinx-rtd-theme
sphinx-rtd-theme
sphinx-autodoc-typehints>=1.23.0
16 changes: 15 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ dev = [
"pytest-cov>=4.1.0",
"types-requests>=2.31.0.20240218",
"pytest-retry>=1.6.3",
"sphinx-autodoc-typehints>=1.23.0",
]
3 changes: 3 additions & 0 deletions ytmusicapi/auth/oauth/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class OAuthCredentials(Credentials):
Class for handling OAuth credential retrieval and refreshing.
"""

client_id: str
client_secret: str

def __init__(
self,
client_id: str,
Expand Down

0 comments on commit af04fa4

Please sign in to comment.