Compare commits

..

20 commits

Author SHA1 Message Date
cb70268966 Merge pull request 'Update sonarsource/sonarqube-scan-action action to v2.1.0' (#80) from renovate/sonarsource-sonarqube-scan-action-2.x into master
All checks were successful
check code / check-docs (push) Successful in 8s
check code / check-code-py38 (push) Successful in 20s
check code / check-code-py39 (push) Successful in 28s
check code / check-code-py310 (push) Successful in 26s
check code / check-code-py311 (push) Successful in 19s
check code / scan-code-py311 (push) Successful in 7m22s
run scheduled tests / check-code-py311 (push) Successful in 6m50s
Reviewed-on: #80
2024-06-01 09:39:09 +02:00
98b14838e8 Update sonarsource/sonarqube-scan-action action to v2.1.0
All checks were successful
build package and container / build-pypackage (pull_request) Successful in 15s
check code / check-docs (pull_request) Successful in 6s
create release / release-pypackage (pull_request) Successful in 19s
build package and container / build-container (pull_request) Successful in 4m11s
check code / check-code-py38 (pull_request) Successful in 6m56s
check code / scan-code-py311 (pull_request) Has been skipped
check code / check-code-py39 (pull_request) Successful in 6m52s
check code / check-code-py310 (pull_request) Successful in 6m58s
check code / check-code-py311 (pull_request) Successful in 7m7s
2024-05-23 20:17:07 +02:00
4911f02303 Merge pull request 'Update dependency shellcheck to v0.10.0' (#76) from renovate/shellcheck-0.x into master
All checks were successful
check code / check-docs (push) Successful in 6s
check code / check-code-py38 (push) Successful in 1m28s
check code / check-code-py39 (push) Successful in 2m55s
check code / check-code-py310 (push) Successful in 3m40s
check code / scan-code-py311 (push) Successful in 9m41s
check code / check-code-py311 (push) Successful in 21s
run scheduled tests / check-code-py311 (push) Successful in 6m53s
Reviewed-on: #76
2024-04-16 12:40:49 +02:00
5a04db3cd4 Merge pull request 'Update dependency just to v1.25.2' (#75) from renovate/just-1.x into master
Some checks failed
check code / check-code-py310 (push) Blocked by required conditions
check code / check-code-py311 (push) Blocked by required conditions
check code / check-docs (push) Successful in 6s
check code / check-code-py38 (push) Successful in 56s
check code / scan-code-py311 (push) Has been cancelled
check code / check-code-py39 (push) Has been cancelled
Reviewed-on: #75
2024-04-16 12:38:39 +02:00
fe8b36c705 Merge pull request 'Update sonarsource/sonarqube-scan-action action to v2.0.2' (#78) from renovate/sonarsource-sonarqube-scan-action-2.x into master
All checks were successful
check code / check-docs (push) Successful in 6s
check code / check-code-py38 (push) Successful in 33s
check code / check-code-py39 (push) Successful in 25s
check code / check-code-py310 (push) Successful in 25s
check code / check-code-py311 (push) Successful in 25s
check code / scan-code-py311 (push) Successful in 7m30s
run scheduled tests / check-code-py311 (push) Successful in 7m16s
Reviewed-on: #78
2024-04-08 12:19:20 +02:00
1ceaff2d67 Update sonarsource/sonarqube-scan-action action to v2.0.2
All checks were successful
check code / check-docs (pull_request) Successful in 7s
build package and container / build-pypackage (pull_request) Successful in 18s
create release / release-pypackage (pull_request) Successful in 30s
build package and container / build-container (pull_request) Successful in 3m2s
check code / check-code-py38 (pull_request) Successful in 6m59s
check code / scan-code-py311 (pull_request) Has been skipped
check code / check-code-py39 (pull_request) Successful in 7m14s
check code / check-code-py310 (pull_request) Successful in 7m14s
check code / check-code-py311 (pull_request) Successful in 7m15s
2024-04-04 20:14:07 +02:00
f8422f7670 Update dependency just to v1.25.2
All checks were successful
build package and container / build-pypackage (pull_request) Successful in 13s
check code / check-docs (pull_request) Successful in 12s
create release / release-pypackage (pull_request) Successful in 35s
build package and container / build-container (pull_request) Successful in 3m31s
check code / check-code-py38 (pull_request) Successful in 6m56s
check code / scan-code-py311 (pull_request) Has been skipped
check code / check-code-py39 (pull_request) Successful in 6m48s
check code / check-code-py310 (pull_request) Successful in 6m53s
check code / check-code-py311 (pull_request) Successful in 7m5s
2024-03-11 08:15:46 +01:00
f7fa583735 Update dependency shellcheck to v0.10.0
All checks were successful
build package and container / build-pypackage (pull_request) Successful in 14s
build package and container / build-container (pull_request) Successful in 3m4s
check code / check-docs (pull_request) Successful in 7s
create release / release-pypackage (pull_request) Successful in 29s
check code / check-code-py38 (pull_request) Successful in 6m58s
check code / scan-code-py311 (pull_request) Has been skipped
check code / check-code-py39 (pull_request) Successful in 6m47s
check code / check-code-py310 (pull_request) Successful in 7m3s
check code / check-code-py311 (pull_request) Successful in 6m49s
2024-03-08 08:18:50 +01:00
5afd538dcd fix pyproject coverage
All checks were successful
check code / check-docs (push) Successful in 6s
check code / check-code-py38 (push) Successful in 26s
check code / check-code-py39 (push) Successful in 22s
check code / check-code-py310 (push) Successful in 30s
check code / check-code-py311 (push) Successful in 22s
check code / scan-code-py311 (push) Successful in 7m11s
2024-02-21 13:38:37 +01:00
ee8a34b760 update release action
Some checks failed
check code / check-docs (push) Successful in 6s
check code / check-code-py38 (push) Successful in 26s
check code / check-code-py39 (push) Successful in 27s
check code / check-code-py310 (push) Successful in 22s
check code / check-code-py311 (push) Successful in 24s
check code / scan-code-py311 (push) Has been cancelled
2024-02-21 13:35:42 +01:00
0dc7e2f60d update ruff settings and fix lint violations 2024-02-21 13:35:42 +01:00
a1bd82778f Merge pull request 'Update dependency shfmt to v3.8.0' (#72) from renovate/shfmt-3.x into master
All checks were successful
check code / check-docs (push) Successful in 7s
check code / check-code-py38 (push) Successful in 22s
check code / check-code-py39 (push) Successful in 26s
check code / check-code-py310 (push) Successful in 30s
check code / check-code-py311 (push) Successful in 24s
check code / scan-code-py311 (push) Successful in 7m2s
Reviewed-on: #72
2024-02-13 08:18:17 +01:00
ae4b796469 Update dependency shfmt to v3.8.0
All checks were successful
build package and container / build-pypackage (pull_request) Successful in 13s
check code / check-docs (pull_request) Successful in 5s
create release / release-pypackage (pull_request) Successful in 22s
build package and container / build-container (pull_request) Successful in 4m0s
check code / check-code-py38 (pull_request) Successful in 6m49s
check code / scan-code-py311 (pull_request) Has been skipped
check code / check-code-py39 (pull_request) Successful in 7m6s
check code / check-code-py310 (pull_request) Successful in 6m51s
check code / check-code-py311 (pull_request) Successful in 6m53s
2024-02-12 20:14:36 +01:00
3950cd1927 Merge pull request 'Update dependency just to v1.24.0' (#73) from renovate/just-1.x into master
All checks were successful
check code / check-docs (push) Successful in 6s
check code / check-code-py38 (push) Successful in 20s
check code / check-code-py39 (push) Successful in 19s
check code / check-code-py310 (push) Successful in 19s
check code / check-code-py311 (push) Successful in 24s
check code / scan-code-py311 (push) Successful in 7m12s
Reviewed-on: #73
2024-02-12 14:43:02 +01:00
4a2e90ddda Update dependency just to v1.24.0
All checks were successful
build package and container / build-pypackage (pull_request) Successful in 13s
check code / check-docs (pull_request) Successful in 5s
create release / release-pypackage (pull_request) Successful in 30s
build package and container / build-container (pull_request) Successful in 2m51s
check code / check-code-py38 (pull_request) Successful in 6m48s
check code / scan-code-py311 (pull_request) Has been skipped
check code / check-code-py39 (pull_request) Successful in 7m1s
check code / check-code-py310 (pull_request) Successful in 6m47s
check code / check-code-py311 (pull_request) Successful in 7m10s
2024-02-12 08:16:05 +01:00
e1276b5be9 Fix pytz requirement
All checks were successful
check code / check-docs (push) Successful in 6s
check code / check-code-py38 (push) Successful in 26s
check code / check-code-py39 (push) Successful in 26s
check code / check-code-py310 (push) Successful in 25s
check code / check-code-py311 (push) Successful in 25s
check code / scan-code-py311 (push) Successful in 6m59s
2024-02-02 10:14:46 +01:00
8d652d6732
run ci tests only on PR
All checks were successful
check code / check-docs (push) Successful in 7s
check code / check-code-py38 (push) Successful in 23s
check code / check-code-py39 (push) Successful in 23s
check code / check-code-py310 (push) Successful in 22s
check code / check-code-py311 (push) Successful in 24s
check code / scan-code-py311 (push) Successful in 7m10s
2024-02-01 20:44:48 +01:00
0d0e45f800
run all tests only on PR
Some checks failed
check code / scan-code-py311 (push) Blocked by required conditions
check code / check-code-py39 (push) Blocked by required conditions
check code / check-code-py310 (push) Blocked by required conditions
check code / check-code-py311 (push) Blocked by required conditions
check code / check-docs (push) Successful in 7s
check code / check-code-py38 (push) Has been cancelled
2024-02-01 20:42:32 +01:00
01a56734f2 some ci fixes [skip ci]
All checks were successful
check code / check-docs (push) Successful in 7s
check code / check-code-py38 (push) Successful in 7m6s
check code / check-code-py39 (push) Successful in 7m7s
check code / check-code-py310 (push) Successful in 7m8s
check code / check-code-py311 (push) Successful in 6m52s
check code / scan-code-py311 (push) Successful in 7m2s
2024-02-01 16:02:22 +01:00
ed2dfd414c update badges in readme [skip ci] 2024-02-01 15:59:25 +01:00
14 changed files with 119 additions and 154 deletions

View file

@ -90,6 +90,7 @@ jobs:
- name: update dockerhub repo description - name: update dockerhub repo description
uses: peter-evans/dockerhub-description@v3 uses: peter-evans/dockerhub-description@v3
if: gitea.event_name != 'pull_request'
with: with:
repository: ${{ env.AUTHOR }}/${{ env.IMAGE }} repository: ${{ env.AUTHOR }}/${{ env.IMAGE }}
short-description: ${{ github.event.repository.description }} short-description: ${{ github.event.repository.description }}

View file

@ -23,6 +23,7 @@ jobs:
scan-code-py311: scan-code-py311:
runs-on: python311 runs-on: python311
if: gitea.event_name != 'pull_request' if: gitea.event_name != 'pull_request'
needs: [check-code-py38]
steps: steps:
- name: checkout code - name: checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -36,7 +37,7 @@ jobs:
run: hatch run default:cov run: hatch run default:cov
- name: run sonar-scanner - name: run sonar-scanner
uses: sonarsource/sonarqube-scan-action@v2.0.1 uses: sonarsource/sonarqube-scan-action@v2.1.0
env: env:
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
@ -57,10 +58,12 @@ jobs:
run: hatch run +py=3.8 lint:typing run: hatch run +py=3.8 lint:typing
- name: run tests - name: run tests
if: gitea.event_name == 'pull_request'
run: hatch run default:test run: hatch run default:test
check-code-py39: check-code-py39:
runs-on: python39 runs-on: python39
needs: [check-code-py38]
steps: steps:
- name: checkout code - name: checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -75,10 +78,12 @@ jobs:
run: hatch run +py=3.9 lint:typing run: hatch run +py=3.9 lint:typing
- name: run tests - name: run tests
if: gitea.event_name == 'pull_request'
run: hatch run default:test run: hatch run default:test
check-code-py310: check-code-py310:
runs-on: python310 runs-on: python310
needs: [check-code-py39]
steps: steps:
- name: checkout code - name: checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -93,10 +98,12 @@ jobs:
run: hatch run +py=3.10 lint:typing run: hatch run +py=3.10 lint:typing
- name: run tests - name: run tests
if: gitea.event_name == 'pull_request'
run: hatch run default:test run: hatch run default:test
check-code-py311: check-code-py311:
runs-on: python311 runs-on: python311
needs: [check-code-py310]
steps: steps:
- name: checkout code - name: checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -111,4 +118,5 @@ jobs:
run: hatch run +py=3.11 lint:typing run: hatch run +py=3.11 lint:typing
- name: run tests - name: run tests
if: gitea.event_name == 'pull_request'
run: hatch run default:test run: hatch run default:test

View file

@ -30,30 +30,27 @@ jobs:
- name: build package - name: build package
run: hatch build --clean run: hatch build --clean
- name: create release notes - name: get release notes
run: bash get_release_notes.sh latest id: release-notes
uses: olofvndrhr/releasenote-gen@v1
- name: read changelog
id: changelog
uses: juliangruber/read-file-action@v1
with:
path: ./RELEASENOTES.md
- name: create gitea release - name: create gitea release
uses: https://gitea.com/actions/release-action@main uses: https://gitea.com/actions/release-action@main
if: gitea.event_name != 'pull_request' if: gitea.event_name != 'pull_request'
with: with:
title: ${{ gitea.ref_name }} title: ${{ gitea.ref_name }}
body: ${{ steps.changelog.outputs.content }} body: ${{ steps.release-notes.outputs.releasenotes }}
files: |- files: |-
dist/** dist/**
- name: create github release - name: create github release
uses: softprops/action-gh-release@v1 uses: ncipollo/release-action@v1
if: gitea.event_name != 'pull_request' if: gitea.event_name != 'pull_request'
with: with:
token: ${{ secrets.GH_TOKEN }} token: ${{ secrets.GH_TOKEN }}
title: ${{ gitea.ref_name }} owner: olofvndrhr
body: ${{ steps.changelog.outputs.content }} repo: manga-dlp
files: |- name: ${{ gitea.ref_name }}
body: ${{ steps.release-notes.outputs.releasenotes }}
artifacts: |-
dist/** dist/**

View file

@ -1,8 +1,6 @@
name: run scheduled tests name: run scheduled tests
on: on:
issue_comment:
schedule: schedule:
- cron: "0 20 * * 6" - cron: "0 20 * * 6"

View file

@ -1,4 +1,4 @@
shellcheck 0.9.0 shellcheck 0.10.0
shfmt 3.7.0 shfmt 3.8.0
just 1.23.0 just 1.25.2
lefthook 1.4.6 lefthook 1.4.6

View file

@ -2,29 +2,23 @@
> Full docs: https://manga-dlp.ivn.sh > Full docs: https://manga-dlp.ivn.sh
CI/CD
[![status-badge](https://img.shields.io/drone/build/olofvndrhr/manga-dlp?label=tests&server=https%3A%2F%2Fci.44net.ch)](https://ci.44net.ch/olofvndrhr/manga-dlp)
[![Last Release](https://img.shields.io/github/release-date/olofvndrhr/manga-DLP?label=last%20release)](https://github.com/olofvndrhr/manga-dlp/releases)
[![Version](https://img.shields.io/github/v/release/olofvndrhr/manga-dlp?label=git%20release)](https://github.com/olofvndrhr/manga-dlp/releases)
[![Version PyPi](https://img.shields.io/pypi/v/manga-dlp?label=pypi%20release)](https://pypi.org/project/manga-dlp/)
Code Analysis Code Analysis
[![Quality Gate Status](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=alert_status&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
[![Coverage](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=coverage&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp) [![Coverage](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=coverage&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
[![Bugs](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=bugs&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp) [![Bugs](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=bugs&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
[![Security](https://img.shields.io/snyk/vulnerabilities/github/olofvndrhr/manga-dlp)](https://app.snyk.io/org/olofvndrhr-t6h/project/aae9609d-a4e4-41f8-b1ac-f2561b2ad4e3) [![Maintainability Rating](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=sqale_rating&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
[![Reliability Rating](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=reliability_rating&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
[![Security Rating](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=security_rating&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
Meta Meta
[![Code style](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black) [![Formatter](https://img.shields.io/badge/code%20style-ruff-black)](https://github.com/charliermarsh/ruff)
[![Linter](https://img.shields.io/badge/linter-ruff-red)](https://github.com/charliermarsh/ruff) [![Linter](https://img.shields.io/badge/linter-ruff-red)](https://github.com/charliermarsh/ruff)
[![Types](https://img.shields.io/badge/types-pyright-blue)](https://github.com/microsoft/pyright) [![Types](https://img.shields.io/badge/types-mypy-blue)](https://github.com/python/mypy)
[![Tests](https://img.shields.io/badge/tests-pytest%20%7C%20tox-yellow)](https://github.com/pytest-dev/pytest/) [![Tests](https://img.shields.io/badge/tests-pytest%20%7C%20tox-yellow)](https://github.com/pytest-dev/pytest/)
[![Coverage](https://img.shields.io/badge/coverage-coveragepy-green)](https://github.com/nedbat/coveragepy) [![Coverage](https://img.shields.io/badge/coverage-coveragepy-green)](https://github.com/nedbat/coveragepy)
[![License](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://snyk.io/learn/what-is-mit-license/) [![License](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://snyk.io/learn/what-is-mit-license/)
[![Compatibility](https://img.shields.io/pypi/pyversions/manga-dlp)](https://pypi.org/project/manga-dlp/) [![Compatibility](https://img.shields.io/badge/python-3.11-blue)]()
--- ---
@ -42,19 +36,19 @@ you just want the folder with all the pictures use the flag `--format ""`.
## _Currently_ Supported sites ## _Currently_ Supported sites
- [Mangadex.org](https://mangadex.org/) - [Mangadex.org](https://mangadex.org/)
## Features (not complete) ## Features (not complete)
- Metadata support with [ComicInfo.xml](https://anansi-project.github.io/docs/comicinfo/intro) - Metadata support with [ComicInfo.xml](https://anansi-project.github.io/docs/comicinfo/intro)
- Json caching - Json caching
- Custom hooks after/before each download - Custom hooks after/before each download
- Custom chapter name format - Custom chapter name format
- Volume support - Volume support
- Multiple archive formats supported (cbz,cbr,zip,none) - Multiple archive formats supported (cbz,cbr,zip,none)
- Language selection - Language selection
- Download all chapters directly - Download all chapters directly
- And others... - And others...
## Usage ## Usage
@ -146,10 +140,10 @@ If you encounter any bugs, also just open an issue with a description of the pro
## TODO's ## TODO's
- <del>Make docker container for easy distribution</del> - <del>Make docker container for easy distribution</del>
--> [Dockerhub](https://hub.docker.com/r/olofvndrhr/manga-dlp) --> [Dockerhub](https://hub.docker.com/r/olofvndrhr/manga-dlp)
- <del>Automate release</del> - <del>Automate release</del>
--> Done with woodpecker-ci --> Done with woodpecker-ci
- <del>Make pypi package</del> - <del>Make pypi package</del>
--> Done with release [2.1.7](https://pypi.org/project/manga-dlp/) --> Done with release [2.1.7](https://pypi.org/project/manga-dlp/)
- Add more supported sites - Add more supported sites

View file

@ -1,4 +1,4 @@
from typing import Dict, List, Union from typing import Dict, List
from mangadlp.models import ChapterData, ComicInfo from mangadlp.models import ChapterData, ComicInfo
@ -40,7 +40,7 @@ class YourAPI:
self.manga_uuid = "abc" self.manga_uuid = "abc"
self.manga_title = "abc" self.manga_title = "abc"
self.chapter_list = ["1", "2", "2.1", "5", "10"] self.chapter_list = ["1", "2", "2.1", "5", "10"]
self.manga_chapter_data: dict[str, ChapterData] = { # example data self.manga_chapter_data: Dict[str, ChapterData] = { # example data
"1": { "1": {
"uuid": "abc", "uuid": "abc",
"volume": "1", "volume": "1",
@ -57,7 +57,7 @@ class YourAPI:
}, },
} }
# or with --forcevol # or with --forcevol
self.manga_chapter_data: dict[str, ChapterData] = { self.manga_chapter_data: Dict[str, ChapterData] = {
"1:1": { "1:1": {
"uuid": "abc", "uuid": "abc",
"volume": "1", "volume": "1",
@ -72,7 +72,7 @@ class YourAPI:
}, },
} }
def get_chapter_images(self, chapter: str, wait_time: float) -> list[str]: def get_chapter_images(self, chapter: str, wait_time: float) -> List[str]:
"""Get chapter images as a list (full links). """Get chapter images as a list (full links).
Args: Args:

View file

@ -1,52 +0,0 @@
#!/bin/bash
# shellcheck disable=SC2016
# script to extract the release notes from the changelog
# show script help
function show_help() {
cat << EOF
Script to generate release-notes from a changelog (CHANGELOG.md)
Usage:
./get_release_notes.sh <new_version>
Example:
./get_release_notes.sh "2.0.5"
or
./get_release_notes.sh "latest"
EOF
exit 0
}
# create changelog for release
function get_release_notes() {
local l_version="${1}"
printf 'Creating release-notes\n'
# check for version
if [[ -z "${l_version}" ]]; then
printf 'You need to specify a version with $1\n'
exit 1
fi
if [[ ${l_version,,} == "latest" ]]; then
l_version="$(grep -o -E "^##\s\[[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}\]" CHANGELOG.md | head -n 1 | grep -o -E "[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}")"
fi
awk -v ver="[${l_version}]" \
'/^## / { if (p) { exit }; if ($2 == ver) { p=1 } } p && NF' \
'CHANGELOG.md' > 'RELEASENOTES.md'
printf 'Done\n'
}
# check options
case "${1}" in
'--help' | '-h' | 'help')
show_help
;;
*)
get_release_notes "${@}"
;;
esac

View file

@ -6,7 +6,7 @@ set shell := ["bash", "-uc"]
set dotenv-load set dotenv-load
show_receipts: show_receipts:
@just --list just --list
show_system_info: show_system_info:
@echo "==================================" @echo "=================================="
@ -18,58 +18,58 @@ show_system_info:
@echo "==================================" @echo "=================================="
setup: setup:
@asdf install asdf install
@lefthook install lefthook install
create_venv: create_venv:
@echo "creating venv" @echo "creating venv"
@python3 -m pip install --upgrade pip setuptools wheel python3 -m pip install --upgrade pip setuptools wheel
@python3 -m venv venv python3 -m venv venv
install_deps: install_deps:
@echo "installing dependencies" @echo "installing dependencies"
@python3 -m hatch dep show requirements --project-only > /tmp/requirements.txt python3 -m hatch dep show requirements --project-only > /tmp/requirements.txt
@pip3 install -r /tmp/requirements.txt pip3 install -r /tmp/requirements.txt
install_deps_dev: install_deps_dev:
@echo "installing dev dependencies" @echo "installing dev dependencies"
@python3 -m hatch dep show requirements --project-only > /tmp/requirements.txt python3 -m hatch dep show requirements --project-only > /tmp/requirements.txt
@python3 -m hatch dep show requirements --env-only >> /tmp/requirements.txt python3 -m hatch dep show requirements --env-only >> /tmp/requirements.txt
@pip3 install -r /tmp/requirements.txt pip3 install -r /tmp/requirements.txt
create_reqs: create_reqs:
@echo "creating requirements" @echo "creating requirements"
@pipreqs --force --savepath requirements.txt src/mangadlp/ pipreqs --force --savepath requirements.txt src/mangadlp/
test_shfmt: test_shfmt:
@find . -type f \( -name "**.sh" -and -not -path "./.**" -and -not -path "./venv**" \) -exec shfmt -d -i 4 -bn -ci -sr "{}" \+; find . -type f \( -name "**.sh" -and -not -path "./.**" -and -not -path "./venv**" \) -exec shfmt -d -i 4 -bn -ci -sr "{}" \+;
format_shfmt: format_shfmt:
@find . -type f \( -name "**.sh" -and -not -path "./.**" -and -not -path "./venv**" \) -exec shfmt -w -i 4 -bn -ci -sr "{}" \+; find . -type f \( -name "**.sh" -and -not -path "./.**" -and -not -path "./venv**" \) -exec shfmt -w -i 4 -bn -ci -sr "{}" \+;
lint: lint:
just show_system_info just show_system_info
just test_shfmt just test_shfmt
@hatch run lint:style hatch run lint:style
@hatch run lint:typing hatch run lint:typing
format: format:
just show_system_info just show_system_info
just format_shfmt just format_shfmt
@hatch run lint:fmt hatch run lint:fmt
check: check:
just format
just lint just lint
just format
test: test:
@hatch run default:test hatch run default:test
coverage: coverage:
@hatch run default:cov hatch run default:cov
build: build:
@hatch build --clean hatch build --clean
run loglevel *flags: run loglevel *flags:
@hatch run mangadlp --loglevel {{loglevel}} {{flags}} hatch run mangadlp --loglevel {{loglevel}} {{flags}}

View file

@ -27,7 +27,7 @@ dependencies = [
"click-option-group>=0.5.5", "click-option-group>=0.5.5",
"xmltodict>=0.13.0", "xmltodict>=0.13.0",
"img2pdf>=0.4.4", "img2pdf>=0.4.4",
"pytz==2022.1", "pytz>=2022.1",
] ]
[project.urls] [project.urls]
@ -45,18 +45,18 @@ source = "regex_commit"
path = "src/mangadlp/__about__.py" path = "src/mangadlp/__about__.py"
tag_sign = false tag_sign = false
[tool.hatch.build]
ignore-vcs = true
[tool.hatch.build.targets.sdist] [tool.hatch.build.targets.sdist]
packages = ["src/mangadlp"] packages = ["src/mangadlp"]
[tool.hatch.build.targets.wheel] [tool.hatch.build.targets.wheel]
packages = ["src/mangadlp"] packages = ["src/mangadlp"]
###
### envs ### envs
###
[tool.hatch.envs.default] [tool.hatch.envs.default]
python = "3.11"
dependencies = [ dependencies = [
"pytest==7.4.3", "pytest==7.4.3",
"coverage==7.3.2", "coverage==7.3.2",
@ -76,17 +76,26 @@ python = ["3.8", "3.9", "3.10", "3.11"]
[tool.hatch.envs.lint] [tool.hatch.envs.lint]
detached = true detached = true
dependencies = [ dependencies = [
"mypy==1.7.1", "mypy==1.8.0",
"ruff==0.1.7", "ruff==0.2.2",
] ]
[tool.hatch.envs.lint.scripts] [tool.hatch.envs.lint.scripts]
typing = "mypy --non-interactive --install-types {args:src/mangadlp}" typing = "mypy --non-interactive --install-types {args:src/mangadlp}"
style = ["ruff check --diff {args:src/mangadlp}", "ruff format --check --diff {args:src/mangadlp}"] style = [
fmt = ["ruff format {args:src/mangadlp}", "ruff check --fix {args:src/mangadlp}", "style"] "ruff check --diff {args:.}",
"ruff format --check --diff {args:.}"
]
fmt = [
"ruff check --fix {args:.}",
"ruff format {args:.}",
"style"
]
all = ["style", "typing"] all = ["style", "typing"]
###
### ruff ### ruff
###
[tool.ruff] [tool.ruff]
target-version = "py38" target-version = "py38"
@ -94,7 +103,6 @@ line-length = 100
indent-width = 4 indent-width = 4
fix = true fix = true
show-fixes = true show-fixes = true
ignore-init-module-imports = true
respect-gitignore = true respect-gitignore = true
src = ["src", "tests"] src = ["src", "tests"]
exclude = [ exclude = [
@ -112,6 +120,7 @@ exclude = [
"dist", "dist",
"node_modules", "node_modules",
"venv", "venv",
"contrib"
] ]
[tool.ruff.lint] [tool.ruff.lint]
@ -142,6 +151,7 @@ select = [
"W", "W",
"YTT", "YTT",
] ]
ignore-init-module-imports = true
ignore = ["E501", "D103", "D100", "D102", "PLR2004", "D403", "ISC001", "FBT001", "FBT002", "FBT003", "W505"] ignore = ["E501", "D103", "D100", "D102", "PLR2004", "D403", "ISC001", "FBT001", "FBT002", "FBT003", "W505"]
unfixable = ["F401"] unfixable = ["F401"]
@ -150,39 +160,42 @@ quote-style = "double"
indent-style = "space" indent-style = "space"
skip-magic-trailing-comma = false skip-magic-trailing-comma = false
line-ending = "lf" line-ending = "lf"
docstring-code-format = true
[tool.ruff.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"__init__.py" = ["D104"] "__init__.py" = ["D104"]
"__about__.py" = ["D104", "F841"] "__about__.py" = ["D104", "F841"]
"tests/**/*" = ["PLR2004", "S101", "TID252"] "tests/**/*" = ["PLR2004", "S101", "TID252", "T201", "ARG001", "S603", "S605"]
[tool.ruff.pyupgrade] [tool.ruff.lint.pyupgrade]
keep-runtime-typing = true keep-runtime-typing = true
[tool.ruff.isort] [tool.ruff.lint.isort]
lines-after-imports = 2 lines-after-imports = 2
known-first-party = ["mangadlp"] known-first-party = ["mangadlp"]
[tool.ruff.flake8-tidy-imports] [tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all" ban-relative-imports = "all"
[tool.ruff.pylint] [tool.ruff.lint.pylint]
max-branches = 24 max-branches = 24
max-returns = 12 max-returns = 12
max-statements = 100 max-statements = 100
max-args = 15 max-args = 15
allow-magic-value-types = ["str", "bytes", "complex", "float", "int"] allow-magic-value-types = ["str", "bytes", "complex", "float", "int"]
[tool.ruff.mccabe] [tool.ruff.lint.mccabe]
max-complexity = 15 max-complexity = 15
[tool.ruff.pydocstyle] [tool.ruff.lint.pydocstyle]
convention = "google" convention = "google"
[tool.ruff.pycodestyle] [tool.ruff.lint.pycodestyle]
max-doc-length = 100 max-doc-length = 100
###
### mypy ### mypy
###
[tool.mypy] [tool.mypy]
#plugins = ["pydantic.mypy"] #plugins = ["pydantic.mypy"]
@ -204,16 +217,20 @@ show_error_context = true
#init_typed = true #init_typed = true
#warn_required_dynamic_aliases = true #warn_required_dynamic_aliases = true
###
### pytest ### pytest
###
[tool.pytest.ini_options] [tool.pytest.ini_options]
pythonpath = ["src"] pythonpath = ["src"]
addopts = "--color=yes --exitfirst --verbose -ra" addopts = "--color=yes --exitfirst --verbose -ra"
#addopts = "--color=yes --exitfirst --verbose -ra --capture=tee-sys"
filterwarnings = [ filterwarnings = [
'ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning', 'ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning',
] ]
###
### coverage ### coverage
###
[tool.coverage.run] [tool.coverage.run]
source_pkgs = ["mangadlp", "tests"] source_pkgs = ["mangadlp", "tests"]
@ -222,8 +239,8 @@ parallel = true
omit = ["src/mangadlp/__about__.py"] omit = ["src/mangadlp/__about__.py"]
[tool.coverage.paths] [tool.coverage.paths]
testproj = ["src/mangadlp", "*/mangadlp/src/mangadlp"] mangadlp = ["src/mangadlp", "*/manga-dlp/src/mangadlp"]
tests = ["tests", "*/mangadlp/tests"] tests = ["tests", "*/manga-dlp/tests"]
[tool.coverage.report] [tool.coverage.report]
# Regexes for lines to exclude from consideration # Regexes for lines to exclude from consideration

View file

@ -1,5 +1,6 @@
import shutil import shutil
from pathlib import Path from pathlib import Path
from typing import List
import pytest import pytest
import requests import requests
@ -18,7 +19,7 @@ def test_downloader():
] ]
chapter_path = Path("tests/test_folder1") chapter_path = Path("tests/test_folder1")
chapter_path.mkdir(parents=True, exist_ok=True) chapter_path.mkdir(parents=True, exist_ok=True)
images: list[str] = [] images: List[str] = []
downloader.download_chapter(urls, str(chapter_path), 2) downloader.download_chapter(urls, str(chapter_path), 2)
for file in chapter_path.iterdir(): for file in chapter_path.iterdir():
images.append(file.name) images.append(file.name)

View file

@ -3,6 +3,7 @@ import platform
import shutil import shutil
import time import time
from pathlib import Path from pathlib import Path
from typing import List
import pytest import pytest
from pytest import MonkeyPatch from pytest import MonkeyPatch
@ -165,7 +166,7 @@ def test_full_with_input_skip_folder(wait_10s: MonkeyPatch):
chapter_path.mkdir(parents=True, exist_ok=True) chapter_path.mkdir(parents=True, exist_ok=True)
os.system(f"python3 {script_path} {command_args}") os.system(f"python3 {script_path} {command_args}")
found_files: list[str] = [] found_files: List[str] = []
for file in chapter_path.iterdir(): for file in chapter_path.iterdir():
found_files.append(file.name) found_files.append(file.name)