diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 0766c0f..f2feb00 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -7,23 +7,52 @@ directory: / schedule: interval: weekly + groups: + cargo: + patterns: + - "*" + - package-ecosystem: gitsubmodule directory: / schedule: interval: weekly + groups: + gitsubmodule: + patterns: + - "*" + - package-ecosystem: github-actions directory: / schedule: interval: weekly + groups: + github-actions: + patterns: + - "*" + - package-ecosystem: gomod directory: / schedule: interval: weekly + groups: + gomod: + patterns: + - "*" + - package-ecosystem: npm directory: / schedule: interval: weekly + groups: + npm: + patterns: + - "*" + - package-ecosystem: pip directory: / schedule: interval: weekly + groups: + pip: + patterns: + - "*" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e7961ba..28190b0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,10 +5,9 @@ permissions: contents: write - pull-requests: write -env: - PYTHON_VERSION: 3.11 +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} jobs: build-pkg: @@ -19,21 +18,24 @@ uses: actions/checkout@v4 - name: Install Poetry run: pipx install poetry - - id: python - name: Setup Python - uses: actions/setup-python@v4 + - name: Setup Python + uses: actions/setup-python@v5 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: ${{ matrix.python-version }} cache: poetry - name: Install Dependencies run: poetry install - name: Build Package run: poetry build - - name: Upload Build Artifact + - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: package path: dist/* + strategy: + matrix: + python-version: + - "3.11" build-exe: name: Build Executable @@ -41,24 +43,27 @@ steps: - name: Checkout uses: actions/checkout@v4 - - name: Install GNU Softwares - uses: liblaf/template/.github/actions/install@main + - name: Install Task + uses: arduino/setup-task@v1 with: - brew: coreutils gnu-sed make - choco: gnuwin32-coreutils.install make sed + repo-token: ${{ github.token }} - name: Install Poetry run: pipx install poetry - - id: python - name: Setup Python - uses: actions/setup-python@v4 + - name: Setup Python + uses: actions/setup-python@v5 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: ${{ matrix.python-version }} cache: poetry - name: Install Dependencies run: poetry install + - name: Install GNU Softwares + uses: liblaf/template/.github/actions/install@main + with: + brew: coreutils + choco: gnuwin32-coreutils.install - name: Build Executable - run: poetry run make dist - - name: Upload Build Artifact + run: poetry run task dist + - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: ${{ runner.os }}-${{ runner.arch }} @@ -66,62 +71,47 @@ strategy: matrix: os: - - macos-latest - ubuntu-latest + - macos-latest - windows-latest - - release: - name: Create GitHub Release - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - outputs: - releases-created: ${{ steps.release.outputs.releases_created }} - tag-name: ${{ steps.release.outputs.tag_name }} - steps: - - id: release - name: Create GitHub Release - uses: google-github-actions/release-please-action@v4 - with: - release-type: python + python-version: + - "3.10" + - "3.11" + - "3.12" upload: name: Upload Release Assets needs: - - build-exe - build-pkg - - release - if: needs.release.outputs.releases-created == 'true' + - build-exe + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - name: Download Artifacts uses: actions/download-artifact@v3 with: path: artifacts + - name: Delete Existing Release + run: gh release --repo="${{ github.repository }}" delete dev --cleanup-tag + env: + GH_TOKEN: ${{ github.token }} + continue-on-error: true - name: Upload Release Assets - uses: softprops/action-gh-release@master - with: - tag_name: ${{ needs.release.outputs.tag-name }} - files: artifacts/**/* + run: gh release --repo="${{ github.repository }}" create dev artifacts/**/* --generate-notes --prerelease + env: + GH_TOKEN: ${{ github.token }} - publish: - name: Publish to PyPI + check: + name: Check needs: - - release - if: needs.release.outputs.releases-created == 'true' + - build-pkg + - build-exe + - upload + if: always() runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install Poetry - run: pipx install poetry - - name: Setup Python - uses: actions/setup-python@v4 + - name: Check + uses: re-actors/alls-green@release/v1 with: - python-version: ${{ env.PYTHON_VERSION }} - cache: poetry - - name: Install Dependencies - run: poetry install - - name: Publish to PyPI - run: poetry publish --build - env: - POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} + jobs: ${{ toJSON(needs) }} + allowed-skips: upload diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index 9150da9..212c60f 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -11,48 +11,6 @@ group: ${{ github.workflow }}-${{ github.ref }} jobs: - check: - name: Check - runs-on: ubuntu-latest - steps: - - name: Check - run: | - set -o errexit - set -o nounset - set -o pipefail - - function checks() { - (gh pr checks "${{ github.event.pull_request.html_url }}" || true) | - grep --invert-match "${{ github.run_id }}" - } - - function count() { - checks | - cut --fields=2 | - (grep --count "$@" || true) - } - - while true; do - pending=$(count pending) - if ((pending > 0)); then - echo "Waiting for $pending checks to complete..." - sleep 10 - else - break - fi - done - - fail=$(count fail) - if ((fail > 0)); then - echo "$fail checks failed" - exit 1 - else - echo "All checks passed" - exit 0 - fi - env: - GH_TOKEN: ${{ github.token }} - merge: name: Merge if: github.event.pull_request.user.login == 'dependabot[bot]' || diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d439cc7 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,147 @@ +name: Release + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release: + name: Create GitHub Release + runs-on: ubuntu-latest + outputs: + created: ${{ steps.release.outputs.releases_created }} + tag: ${{ steps.release.outputs.tag_name }} + steps: + - id: release + name: Create GitHub Release + uses: google-github-actions/release-please-action@v4 + with: + release-type: python + + build-pkg: + name: Build Package + needs: + - release + if: needs.release.outputs.created == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Poetry + run: pipx install poetry + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: poetry + - name: Install Dependencies + run: poetry install + - name: Build Package + run: poetry build + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: package + path: dist/* + strategy: + matrix: + python-version: + - "3.11" + + build-exe: + name: Build Executable + needs: + - release + if: needs.release.outputs.created == 'true' + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Task + uses: arduino/setup-task@v1 + with: + repo-token: ${{ github.token }} + - name: Install Poetry + run: pipx install poetry + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: poetry + - name: Install Dependencies + run: poetry install + - name: Install GNU Softwares + uses: liblaf/template/.github/actions/install@main + with: + brew: coreutils + choco: gnuwin32-coreutils.install + - name: Build Executable + run: poetry run task dist + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ runner.os }}-${{ runner.arch }} + path: dist/* + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + python-version: + - "3.10" + - "3.11" + - "3.12" + + publish: + name: Publish to PyPI + needs: + - release + if: needs.release.outputs.created == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Poetry + run: pipx install poetry + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: poetry + - name: Install Dependencies + run: poetry install + - name: Publish to PyPI + run: poetry publish --build + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} + strategy: + matrix: + python-version: + - "3.11" + + upload: + name: Upload Release Assets + needs: + - release + - build-pkg + - build-exe + if: needs.release.outputs.created == 'true' + runs-on: ubuntu-latest + steps: + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + - name: Upload Release Assets + run: gh release --repo="${{ github.repository }}" upload "${{ needs.release.outputs.tag }}" artifacts/**/* --clobber + env: + GH_TOKEN: ${{ github.token }} diff --git a/Taskfile.yaml b/Taskfile.yaml new file mode 100644 index 0000000..0f0579a --- /dev/null +++ b/Taskfile.yaml @@ -0,0 +1,30 @@ +version: "3" + +tasks: + build: + cmds: + - poetry build + + clean: + cmds: + - git clean -d --force -X + + dist: + cmds: + - bash scripts/dist.sh "{{OS}}" "{{ARCH}}" "{{.PYTHON_VERSION}}" "{{exeExt}}" + vars: + PYTHON_VERSION: + sh: python scripts/python_version.py + + publish: + cmds: + - poetry publish --build + + run: + cmds: + - OPENSSL_CONF="openssl.cnf" tld + + setup: + cmds: + - micromamba --yes --name="thu-learn-downloader" create libpython-static python=3.11 + - micromamba --yes --name="thu-learn-downloader" run poetry install diff --git a/poetry.lock b/poetry.lock index 1cc789b..01a6cc7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand. [[package]] name = "altgraph" @@ -361,12 +361,12 @@ [[package]] name = "nuitka" -version = "1.9.3" +version = "1.9.4" description = "Python compiler with full language support and CPython compatibility" optional = false python-versions = "*" files = [ - {file = "Nuitka-1.9.3.tar.gz", hash = "sha256:7126701ba9ff0cb8416822738299a31254c40eba012b14fef7f77c67e1630e3a"}, + {file = "Nuitka-1.9.4.tar.gz", hash = "sha256:c0cf1b94a8fdf719894875fff9ec84d540cd1292598274f58e127deb2b595d1d"}, ] [package.dependencies] @@ -613,23 +613,23 @@ [[package]] name = "pyinstaller" -version = "6.2.0" +version = "6.3.0" description = "PyInstaller bundles a Python application and all its dependencies into a single package." optional = false python-versions = "<3.13,>=3.8" files = [ - {file = "pyinstaller-6.2.0-py3-none-macosx_10_13_universal2.whl", hash = "sha256:a1adbd3cf25dc90926d783eae0f444d65cdfecc7bcdf6da522c3ae3ff47b4c25"}, - {file = "pyinstaller-6.2.0-py3-none-manylinux2014_aarch64.whl", hash = "sha256:29d164394f1e949072f78a64c1e040f1c47b7f4aff08514c7666a031c8b44996"}, - {file = "pyinstaller-6.2.0-py3-none-manylinux2014_i686.whl", hash = "sha256:ba602a38d7403de89c38b8956b221ce6de0280730d269bab522492fcad82ee33"}, - {file = "pyinstaller-6.2.0-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:ebac06d99b80d2035594c3cc2fb5f2612d86289edd0510dbcbeb20a873f51d5a"}, - {file = "pyinstaller-6.2.0-py3-none-manylinux2014_s390x.whl", hash = "sha256:fcfabc0ff1d38a4262c051dea3fdc1f7f106405c1f1b491b4c79cd28df19cab6"}, - {file = "pyinstaller-6.2.0-py3-none-manylinux2014_x86_64.whl", hash = "sha256:104430686149b2f1c135b2c17aa2967c85d54ef77dc92feb4e179ec846c0c467"}, - {file = "pyinstaller-6.2.0-py3-none-musllinux_1_1_aarch64.whl", hash = "sha256:e87fd60292b53bb9965cb5a84122875469a2bd475fd0d0db0052a3f1be351f75"}, - {file = "pyinstaller-6.2.0-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:8ec9d6c98972bb922cedb16a6638257aa66e5deadd79e2953f3464696237c413"}, - {file = "pyinstaller-6.2.0-py3-none-win32.whl", hash = "sha256:e5561e9a9b946d835c8dbc11ae4c16cc21e62bc77d10cc043406dc2992dfb4c6"}, - {file = "pyinstaller-6.2.0-py3-none-win_amd64.whl", hash = "sha256:3b586196277c4c54b69880650984c39c28bb6258c2b4b64200032e6ac69d53a0"}, - {file = "pyinstaller-6.2.0-py3-none-win_arm64.whl", hash = "sha256:d0c87b605bf13c3a04dfaa1d2fa7cd36765b8137000eeadccba865e1d6a19bf0"}, - {file = "pyinstaller-6.2.0.tar.gz", hash = "sha256:1ce77043929bf525be38289d78feecde0fcf15506215eda6500176a8715c5047"}, + {file = "pyinstaller-6.3.0-py3-none-macosx_10_13_universal2.whl", hash = "sha256:75a6f2a6f835a2e6e0899d10e60c10caf5defd25aced38b1dd48fbbabc89de07"}, + {file = "pyinstaller-6.3.0-py3-none-manylinux2014_aarch64.whl", hash = "sha256:de25beb176f73a944758553caacec46cc665bf3910ad8a174706d79cf6e95340"}, + {file = "pyinstaller-6.3.0-py3-none-manylinux2014_i686.whl", hash = "sha256:e436fcc0ea87c3f132baac916d508c24c84a8f6d8a06c3154fbc753f169b76c7"}, + {file = "pyinstaller-6.3.0-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:b721d793a33b6d9946c7dd95d3ea7589c0424b51cf1b9fe580f03c544f1336b2"}, + {file = "pyinstaller-6.3.0-py3-none-manylinux2014_s390x.whl", hash = "sha256:96c37a1ee5b2fd5bb25c098ef510661d6d17b6515d0b86d8fc93727dd2475ba3"}, + {file = "pyinstaller-6.3.0-py3-none-manylinux2014_x86_64.whl", hash = "sha256:abe91106a3bbccc3f3a27af4325676ecdb6f46cb842ac663625002a870fc503b"}, + {file = "pyinstaller-6.3.0-py3-none-musllinux_1_1_aarch64.whl", hash = "sha256:41c937fe8f07ae02009b3b5a96ac3eb0800a4f8a97af142d4100060fe2135bb9"}, + {file = "pyinstaller-6.3.0-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:886b3b995b674905a20ad5b720b47cc395897d7b391117831027a4c8c5d67a58"}, + {file = "pyinstaller-6.3.0-py3-none-win32.whl", hash = "sha256:0597fb04337695e5cc5250253e0655530bf14f264b7a5b7d219cc65f6889c4bd"}, + {file = "pyinstaller-6.3.0-py3-none-win_amd64.whl", hash = "sha256:156b32ba943e0090bcc68e40ae1cb68fd92b7f1ab6fe0bdf8faf3d3cfc4e12dd"}, + {file = "pyinstaller-6.3.0-py3-none-win_arm64.whl", hash = "sha256:1eadbd1fae84e2e6c678d8b4ed6a232ec5c8fe3a839aea5a3071c4c0282f98cc"}, + {file = "pyinstaller-6.3.0.tar.gz", hash = "sha256:914d4c96cc99472e37ac552fdd82fbbe09e67bb592d0717fcffaa99ea74273df"}, ] [package.dependencies] @@ -752,28 +752,28 @@ [[package]] name = "ruff" -version = "0.1.6" +version = "0.1.7" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.1.6-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:88b8cdf6abf98130991cbc9f6438f35f6e8d41a02622cc5ee130a02a0ed28703"}, - {file = "ruff-0.1.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:5c549ed437680b6105a1299d2cd30e4964211606eeb48a0ff7a93ef70b902248"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1cf5f701062e294f2167e66d11b092bba7af6a057668ed618a9253e1e90cfd76"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:05991ee20d4ac4bb78385360c684e4b417edd971030ab12a4fbd075ff535050e"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:87455a0c1f739b3c069e2f4c43b66479a54dea0276dd5d4d67b091265f6fd1dc"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:683aa5bdda5a48cb8266fcde8eea2a6af4e5700a392c56ea5fb5f0d4bfdc0240"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:137852105586dcbf80c1717facb6781555c4e99f520c9c827bd414fac67ddfb6"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd98138a98d48a1c36c394fd6b84cd943ac92a08278aa8ac8c0fdefcf7138f35"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a0cd909d25f227ac5c36d4e7e681577275fb74ba3b11d288aff7ec47e3ae745"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:e8fd1c62a47aa88a02707b5dd20c5ff20d035d634aa74826b42a1da77861b5ff"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:fd89b45d374935829134a082617954120d7a1470a9f0ec0e7f3ead983edc48cc"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:491262006e92f825b145cd1e52948073c56560243b55fb3b4ecb142f6f0e9543"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ea284789861b8b5ca9d5443591a92a397ac183d4351882ab52f6296b4fdd5462"}, - {file = "ruff-0.1.6-py3-none-win32.whl", hash = "sha256:1610e14750826dfc207ccbcdd7331b6bd285607d4181df9c1c6ae26646d6848a"}, - {file = "ruff-0.1.6-py3-none-win_amd64.whl", hash = "sha256:4558b3e178145491e9bc3b2ee3c4b42f19d19384eaa5c59d10acf6e8f8b57e33"}, - {file = "ruff-0.1.6-py3-none-win_arm64.whl", hash = "sha256:03910e81df0d8db0e30050725a5802441c2022ea3ae4fe0609b76081731accbc"}, - {file = "ruff-0.1.6.tar.gz", hash = "sha256:1b09f29b16c6ead5ea6b097ef2764b42372aebe363722f1605ecbcd2b9207184"}, + {file = "ruff-0.1.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:7f80496854fdc65b6659c271d2c26e90d4d401e6a4a31908e7e334fab4645aac"}, + {file = "ruff-0.1.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:1ea109bdb23c2a4413f397ebd8ac32cb498bee234d4191ae1a310af760e5d287"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8b0c2de9dd9daf5e07624c24add25c3a490dbf74b0e9bca4145c632457b3b42a"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:69a4bed13bc1d5dabf3902522b5a2aadfebe28226c6269694283c3b0cecb45fd"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:de02ca331f2143195a712983a57137c5ec0f10acc4aa81f7c1f86519e52b92a1"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:45b38c3f8788a65e6a2cab02e0f7adfa88872696839d9882c13b7e2f35d64c5f"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6c64cb67b2025b1ac6d58e5ffca8f7b3f7fd921f35e78198411237e4f0db8e73"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9dcc6bb2f4df59cb5b4b40ff14be7d57012179d69c6565c1da0d1f013d29951b"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df2bb4bb6bbe921f6b4f5b6fdd8d8468c940731cb9406f274ae8c5ed7a78c478"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:276a89bcb149b3d8c1b11d91aa81898fe698900ed553a08129b38d9d6570e717"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:90c958fe950735041f1c80d21b42184f1072cc3975d05e736e8d66fc377119ea"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6b05e3b123f93bb4146a761b7a7d57af8cb7384ccb2502d29d736eaade0db519"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:290ecab680dce94affebefe0bbca2322a6277e83d4f29234627e0f8f6b4fa9ce"}, + {file = "ruff-0.1.7-py3-none-win32.whl", hash = "sha256:416dfd0bd45d1a2baa3b1b07b1b9758e7d993c256d3e51dc6e03a5e7901c7d80"}, + {file = "ruff-0.1.7-py3-none-win_amd64.whl", hash = "sha256:4af95fd1d3b001fc41325064336db36e3d27d2004cdb6d21fd617d45a172dd96"}, + {file = "ruff-0.1.7-py3-none-win_arm64.whl", hash = "sha256:0683b7bfbb95e6df3c7c04fe9d78f631f8e8ba4868dfc932d43d690698057e2e"}, + {file = "ruff-0.1.7.tar.gz", hash = "sha256:dffd699d07abf54833e5f6cc50b85a6ff043715da8788c4a79bcd4ab4734d306"}, ] [package.source] @@ -917,13 +917,13 @@ [[package]] name = "typing-extensions" -version = "4.8.0" +version = "4.9.0" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.8.0-py3-none-any.whl", hash = "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0"}, - {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"}, + {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, + {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, ] [package.source] @@ -1020,5 +1020,5 @@ [metadata] lock-version = "2.0" -python-versions = ">=3.11,<3.13" -content-hash = "d584325538b20b6c2608305c2e8f4681abd5e0e91e87d49498058ad42457e0ef" +python-versions = "^3.10" +content-hash = "cb2a6d4df09188f272240a3d90e915af68e16923dbce7cece486bf8e247dda35" diff --git a/pyproject.toml b/pyproject.toml index c0600f3..4f9e558 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ [tool.poetry.dependencies] beautifulsoup4 = "^4.12.2" pydantic = "^2.4.2" -python = ">=3.11,<3.13" +python = "^3.10" python-dateutil = "^2.8.2" requests = "^2.31.0" rich = "^13.6.0" @@ -22,8 +22,8 @@ typer = "^0.9.0" [tool.poetry.group.dev.dependencies] -nuitka = { markers = 'platform_system!="Windows"', version = "^1.8.5" } -pyinstaller = { markers = 'platform_system == "Windows"', version = "^6.1.0" } +nuitka = "^1.8.5" +pyinstaller = { python = ">=3.10,<3.13", version = "^6.1.0" } ruff = "^0.1.6" typer-cli = { git = "https://github.com/Patarimi/typer-cli.git" } diff --git a/scripts/deploy-gh-pages.sh b/scripts/deploy-gh-pages.sh index e990631..022e6f4 100644 --- a/scripts/deploy-gh-pages.sh +++ b/scripts/deploy-gh-pages.sh @@ -4,18 +4,18 @@ set -o pipefail local_dir=${1:-$PWD} -branch=${2:-"gh-pages"} +branch=${2:-gh-pages} origin=$(git remote get-url origin) temp_dir=$(mktemp --directory) -trap "rm --force --recursive $temp_dir" EXIT -cp --archive --no-target-directory $local_dir $temp_dir +trap 'rm --force --recursive $temp_dir' EXIT +cp --archive --no-target-directory "$local_dir" "$temp_dir" -cd $temp_dir +cd "$temp_dir" rm --force --recursive "$temp_dir/.git" git init -git remote add origin $origin -git checkout --orphan $branch +git remote add origin "$origin" +git checkout --orphan "$branch" git add --all git commit --message="ci: deploy to $branch" -git push --force origin $branch +git push --force origin "$branch" diff --git a/scripts/dist.sh b/scripts/dist.sh new file mode 100644 index 0000000..9268310 --- /dev/null +++ b/scripts/dist.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -o errexit +set -o nounset +set -o pipefail + +OS=$1 +ARCH=$2 +PYTHON_VERSION=$3 +exeExt=$4 + +rm --force --recursive --verbose dist +if python -m nuitka --standalone --onefile \ + --output-filename="tld-$OS-$ARCH-py$PYTHON_VERSION$exeExt" \ + --output-dir="dist" --remove-output main.py; then + exit 0 +else + status=$? +fi + +rm --force --recursive --verbose dist +if pyinstaller --distpath="dist" --onefile \ + --name="tld-$OS-$ARCH-py$PYTHON_VERSION" main.py; then + exit 0 +else + status=$? +fi + +exit $status diff --git a/scripts/python_version.py b/scripts/python_version.py new file mode 100644 index 0000000..e0c1c71 --- /dev/null +++ b/scripts/python_version.py @@ -0,0 +1,7 @@ +import platform + +major: str +minor: str +patch: str +major, minor, patch = platform.python_version_tuple() +print(f"{major}{minor}")