python wheel for aria2 static build
CI/CD | |
Code | |
Package | |
Meta |
Documentation: https://wsh032.github.io/aria2-wheel/
Source Code: https://github.com/WSH032/aria2-wheel/
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:
- Windows 32bit
- Windows 64bit
- Linux x86_64
- Linux aarch64
pip install aria2
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)
- If you find any issues, please don't hesitate to open an issue.
- If you need assistance, feel free to start a discussion.
- Follow our
CONTRIBUTING.md
, PR Welcome! - Security 😰❗: We value any security vulnerabilities, please report to us privately, pretty appreciated for that.
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 , which makes me happy. 😄
- aria2
- NOTE! This project is not aria2 official project.
- aria2-static-build
- The executable file of aria2 directly comes from this project.
- The license of this project is consistent with it, and assumes no responsibility for your use.