diff --git a/.flake8 b/.flake8 index 3aa0050..bf7f593 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,7 @@ [flake8] -max-line-length = 100 +max-line-length = 88 exclude = build/* +extend-ignore = + # See https://github.com/PyCQA/pycodestyle/issues/373 + E203, +ignore = E402, W503 diff --git a/.github/README.rst b/.github/README.rst index 11b493c..4052618 100644 --- a/.github/README.rst +++ b/.github/README.rst @@ -17,6 +17,7 @@ Pyarr: Sonarr and Radarr API Python Wrapper

+`About`_ • `Installation`_ • `Support`_ • `Full Documentation `_ .. raw:: html diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index 22b7970..be73a65 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -1,13 +1,11 @@ --- -name: PyArr CI +name: CI on: push: tags: - 'v*' - branches: - - master pull_request: branches: - master @@ -22,9 +20,16 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 - # Use this GitHub Action + - name: Check if Python files changed + id: changed-files + uses: tj-actions/changed-files@v9 + with: + files: | + .py + pyproject.toml - name: Check package version - uses: marksie1988/tag_check@patch-1 + if: steps.changed-files-specific.outputs.any_changed == 'true' + uses: dudo/tag_check@v1.1.1 with: git_tag_prefix: v black: diff --git a/pyarr/radarr_api.py b/pyarr/radarr_api.py index 3eed8d9..1c6c08a 100644 --- a/pyarr/radarr_api.py +++ b/pyarr/radarr_api.py @@ -943,19 +943,23 @@ def get_health(self): ## COMMAND # POST /command - def post_command(self, name): + def post_command(self, name, **kwargs): """Performs any of the predetermined Radarr command routines. + Note: + For command names and kwargs: + See https://radarr.video/docs/api/#/Command/post-command + Args: name (str): Name of the command to be run - For command names: - https://radarr.video/docs/api/#/Command/post-command + **kwargs: additional parameters for specific commands Returns: JSON: Array """ data = { "name": name, + **kwargs, } path = "/api/v3/command" res = self.request_post(path, data=data) diff --git a/pyarr/sonarr_api.py b/pyarr/sonarr_api.py index 94a229e..2dd8249 100644 --- a/pyarr/sonarr_api.py +++ b/pyarr/sonarr_api.py @@ -102,13 +102,18 @@ def get_command(self, id_=None): return res # POST /command - def set_command(self, name): + def set_command(self, name, **kwargs): """Performs any of the predetermined Sonarr command routines + Note: + For command names and additional kwargs: + See https://github.com/Sonarr/Sonarr/wiki/Command + Args: name (str): command name that should be execured - For command names: - See https://github.com/Sonarr/Sonarr/wiki/Command + **kwargs: additional parameters for specific commands + + Returns: JSON: Array @@ -116,6 +121,7 @@ def set_command(self, name): path = "/api/command" data = { "name": name, + **kwargs, } res = self.request_post(path, data=data) return res diff --git a/sphinx-docs/contributing.rst b/sphinx-docs/contributing.rst index f65a634..adf2ad7 100644 --- a/sphinx-docs/contributing.rst +++ b/sphinx-docs/contributing.rst @@ -1,42 +1,79 @@ -************ +############ Contributing -************ - -Modifying the module -==================== +############ It is recommended that contributions to this project are created within vscode, utilising the devcontainer functionality. -This ensures that all developers are using the same environment and reduces the -risk of adding bugs / issues within the project. +This ensures that all developers are using the same environment and extentions. +This reduces the risk of additional bugs / formatting issues within the project. .. note:: The setup of VSCode devcontainer is outside of the scope of this document additional information can be found within the VSCode documentation. -Making changes --------------- +********************** +Setup your environment +********************** + +#. Fork the `repository `_ +#. Open the repository in VSCode +#. Copy the .devcontainer/recommended-*** files and remove the "recommended-" text +#. Press ``ctrl + shift + p`` and select ``Remote-Container: Reopen in Container`` +#. Once loaded you can begin modification of the module or Documentation + +********************* +Updating PyArr module +********************* + +Style & formatting +================== + +- Must follow PEP8 / Black formatting. (devcontainer is setup to reformat on save) +- All functions must use google docstring format, the devcontainer has an + `autodocstring `_ + plugin which will auto fill. +- ``pyproject.toml`` must be updated with a new version, the new versions should + follow `semver `_. +- Each feature / bugfix etc. should have its own pull request. + +********************** +Updating Documentation +********************** -#. Fork the repository -#. Must follow PEP8 and Black formatting. -#. pyproject.toml must be updated with a new version, the new versions should - follow `semver `. -#. Re-generate API rst with sphinx - ..code:: Python +The documentation for this project utilises `sphinx `_. +Sphinx allows for automatic documenting of all classes / functions via DocString. - sphinx-apidoc -o ./sphinx-docs ./pyarr +To Update static pages, you can amend the ``.rst`` files in the ``sphinx-docs`` folder. -#. Each change should have its own PR. -#. All information should be filled out in the PR Template. -#. Any PR that consists of multiple changes may be rejected. -#. PRs must state if they are breaking changes and what would break by implementing. +All Python Class / Function documentation is updated automatically by Github Actions and +does not require any manual changes to be made. +Sphinx documentation uses `reStructuredText `_ to format each of the pages. -Releasing the module -==================== +*********************** +Pull Requests & Release +*********************** -To release a new version of the module, core team will take the following steps: +Now that you have made the changes required for your enhancement, a pull request +is required for the core team to review the changes, request amendements or approve +the work that you have completed. + +Pull Requests +============= + +- Each feature / bugfix should have its own PR. This makes code review more efficient + and allows for a clean changelog generation +- If a Pull Request contains multiple changes, our core team may reject it +- All information in the Pull Request template should be completed, when people look + at what was done with this Pull Request it should be easy to tell from this template +- It must state if the change is a Breaking Change, and what would break by implementing + +Release Changes +================= + +To release a new version of the module or documentation updates, the core team + will take the following steps: #. Reviewing and testing the PR that has been submitted to ensure all requirements have been met. @@ -44,3 +81,9 @@ To release a new version of the module, core team will take the following steps: #. Push the tag to GitHub: ``git push --tags origin``. #. If all tests complete the package will be automatically released to PyPI #. Github Action will re-create the documentation with Sphinx + +If the only change is to documentation, the workflow ``Sphinx Documentation Update`` +will be run to update the documentation. + +Documentation updates don't require the version to be updated in ``pyproject.toml`` +and also don't require tagging.