diff --git a/.github/workflows/ci-main-test-coverage-deploy.yml b/.github/workflows/ci-main-test-coverage-deploy.yml index 47fbe1839..450f873ab 100644 --- a/.github/workflows/ci-main-test-coverage-deploy.yml +++ b/.github/workflows/ci-main-test-coverage-deploy.yml @@ -217,7 +217,7 @@ jobs: NEW_HEARTBEAT_ENDPOINT=${{ secrets.NEW_HEARTBEAT_ENDPOINT }} APP_VERSION=main push: true -# platforms: linux/arm64, linux/amd64, linux/arm/v7, linux/386 + # platforms: linux/arm64, linux/amd64, linux/arm/v7, linux/386 platforms: linux/arm64, linux/amd64 tags: mandarons/icloud-drive:main cache-from: type=local,src=/tmp/.buildx-cache diff --git a/.github/workflows/official-release-to-docker-hub.yml b/.github/workflows/official-release-to-docker-hub.yml index d8360b4f7..c7458b451 100644 --- a/.github/workflows/official-release-to-docker-hub.yml +++ b/.github/workflows/official-release-to-docker-hub.yml @@ -62,7 +62,7 @@ jobs: NEW_HEARTBEAT_ENDPOINT=${{ secrets.NEW_HEARTBEAT_ENDPOINT }} APP_VERSION=${{ steps.prep.outputs.version }} push: true -# platforms: linux/386,linux/amd64, linux/arm64, linux/arm/7 + # platforms: linux/386,linux/amd64, linux/arm64, linux/arm/7 platforms: linux/386,linux/amd64, linux/arm64 tags: ${{ steps.prep.outputs.tags }} cache-from: type=local,src=/tmp/.buildx-cache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 025dbb92d..1235be6ba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,49 +1,92 @@ repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.3 + hooks: + - id: ruff + args: + - --fix + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 23.10.1 + hooks: + - id: black + args: + - --quiet + files: ^((src|tests)/.+)?[^/]+\.py$ + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + args: + - --skip="./.*,*.csv,*.json" + - --quiet-level=2 + exclude: ^tests/data/ + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-executables-have-shebangs + stages: [manual] + - id: check-json + exclude: (.vscode|.devcontainer) + - id: no-commit-to-branch + args: + - --branch=main + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.32.0 + hooks: + - id: yamllint + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.0.3 + hooks: + - id: prettier + - repo: https://github.com/cdce8p/python-typing-update + rev: v0.6.0 + hooks: + # Run `python-typing-update` hook manually from time to time + # to update python typing syntax. + # Will require manual work, before submitting changes! + # pre-commit run --hook-stage manual python-typing-update --all-files + - id: python-typing-update + stages: [manual] + args: + - --py311-plus + - --force + - --keep-updates + files: ^(src|tests)/.+\.py$ + - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.15.0 hooks: - id: pyupgrade args: [--py39-plus] - repo: https://github.com/PyCQA/autoflake - rev: v2.0.0 + rev: v2.2.1 hooks: - id: autoflake args: - --in-place - --remove-all-unused-imports - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.10.1 hooks: - id: black args: - --quiet files: ^((src|tests)/.+)?[^/]+\.py$ - - - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 - hooks: - - id: codespell - args: - # - --ignore-words-list=additionals,alle,alot,ba,bre,bund,datas,dof,dur,ether,farenheit,falsy,fo,haa,hass,hist,iam,iff,iif,incomfort,ines,ist,lightsensor,mut,nam,nd,pres,pullrequests,referer,resset,rime,ser,serie,sur,te,technik,ue,uint,unsecure,visability,wan,wanna,withing,zar - - --skip="./.*,*.csv,*.json" - - --quiet-level=2 - # exclude_types: [csv, json] - exclude: ^tests/data/ - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: - id: flake8 additional_dependencies: - - pycodestyle==2.10.0 - - pyflakes==3.0.1 - - flake8-docstrings==1.6.0 - - pydocstyle==6.1.1 - - flake8-comprehensions==3.10.1 - - flake8-noqa==1.3.0 - - mccabe==0.7.0 + - pycodestyle + - pyflakes + - flake8-docstrings + - pydocstyle + - flake8-comprehensions + - flake8-noqa + - mccabe files: ^(src|tests)/.+\.py$ - repo: https://github.com/PyCQA/bandit - rev: 1.7.4 + rev: 1.7.5 hooks: - id: bandit args: @@ -57,38 +100,6 @@ repos: - id: isort args: - --profile=black - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 - hooks: - - id: check-executables-have-shebangs - stages: [manual] - - id: check-json - exclude: (.vscode|.devcontainer) - - id: no-commit-to-branch - args: - - --branch=main - - repo: https://github.com/adrienverge/yamllint.git - rev: v1.28.0 - hooks: - - id: yamllint - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.7.1 - hooks: - - id: prettier - # - repo: https://github.com/cdce8p/python-typing-update - # rev: v0.5.0 - # hooks: - # # Run `python-typing-update` hook manually from time to time - # # to update python typing syntax. - # # Will require manual work, before submitting changes! - # # pre-commit run --hook-stage manual python-typing-update --all-files - # - id: python-typing-update - # stages: [manual] - # args: - # - --py39-plus - # - --force - # - --keep-updates - # files: ^(src|tests)/.+\.py$ - repo: local hooks: # - id: mypy diff --git a/.vscode/launch.json b/.vscode/launch.json index c9a087a57..a6e1be28e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -15,6 +15,13 @@ "env": { "PYTHONPATH": "${workspaceFolder}" } + }, + { + "name": "Python: Debug Tests", + "type": "python", + "request": "attach", + "purpose": ["debug-test"], + "justMyCode": false } ] } diff --git a/README.md b/README.md index cdb3ec8f4..87bd19d67 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ photos: destination: "photos" remove_obsolete: false sync_interval: 500 - all_albums: false # Optional, default false. If true preserve album structure. If same photo is in multpile albums creates duplicates on filesystem + all_albums: false # Optional, default false. If true preserve album structure. If same photo is in multiple albums creates duplicates on filesystem folder_format: "%Y/%m" # optional, if set put photos in subfolders according to format. Format cheatsheet - https://strftime.org filters: # List of libraries to download. If omitted (default), photos from all libraries (own and shared) are downloaded. If included, photos only diff --git a/USAGE.md b/USAGE.md index 08f88fcff..e521f7fdf 100644 --- a/USAGE.md +++ b/USAGE.md @@ -1,4 +1,5 @@ -### ICloud-Drive-Docker Usage +### ICloud-Drive-Docker Usage + We collect following information to analyze usage of `mandarons/icloud-drive-docker` project: 1. `Application version` - to track which versions of `mandarons/icloud-drive-docker` are currently in use diff --git a/config.yaml b/config.yaml index c796a09f3..1f0d5dcc7 100644 --- a/config.yaml +++ b/config.yaml @@ -45,7 +45,7 @@ photos: destination: "photos" remove_obsolete: false sync_interval: 500 - all_albums: false # Optional, default false. If true preserve album structure. If same photo is in multpile albums creates duplicates on filesystem + all_albums: false # Optional, default false. If true preserve album structure. If same photo is in multiple albums creates duplicates on filesystem # folder_format: "%Y/%m" # optional, if set put photos in subfolders according to format. Format cheatsheet - https://strftime.org filters: # List of libraries to download. If omitted (default), photos from all libraries (own and shared) are downloaded. If included, photos only diff --git a/src/notify.py b/src/notify.py index 7a6967416..9d9be81ec 100644 --- a/src/notify.py +++ b/src/notify.py @@ -40,7 +40,7 @@ def send(config, last_send=None, dry_run=False): smtp.sendmail(from_addr=email, to_addrs=to_email, msg=msg.as_string()) smtp.quit() - except (Exception) as e: + except Exception as e: sent_on = None LOGGER.error(f"Failed to send email: {str(e)}.") else: diff --git a/tests/bandit.yaml b/tests/bandit.yaml index 568f77d62..46566cc98 100644 --- a/tests/bandit.yaml +++ b/tests/bandit.yaml @@ -13,7 +13,6 @@ tests: - B318 - B319 - B320 - - B325 - B601 - B602 - B604