From ee273edab4e652b9407827db20f3c0ee359ff9f7 Mon Sep 17 00:00:00 2001 From: Harpo Harbert Date: Tue, 17 Sep 2024 10:52:45 -0700 Subject: [PATCH] Lint docs example --- docs/example.ipynb | 15 +++++++-------- pyproject.toml | 35 ++++++++++++++--------------------- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/docs/example.ipynb b/docs/example.ipynb index 310b29f..e023e2f 100644 --- a/docs/example.ipynb +++ b/docs/example.ipynb @@ -32,7 +32,7 @@ "source": [ "import logging\n", "\n", - "logging.getLogger(\"requests.packages.urllib3\").setLevel(logging.DEBUG)" + "logging.getLogger('requests.packages.urllib3').setLevel(logging.DEBUG)" ] }, { @@ -68,8 +68,9 @@ "metadata": {}, "outputs": [], "source": [ - "from ci_config import *\n", - "from sonyci import SonyCi, Config\n", + "from ci_config import client_id, client_secret, password, username, workspace_id\n", + "\n", + "from sonyci import SonyCi\n", "\n", "ci = SonyCi(\n", " username=username,\n", @@ -115,7 +116,6 @@ "source": [ "from requests_oauth2client.tokens import BearerTokenSerializer\n", "\n", - "\n", "with open('../.token') as f:\n", " token = BearerTokenSerializer().loads(f.read())" ] @@ -128,7 +128,6 @@ "source": [ "from sonyci.sonyci import SonyCi\n", "\n", - "\n", "ci = SonyCi(t=token)" ] }, @@ -157,8 +156,8 @@ "metadata": {}, "outputs": [], "source": [ - "ci = SonyCi.load_from_toml(\"../ci.toml\")\n", - "ci(\"workspaces\")" + "ci = SonyCi.load_from_toml('../ci.toml')\n", + "ci('workspaces')" ] } ], @@ -178,7 +177,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.1" + "version": "3.12.4" }, "orig_nbformat": 4 }, diff --git a/pyproject.toml b/pyproject.toml index 3e0a302..2912ed1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,11 +2,7 @@ name = 'sonyci' description = 'A Sony Ci api client' authors = [{ name = 'WGBH-MLA', email = 'ryan_harbert@wgbh.org' }] -dependencies = [ - "pydantic~=2.9", - "requests-oauth2client~=1.6", - "loguru~=0.7", -] +dependencies = ["pydantic~=2.9", "requests-oauth2client~=1.6", "loguru~=0.7"] requires-python = '>=3.8' readme = 'README.md' license = { text = 'MIT' } @@ -25,15 +21,9 @@ test = [ "pytest-xdist~=3.6", "urllib3~=1.26", ] -cli = [ - "typer[all]~=0.12", -] -cli-ci = [ - "typer~=0.12", -] -tui = [ - "trogon~=0.5", -] +cli = ["typer[all]~=0.12"] +cli-ci = ["typer~=0.12"] +tui = ["trogon~=0.5"] docs = [ "mkdocs~=1.6", "mkdocs-material~=9.5", @@ -51,11 +41,14 @@ build-backend = 'pdm.backend' version = { source = 'file', path = 'sonyci/_version.py' } [tool.pdm.dev-dependencies] -dev = [ - "ruff~=0.6", - "black~=24.8", - "pre-commit~=3.5", -] +dev = ["ruff~=0.6", "black~=24.8", "pre-commit~=3.5"] + +[tool.pdm.scripts] +ci = { call = 'sonyci.cli:app' } +format = 'black -S .' +lint = 'ruff . --fix' +test = 'pytest -n auto --vcr-record=none --no_ci' +docs = 'mkdocs serve' [tool.pytest.ini_options] testpaths = ['tests'] @@ -64,10 +57,10 @@ markers = ['no_ci: marks tests to skip on CI'] [tool.coverage.run] omit = ['tests/*'] -[tool.ruff.flake8-quotes] +[tool.ruff.lint.flake8-quotes] inline-quotes = 'single' -[tool.ruff] +[tool.ruff.lint] select = [ 'B', # flake8-bugbear 'C4', # flake8-comprehensions