Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
8389524
First draft of reorganization by app:
FBoissadier Feb 22, 2025
d06ea2e
Move packages implementations in folder Package
FBoissadier Mar 2, 2025
be47492
Update "note" in docstring of FileStation.py
FBoissadier Mar 2, 2025
6420f9a
Enhance docstring in SharedFolder class to detail supported methods a…
FBoissadier Apr 25, 2025
efc4bfe
Merge branch 'master' into feature/reorganization-by-app
FBoissadier Apr 25, 2025
becb257
Integration external access of the control panel
FBoissadier May 1, 2025
8fdad48
Implementation of External devices
FBoissadier May 1, 2025
5f553f3
Implementation of FileServices in ControlPanel
FBoissadier May 3, 2025
7b46fba
Implementation of Hardware & Power in the Control panel
FBoissadier May 10, 2025
71e4b36
Start implementation of Indexing Service
FBoissadier May 18, 2025
259671d
Merge branch 'master' into feature/reorganization-by-app
FBoissadier May 18, 2025
2c93dee
Implementation of Indexin Service
FBoissadier Jul 5, 2025
c1a328d
First implementation of info center
FBoissadier Jul 5, 2025
c49b3aa
fix: synology_api/base_api.py update docstrings to comply with Numpyd…
Jul 3, 2025
34f41c9
fix: synology_api/cloud_sync.py update docstrings to comply with Nump…
Jul 8, 2025
340192c
Update filestation.py
N4S4 Jul 9, 2025
ac24579
get_file_list fail additional file attribute fix #257
N4S4 Jul 9, 2025
f2a22d9
fix: synology_api/core_active_backup.py update docstrings to comply w…
luboszima Jul 11, 2025
ab1cf12
Merge pull request #261 from luboszima/feat/update-numpydoc2
N4S4 Jul 11, 2025
3439ffd
fix: synology_api/core_backup.py update docstrings to comply with Num…
luboszima Jul 11, 2025
2fa9ffb
fix: synology_api/core_certificate.py update docstrings to comply wit…
luboszima Jul 11, 2025
d2f8906
fix: synology_api/core_group.py update docstrings to comply with Nump…
luboszima Jul 11, 2025
ac26c55
fix: synology_api/core_package.py update docstrings to comply with Nu…
luboszima Jul 11, 2025
ae4de87
fix: synology_api/core_share.py update docstrings to comply with Nump…
luboszima Jul 11, 2025
c00af0a
feat: update setup.cfg to include RT04 in numpydoc validation checks
luboszima Jul 11, 2025
2f2000d
fix: synology_api/core_sys_info.py update docstrings to comply with N…
luboszima Jul 11, 2025
0c36887
fix: synology_api/core_user.py update docstrings to comply with Numpy…
luboszima Jul 11, 2025
6e4a0eb
fix: synology_api/dhcp_server.py update docstrings to comply with Num…
luboszima Jul 11, 2025
ec2cc0a
fix: synology_api/directory_server.py update docstrings to comply wit…
luboszima Jul 11, 2025
5020359
fix: directory_server.py add import for time module
luboszima Jul 11, 2025
91c6c17
fix: synology_api/docker_api.py update docstrings to comply with Nump…
luboszima Jul 11, 2025
439a599
fix: synology_api/downloadstation.py update docstrings to comply with…
luboszima Jul 11, 2025
aec9ca2
fix: synology_api/drive_admin_console.py update docstrings to comply …
luboszima Jul 11, 2025
eff3394
Merge pull request #262 from luboszima/feat/update-numpydoc3
N4S4 Jul 11, 2025
d6df040
Merge pull request #263 from luboszima/feat/update-numpydoc4
N4S4 Jul 11, 2025
46b77cb
Merge pull request #264 from luboszima/feat/update-numpydoc5
N4S4 Jul 11, 2025
5229ead
Merge pull request #265 from luboszima/feat/update-numpydoc6
N4S4 Jul 11, 2025
9491057
fix: synology_api/error_codes.py update docstrings to comply with Num…
luboszima Jul 11, 2025
c37dff6
fix: synology_api/event_scheduler.py update docstrings to comply with…
luboszima Jul 12, 2025
b7ab667
fix: synology_api/exceptions.py update docstrings to comply with Nump…
luboszima Jul 12, 2025
cff3502
fix: synology_api/filestation.py update docstrings to comply with Num…
luboszima Jul 12, 2025
e143562
fix: synology_api/log_center.py update docstrings to comply with Nump…
luboszima Jul 12, 2025
535fe47
fix: synology_api/notestation.py update docstrings to comply with Num…
luboszima Jul 12, 2025
125f21e
fix: synology_api/oauth.py update docstrings to comply with Numpydoc …
luboszima Jul 12, 2025
76bbc6f
fix: synology_api/photos.py update docstrings to comply with Numpydoc…
luboszima Jul 12, 2025
bc761e1
fix: synology_api/security_advisor.py update docstrings to comply wit…
luboszima Jul 12, 2025
1dc34d6
fix: synology_api/snapshot.py update docstrings to comply with Numpyd…
luboszima Jul 12, 2025
67cafde
Merge pull request #266 from luboszima/feat/update-numpydoc7
N4S4 Jul 12, 2025
c1048d1
Merge pull request #267 from luboszima/feat/update-numpydoc8
N4S4 Jul 12, 2025
0ce3a17
Merge pull request #268 from luboszima/feat/update-numpydoc9
N4S4 Jul 12, 2025
c9ce3d7
fix: synology_api/surveillancestation.py update docstrings to comply …
luboszima Jul 12, 2025
cb05e58
fix: synology_api/task_scheduler.py update docstrings to comply with …
luboszima Jul 12, 2025
60fa934
fix: synology_api/universal_search.py update docstrings to comply wit…
luboszima Jul 12, 2025
a119ec3
fix: synology_api/usb_copy.py update docstrings to comply with Numpyd…
luboszima Jul 12, 2025
4e2ef5d
fix: synology_api/utils.py update docstrings to comply with Numpydoc …
luboszima Jul 12, 2025
435dbdd
fix: synology_api/virtualization.py update docstrings to comply with …
luboszima Jul 12, 2025
c127ab2
fix: synology_api/vpn.py update docstrings to comply with Numpydoc st…
luboszima Jul 12, 2025
57e37de
feat: add GitHub Actions workflow for pre-commit autoupdate
luboszima Jul 12, 2025
5a0d77d
Merge pull request #270 from luboszima/feat/update-numpydoc10
N4S4 Jul 12, 2025
a3af651
Merge pull request #271 from luboszima/feat/update-numpydoc11
N4S4 Jul 12, 2025
5ab7803
Merge pull request #272 from luboszima/feat/update-numpydoc12
N4S4 Jul 12, 2025
02211c3
Merge pull request #273 from luboszima/feat/add-gha-pre-commit-autoup…
N4S4 Jul 12, 2025
43e7808
feat: add pre-commit GitHub Actions workflow for validation
luboszima Jul 12, 2025
87e7af1
fix: update Python version in .tool-versions to 3.13.5
luboszima Jul 12, 2025
6caad5f
feat: specify files for numpydoc validation in pre-commit configuration
luboszima Jul 12, 2025
2594ae6
feat: add module docstring for Synology API Python Client
luboszima Jul 12, 2025
e79791e
Merge pull request #274 from luboszima/feat/add-pre-commit-gha-valida…
N4S4 Jul 12, 2025
861e9db
fix: add pydocstringformatter to development requirements
luboszima Jul 13, 2025
a6e6ac9
feat: add numpydoc linting and validation tasks to Taskfile
luboszima Jul 13, 2025
0dee92e
fix: improve docstring formatting across multiple files
luboszima Jul 13, 2025
bf684c4
fix: exclude PR09 check from numpydoc
luboszima Jul 13, 2025
0c60a82
fix: correct closing backticks in docstrings across multiple files
luboszima Jul 13, 2025
1cc0e9e
fix: escape special characters in docstring examples across multiple …
luboszima Jul 13, 2025
b911db6
fix: update test workflow for documentation generation
luboszima Jul 13, 2025
fafc32e
fix: add Python dependency installation step in deployment workflow
luboszima Jul 13, 2025
b74054f
fix: remove working-directory setting from documentation deployment w…
luboszima Jul 13, 2025
28b7044
fix: rename test-deploy.yml to test-docs.yml and update job name
luboszima Jul 13, 2025
eb199c9
fix: core_active_backup.py fix docstrings for docs_parser.py
luboszima Jul 13, 2025
721f225
fix: add --exit-on-warning flag to docs_parser.py for improved error …
luboszima Jul 13, 2025
0ba623f
fix: add --exit-on-warning flag to docs_parser.py in Taskfile.yml for…
luboszima Jul 13, 2025
3a4d5ef
chore(deps): bump on-headers and compression in /documentation
dependabot[bot] Jul 17, 2025
6d901bd
Merge pull request #276 from N4S4/dependabot/npm_and_yarn/documentati…
N4S4 Jul 17, 2025
0f158f2
Merge pull request #275 from luboszima/fix/docs-generation
N4S4 Jul 17, 2025
bd30001
add: Recursive constrain to `generate_file_tree`
kelreeeeey Aug 13, 2025
0dca6c0
add: Type annotation note
kelreeeeey Aug 13, 2025
550de65
Merge pull request #1 from kelreeeeey/dev-filestation
kelreeeeey Aug 13, 2025
6fe76fb
fix-precommit-issue: autopep and numpydoc-validation
kelreeeeey Aug 15, 2025
c855f93
Merge pull request #279 from kelreeeeey/master
N4S4 Aug 15, 2025
45c659d
Add:
FBoissadier Sep 8, 2025
d4b906a
Add:
FBoissadier Sep 8, 2025
9f1fff9
Fixing docstring to pass pre-commit tests
FBoissadier Sep 8, 2025
a050658
Fix missing new lines in docstrings
FBoissadier Sep 8, 2025
d68f463
Docstring fix
FBoissadier Sep 8, 2025
2990032
Docstring
FBoissadier Sep 8, 2025
2118fcc
Fixing trailing whitespaces and format autopep8
FBoissadier Sep 8, 2025
48f3f69
Adding ik_message to the login request to have full access to the Web…
FBoissadier Sep 9, 2025
d826403
Merge pull request #281 from FBoissadier/feature/add-encryption-share…
N4S4 Sep 9, 2025
135480f
Format document and trim whitespaces
FBoissadier Sep 11, 2025
1391e3a
Missing docstrings
FBoissadier Sep 11, 2025
88ee082
Fix docstring summary and trim whitespaces again
FBoissadier Sep 11, 2025
9baf026
Update requirements.txt with new packages and versions
FBoissadier Sep 12, 2025
5dc98ec
Merge branch 'master' into feature/reorganization-by-app
FBoissadier Sep 12, 2025
534e316
Fix docstrings
FBoissadier Sep 13, 2025
273d591
Udpate FileStation generate_file_tree
FBoissadier Sep 13, 2025
0525961
Implementation of Login Portal
FBoissadier Sep 13, 2025
8184b99
Merge pull request #282 from FBoissadier/feature/add-login-request-au…
N4S4 Sep 13, 2025
e6a7c74
Implementation of Notifications
FBoissadier Sep 14, 2025
bdb0746
Fix wrong api name
FBoissadier Sep 14, 2025
33d7a87
chore(deps): bump the python-packages group with 2 updates
dependabot[bot] Sep 15, 2025
9c54c8a
Merge pull request #284 from N4S4/dependabot/pip/python-packages-6c51…
N4S4 Sep 15, 2025
b6239be
Implementation of RegionalOptions
FBoissadier Sep 15, 2025
95279a0
chore(deps): bump the python-packages group across 1 directory with 2…
dependabot[bot] Sep 18, 2025
0a91a1e
Merge pull request #286 from N4S4/dependabot/pip/python-packages-c39c…
N4S4 Sep 18, 2025
e045c2f
Implementation of getters for Security tab
FBoissadier Sep 21, 2025
13897cb
chore(deps): bump pyyaml in the python-packages group
dependabot[bot] Sep 26, 2025
d82c9d4
Merge pull request #288 from N4S4/dependabot/pip/python-packages-ba9c…
N4S4 Sep 27, 2025
97e3356
chore(deps): bump cryptography in the python-packages group
dependabot[bot] Oct 1, 2025
2d91d94
feat: add get_task_list & download_task_list
joeperpetua Oct 1, 2025
89ed4cd
chore: fix docstrings
joeperpetua Oct 1, 2025
0126163
chore: run docs parser
joeperpetua Oct 1, 2025
7c2b457
chore: fix trailing whitespaces
joeperpetua Oct 1, 2025
7efc1d9
Merge pull request #291 from N4S4/dependabot/pip/python-packages-9d21…
N4S4 Oct 1, 2025
d8a0cc7
Merge pull request #292 from N4S4/feat/add-download-station-methods
N4S4 Oct 1, 2025
bf208b4
#fix `task_info` not working and additional parameters. added downloa…
Steve707-AE Oct 6, 2025
2e1d416
style: reformat with autopep8
Steve707-AE Oct 6, 2025
3803403
.gitignore remove edit
Steve707-AE Oct 6, 2025
d8319ef
Merge pull request #293 from Steve707-AE/master
N4S4 Oct 6, 2025
5e8d661
feat: added the feature to create a task from a torrent file instead …
Steve707-AE Oct 11, 2025
be9b862
#fix request_json explicit in create_task
Steve707-AE Oct 11, 2025
df53086
#fix numpydoc
Steve707-AE Oct 12, 2025
1051839
#fix .pre-commit-config.yaml `stages`
Steve707-AE Oct 12, 2025
8b26a00
#fix numpydocs
Steve707-AE Oct 12, 2025
b0f7e5c
#fix numpydocs
Steve707-AE Oct 12, 2025
f1e7113
Merge pull request #294 from Steve707-AE/feat/added_create_task_from_…
N4S4 Oct 13, 2025
69275a6
chore(deps): bump cryptography in the python-packages group
dependabot[bot] Oct 16, 2025
276ea3b
Merge pull request #295 from N4S4/dependabot/pip/python-packages-fea7…
N4S4 Oct 16, 2025
080f43e
#feat: ability to rename a file, validation on path while renaming, s…
Steve707-AE Oct 16, 2025
4381861
Merge pull request #296 from Steve707-AE/master
N4S4 Oct 17, 2025
970afb0
#feat: code improvements on `downloadstation.py`, `utils.py` and `fil…
Steve707-AE Oct 18, 2025
42d6db1
Merge pull request #297 from Steve707-AE/master
N4S4 Oct 19, 2025
5a52b48
chore(deps): bump psutil in the python-packages group
dependabot[bot] Oct 20, 2025
054f7f3
Merge pull request #298 from N4S4/dependabot/pip/python-packages-bcf5…
N4S4 Oct 20, 2025
ad2efed
chore(deps): bump psutil in the python-packages group
dependabot[bot] Oct 27, 2025
1749515
Merge pull request #299 from N4S4/dependabot/pip/python-packages-f748…
N4S4 Oct 27, 2025
9c61cf1
chore(deps): bump psutil in the python-packages group
dependabot[bot] Nov 3, 2025
0e86397
Merge pull request #300 from N4S4/dependabot/pip/python-packages-eec2…
N4S4 Nov 3, 2025
07e373a
Merge branch 'master' into feature/reorganization-by-app
FBoissadier Nov 8, 2025
0ec2a0d
Udpate get_file from filestation docstring.
FBoissadier Nov 9, 2025
c677448
Merge pull request #301 from FBoissadier/Update-Docstring
N4S4 Nov 9, 2025
76ecd74
Raise exception if Synology returns 400 or 500-level response
acourtneybrown Nov 10, 2025
f2f4932
Add missing deps to `setup.py` and reformat
acourtneybrown Nov 11, 2025
1f0b419
Add `noiseprotocol` package to `setup.py`
acourtneybrown Nov 11, 2025
e244fc4
Merge remote-tracking branch 'upstream/master'
acourtneybrown Nov 11, 2025
2300683
Merge remote-tracking branch 'origin/master' into request_data-raise_…
acourtneybrown Nov 11, 2025
0ccbbbe
Merge pull request #302 from acourtneybrown/master
N4S4 Nov 12, 2025
f2da459
Merge remote-tracking branch 'origin/master' into request_data-raise_…
acourtneybrown Nov 12, 2025
1f8cb9b
Merge pull request #303 from acourtneybrown/master
N4S4 Nov 14, 2025
88e5ce0
chore(deps): bump js-yaml from 3.14.1 to 3.14.2 in /documentation
dependabot[bot] Nov 17, 2025
3d2cc36
Merge pull request #304 from N4S4/dependabot/npm_and_yarn/documentati…
N4S4 Nov 17, 2025
0577852
update version
N4S4 Nov 21, 2025
7b9722e
Merge pull request #305 from N4S4/updatee_version
N4S4 Nov 21, 2025
f04a87a
chore(deps): bump node-forge from 1.3.1 to 1.3.2 in /documentation
dependabot[bot] Nov 26, 2025
5704a82
Merge pull request #308 from N4S4/dependabot/npm_and_yarn/documentati…
N4S4 Nov 27, 2025
5472f2e
chore(deps): bump mdast-util-to-hast in /documentation
dependabot[bot] Dec 2, 2025
ed1b604
Merge pull request #309 from N4S4/dependabot/npm_and_yarn/documentati…
N4S4 Dec 2, 2025
e610839
chore(deps): bump express from 4.21.2 to 4.22.1 in /documentation
dependabot[bot] Dec 2, 2025
dee4a98
Merge pull request #310 from N4S4/dependabot/npm_and_yarn/documentati…
N4S4 Dec 2, 2025
67aa2ba
chore(deps): bump urllib3 from 2.5.0 to 2.6.0
dependabot[bot] Dec 6, 2025
7ddc085
Merge pull request #311 from N4S4/dependabot/pip/urllib3-2.6.0
N4S4 Dec 6, 2025
71a5a1d
chore(deps): bump urllib3 in the python-packages group
dependabot[bot] Dec 9, 2025
357cf4e
Merge pull request #312 from N4S4/dependabot/pip/python-packages-9e09…
N4S4 Dec 11, 2025
6980d65
chore(deps): bump urllib3 in the python-packages group
dependabot[bot] Dec 12, 2025
9c0e9c5
Add some rss filter function
EddieKuo723 Feb 10, 2025
7bafaea
docs(downloadstation): add missing docstrings for RSS filter methods
EddieKuo723 Dec 13, 2025
6c63387
Merge pull request #313 from N4S4/dependabot/pip/python-packages-3c63…
N4S4 Dec 13, 2025
938f218
Merge branch 'N4S4:master' into master
EddieKuo723 Dec 14, 2025
f59e042
fix pep8 format
EddieKuo723 Dec 14, 2025
9129e51
Merge pull request #314 from EddieKuo723/master
N4S4 Dec 14, 2025
3fdb961
fix error 'file not found error' on ds.create_task(file_path)
Sanich137 Dec 16, 2025
17d664a
Merge pull request #315 from Sanich137/master
N4S4 Dec 16, 2025
080bb2c
Merge branch 'master' into feature/reorganization-by-app
FBoissadier Dec 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/pre-commit-autoupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: pre-commit

permissions:
contents: write
pull-requests: write

concurrency:
group: pre-commit-${{ github.ref }}-autoupdate
cancel-in-progress: true

on:
schedule:
- cron: '0 3 * * 1'
workflow_dispatch:

jobs:
autoupdate:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache asdf
uses: actions/cache@v4
with:
path: |
~/.asdf
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: |
${{ runner.os }}-asdf-
- uses: asdf-vm/actions/install@v4
- name: Run pre-commit autoupdate
id: pre_commit_autoupdate
run: |
pre-commit autoupdate
if git diff --quiet ".pre-commit-config.yaml"; then
echo "No changes to commit"
echo "autoupdate=false" >> "$GITHUB_ENV"
exit 0
fi
echo "autoupdate=true" >> "$GITHUB_ENV"
- name: Create Pull Request
if: success() && steps.pre_commit_autoupdate.outcome == 'success' && env.autoupdate == 'true'
uses: peter-evans/create-pull-request@v7
with:
title: "chore(pre-commit): autoupdate hooks"
body: "Automated pre-commit autoupdate."
commit-message: "chore(pre-commit): autoupdate hooks"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: pre-commit

concurrency:
group: pre-commit-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
push:
branches: [main]

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache asdf
uses: actions/cache@v4
with:
path: |
~/.asdf
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: |
${{ runner.os }}-asdf-
- uses: asdf-vm/actions/install@v4
- uses: pre-commit/action@v3.0.1
# env:
# SKIP: hook-id-to-skip
32 changes: 0 additions & 32 deletions .github/workflows/test-deploy.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: test-docs
defaults:
run:
shell: bash

on:
pull_request:
branches:
- master

jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache asdf
uses: actions/cache@v4
with:
path: |
~/.asdf
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: |
${{ runner.os }}-asdf-
- uses: asdf-vm/actions/install@v4
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- run: task docs
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,4 @@ FodyWeavers.xsd
*.sln.iml

# Test resources
tests/resources/config-test.json
tests/resources/config-test.json
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ci:
skip: [ pytest ]
skip: [pytest]

default_language_version:
python: python3.13

default_install_hook_types: [ pre-commit, pre-push, commit-msg ]
default_stages: [ pre-commit, pre-push, commit-msg ]
default_install_hook_types: [pre-commit, pre-push, commit-msg]
default_stages: [pre-commit, pre-push, commit-msg]

repos:
# general checks (see here: https://pre-commit.com/hooks.html)
Expand All @@ -23,6 +23,7 @@ repos:

- repo: https://github.com/numpy/numpydoc
rev: v1.9.0
stages: [ pre-commit ]
hooks:
- id: numpydoc-validation
- id: numpydoc-validation
stages: [pre-commit, manual]
files: ^synology_api/
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nodejs 18.18.0
python 3.9.6
python 3.13.5
task 3.44.0
shfmt 3.11.0
shellcheck 0.10.0
Expand Down
16 changes: 15 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ tasks:
dir: '{{.TASKFILE_DIR}}'
cmds:
- echo "Parsing the documentation files..."
- python3 docs_parser.py -a
- python3 docs_parser.py -a --exit-on-warning

docs-build:
desc: Build the documentation website
Expand Down Expand Up @@ -96,3 +96,17 @@ tasks:
cmds:
- echo "Validating numpydoc format..."
- pre-commit run numpydoc-validation -a

numpydoc-lint:
desc: Lint the numpydoc format of the documentation
dir: '{{.TASKFILE_DIR}}'
cmds:
- echo "Linting numpydoc format..."
- pydocstringformatter -w ./synology_api/

numpydoc:
desc: Lint and validate the numpydoc format of the documentation
dir: '{{.TASKFILE_DIR}}'
cmds:
- task: numpydoc-lint
- task: numpydoc-validation
36 changes: 36 additions & 0 deletions docs_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ def init_parser() -> argparse.ArgumentParser:
parser.add_argument('-e', '--excluded',
action='store_true',
help='Show a list of the excluded files to parse.')
parser.add_argument('--exit-on-warning',
action='store_true',
help='Exit if a warning is encountered.')

return parser

Expand Down Expand Up @@ -388,13 +391,38 @@ def write(path: str, content: str):
f.write(content)


class WarningCatcher:
def __init__(self):
self.warnings = []

def __call__(self, message, category, filename, lineno, file=None, line=None):
msg = warnings.formatwarning(message, category, filename, lineno, line)
self.warnings.append(msg)

def has_warnings(self):
return bool(self.warnings)

def print_warnings(self):
for w in self.warnings:
print(w, end='')


def main():
parser = init_parser()
files, parse_api_list, parse_docs = validate_args(parser)

# Setup warning catcher
warning_catcher = WarningCatcher()
warnings.showwarning = warning_catcher

# Generation for Getting Started/Supported APIs with all the APIs user per class.
supported_apis = gen_supported_apis()

# Check if --exit-on-warning flag is set
exit_on_warning = any(arg in ('--exit-on-warning',) for arg in sys.argv)

any_warning = False

for file_name in files:
doc_content = ''
file_path = join(PARSE_DIR, file_name)
Expand Down Expand Up @@ -427,10 +455,18 @@ def main():
if parse_docs:
write(DOCS_DIR + file_name.replace('.py', '.md'), doc_content)
print('='*20)

if warning_catcher.has_warnings():
any_warning = True
# else: continue to process all files

# Write to md files if the args were set
if parse_api_list:
write(API_LIST_FILE, supported_apis)

if any_warning and exit_on_warning:
sys.exit(1)


if __name__ == "__main__":
main()
Loading