Git Product home page Git Product logo

aria2-wheel's Introduction

Aria2 Wheel

python wheel for aria2 static build

CI/CD CI: lint-test pre-commit.ci status
CI: docs CI: publish
Code codecov Code style: black Ruff Checked with pyright
Package PyPI - Version PyPI - Downloads PyPI - Python Version
Meta Hatch project GitHub License

Documentation: https://wsh032.github.io/aria2-wheel/

Source Code: https://github.com/WSH032/aria2-wheel/


Introduction

aria2 is a lightweight multi-protocol & multi-source command-line download utility.

It's easy to install aria2 on Linux (apt install aria2), however it's not easy to install aria2 on Windows (at least can't one-click to install).

So I build this python wheel to binding aria2 static build. You can install it by pip from pypi on Windows.

Now, we support:

  • manylinux_2_17_x86_64
  • musllinux_1_1_x86_64
  • manylinux_2_17_aarch64
  • musllinux_1_1_aarch64
  • win_amd64
  • win32

Features

aria2-wheel internally bundles the aria2c binary and utilizes the entry_point technology.

Therefore, it does not modify your system's PATH environment variable, and there is no need for sudo permissions.

You can completely uninstall it by running pip uninstall aria2.

Credits

  • aria2
    • This project is not aria2 official project.
  • aria2-static-build
    • The bound aria2 executable file directly comes from aria2-static-build project, and aria2-wheel assumes no responsibility for your use.
    • The license of aria2-wheel project is consistent with aria2-static-build project.

check hatch_build.py and .github/workflows/publish.yml to know how we build the wheel.

Install

pip install aria2

or install in global environment with pipx

# https://pypa.github.io/pipx/
pipx install aria2

Usage

cli usage

All api is the same as aria2

aria2c --help

or

python -m aria2c --help

ctrl + c , ctrl + break , kill <pid> will work well, even exit code.

Do not shutdown the subprocess by Popen.terminate() or Popen.kill(), which can not shutdown aria2 subprocess properly.

Use following code instead:

import os
import signal
import subprocess
import sys
from subprocess import Popen
from typing import TypedDict


class Win32PopenKwargs(TypedDict):
    """Popen kwargs for Windows."""

    creationflags: int


class UnixPopenKwargs(TypedDict):
    """Popen kwargs for Unix."""

    start_new_session: bool


popen_kwargs = (
    UnixPopenKwargs(start_new_session=True)
    if sys.platform != "win32"
    else Win32PopenKwargs(creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
)


with Popen(args=("aria2c", "--enable-rpc"), **popen_kwargs) as p:
    try:
        # Do whatever you want here.
        ...
    finally:
        # following code can shutdown the subprocess gracefully.
        if sys.platform == "win32":
            # https://stackoverflow.com/questions/44124338/trying-to-implement-signal-ctrl-c-event-in-python3-6
            os.kill(p.pid, signal.CTRL_BREAK_EVENT)
        else:
            os.killpg(os.getpgid(p.pid), signal.SIGINT)

development

English is not the native language of the author (me), so if you find any areas for improvement in the documentation, your feedback is welcome.

If you think this project helpful, consider giving it a star GitHub Repo stars, which makes me happy. ๐Ÿ˜„

aria2-wheel's People

Contributors

dependabot[bot] avatar pre-commit-ci[bot] avatar wsh032 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

aria2-wheel's Issues

`TODO` for v0.1.0

  • When building, perform hash verification checks on the downloaded aria2 artifacts
  • Adopt cibuildwheel for more accurate testing and building
  • Fix code coverage inconsistency between Unix and Windows

TODO for v1.0.0

  • macos support

`actions/upload-artifact@v4` break the `publish.yml` workflow

Describe the bug

PR #5 #6 break the publish.yml workflow.

The v4 versions of actions/upload-artifact and actions/download-artifact no longer allow uploading multiple files to the same artifact, and currently, there is no guidance1 on how to handle it.

The publish workflow of this repository requires multiple uploads of wheels. So, it's broken.

To Reproduce

See https://github.com/WSH032/aria2-wheel/actions/runs/7241328457. There is only one artifact that does not contain wheels.

Possible solutions

Currently, there is no guidance1 on how to handle it.

I suggest temporarily reverting PR #5 #6 until a solution is available.

Additional context

More info: https://github.com/orgs/aio-libs/discussions/31

Footnotes

  1. Provide guidance for workflows broken by @4? โ†ฉ โ†ฉ2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.