From d7b5201c3c0fdb5fc91791a2d86463670a201aa4 Mon Sep 17 00:00:00 2001 From: Joostlek Date: Sat, 10 Jun 2023 18:49:01 +0200 Subject: [PATCH 1/2] Initial project setup --- poetry.lock | 23 +++++++++++------------ sonar-project.properties | 12 ++++++------ src/python_youtube/__init__.py | 2 -- src/python_youtube/youtube.py | 20 ++++++++++++++++++++ tests/__init__.py | 8 ++++++++ tests/test_client.py | 9 +++++++++ 6 files changed, 54 insertions(+), 20 deletions(-) create mode 100644 src/python_youtube/youtube.py create mode 100644 tests/__init__.py create mode 100644 tests/test_client.py diff --git a/poetry.lock b/poetry.lock index c2b0e54..2a1a8ad 100644 --- a/poetry.lock +++ b/poetry.lock @@ -544,18 +544,18 @@ test = ["pytest (>=6)"] [[package]] name = "filelock" -version = "3.12.0" +version = "3.12.1" description = "A platform independent file lock." optional = false python-versions = ">=3.7" files = [ - {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, - {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, + {file = "filelock-3.12.1-py3-none-any.whl", hash = "sha256:42f1e4ff2b497311213d61ad7aac5fed9050608e5309573f101eefa94143134a"}, + {file = "filelock-3.12.1.tar.gz", hash = "sha256:82b1f7da46f0ae42abf1bc78e548667f484ac59d2bcec38c713cee7e2eb51e83"}, ] [package.extras] -docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.5.20)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] [[package]] name = "frozenlist" @@ -1023,18 +1023,18 @@ files = [ [[package]] name = "platformdirs" -version = "3.5.1" +version = "3.5.3" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.5.1-py3-none-any.whl", hash = "sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5"}, - {file = "platformdirs-3.5.1.tar.gz", hash = "sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f"}, + {file = "platformdirs-3.5.3-py3-none-any.whl", hash = "sha256:0ade98a4895e87dc51d47151f7d2ec290365a585151d97b4d8d6312ed6132fed"}, + {file = "platformdirs-3.5.3.tar.gz", hash = "sha256:e48fabd87db8f3a7df7150a4a5ea22c546ee8bc39bc2473244730d4b56d2cc4e"}, ] [package.extras] -docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.2.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.5.20)", "proselint (>=0.13)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)"] [[package]] name = "pluggy" @@ -1324,8 +1324,7 @@ files = [ {file = "ruamel.yaml.clib-0.2.7-cp310-cp310-win32.whl", hash = "sha256:763d65baa3b952479c4e972669f679fe490eee058d5aa85da483ebae2009d231"}, {file = "ruamel.yaml.clib-0.2.7-cp310-cp310-win_amd64.whl", hash = "sha256:d000f258cf42fec2b1bbf2863c61d7b8918d31ffee905da62dede869254d3b8a"}, {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:045e0626baf1c52e5527bd5db361bc83180faaba2ff586e763d3d5982a876a9e"}, - {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:1a6391a7cabb7641c32517539ca42cf84b87b667bad38b78d4d42dd23e957c81"}, - {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:9c7617df90c1365638916b98cdd9be833d31d337dbcd722485597b43c4a215bf"}, + {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-macosx_12_6_arm64.whl", hash = "sha256:721bc4ba4525f53f6a611ec0967bdcee61b31df5a56801281027a3a6d1c2daf5"}, {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:41d0f1fa4c6830176eef5b276af04c89320ea616655d01327d5ce65e50575c94"}, {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-win32.whl", hash = "sha256:f6d3d39611ac2e4f62c3128a9eed45f19a6608670c5a2f4f07f24e8de3441d38"}, {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-win_amd64.whl", hash = "sha256:da538167284de58a52109a9b89b8f6a53ff8437dd6dc26d33b57bf6699153122"}, diff --git a/sonar-project.properties b/sonar-project.properties index 9533ee9..ab8a326 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,12 +1,12 @@ -sonar.projectKey=joostlek_python-opensky +sonar.projectKey=joostlek_python-youtube sonar.organization=joostlek-github -sonar.projectName=Asynchronous Python client for the OpenSky API +sonar.projectName=Asynchronous Python client for the YouTube V3 API sonar.projectVersion=1.0 -sonar.links.homepage=https://github.com/joostlek/python-opensky -sonar.links.ci=https://github.com/joostlek/python-opensky/actions -sonar.links.issue=https://github.com/joostlek/python-opensky/issues -sonar.links.scm=https://github.com/joostlek/python-opensky/tree/main +sonar.links.homepage=https://github.com/joostlek/python-youtube +sonar.links.ci=https://github.com/joostlek/python-youtube/actions +sonar.links.issue=https://github.com/joostlek/python-youtube/issues +sonar.links.scm=https://github.com/joostlek/python-youtube/tree/main sonar.language=py sonar.sourceEncoding=UTF-8 diff --git a/src/python_youtube/__init__.py b/src/python_youtube/__init__.py index c5b52c3..a1f8e3c 100644 --- a/src/python_youtube/__init__.py +++ b/src/python_youtube/__init__.py @@ -1,3 +1 @@ """Asynchronous Python client for the YouTube V3 API.""" - -__all__ = [] diff --git a/src/python_youtube/youtube.py b/src/python_youtube/youtube.py new file mode 100644 index 0000000..c499b54 --- /dev/null +++ b/src/python_youtube/youtube.py @@ -0,0 +1,20 @@ +"""The YouTube API.""" +__all__ = [ + "YouTube", +] + + +class YouTube: + """YouTube API client.""" + + def __init__(self) -> None: + """Initialize the YouTube client.""" + self.test = "ack" + + def syn(self) -> str: + """Test method.""" + return self.test + + def ack(self) -> str: + """Test method.""" + return self.test diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..899d95d --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,8 @@ +"""Tests for the YouTube Library.""" +from pathlib import Path + + +def load_fixture(filename: str) -> str: + """Load a fixture.""" + path = Path(__package__) / "fixtures" / filename + return path.read_text(encoding="utf-8") diff --git a/tests/test_client.py b/tests/test_client.py new file mode 100644 index 0000000..2965c1b --- /dev/null +++ b/tests/test_client.py @@ -0,0 +1,9 @@ +"""Tests for the YouTube client.""" +from python_youtube.youtube import YouTube + + +async def test_init() -> None: + """Test if YouTube client can be created.""" + youtube = YouTube() + assert youtube.syn() == "ack" + assert youtube.ack() == "ack" From 0cff78930757fccd27a0f8a53386a953d5272317 Mon Sep 17 00:00:00 2001 From: Joostlek Date: Sat, 10 Jun 2023 18:54:01 +0200 Subject: [PATCH 2/2] Fix build --- .github/workflows/linting.yaml | 2 -- .github/workflows/typing.yaml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml index fe0f8bb..f70a942 100644 --- a/.github/workflows/linting.yaml +++ b/.github/workflows/linting.yaml @@ -120,8 +120,6 @@ jobs: run: poetry run pre-commit run check-xml --all-files - name: 🚀 Check YAML files run: poetry run pre-commit run check-yaml --all-files - - name: 🚀 Check YAML files - run: poetry run pre-commit run check-yaml --all-files - name: 🚀 Detect Private Keys run: poetry run pre-commit run detect-private-key --all-files - name: 🚀 Check End of Files diff --git a/.github/workflows/typing.yaml b/.github/workflows/typing.yaml index 2cab927..ddf39d3 100644 --- a/.github/workflows/typing.yaml +++ b/.github/workflows/typing.yaml @@ -32,4 +32,4 @@ jobs: - name: 🏗 Install dependencies run: poetry install --no-interaction - name: 🚀 Run mypy - run: poetry run mypy examples src tests + run: poetry run mypy src tests