Skip to main content

GitHub Release Python Versions Project Stage Project Maintenance License

GitHub Activity PyPi Downloads GitHub Last Commit Open in Dev Containers

Build Status Typing Status Code Coverage

Asynchronous Python client for Python Seafile.

About

An asynchronous Python client for the Seafile Web API, built for the Home Assistant Seafile integration. It covers the documented Seafile Web API (checked against Seafile 14), plus the system admin API:

Area Examples
Account server info, account and quota, profile, avatar, devices, activities, notifications, guest invitations
Libraries create, rename, transfer, delete, encryption passwords, history and snapshots, trash, deleted libraries, library API tokens and all via-repo-token endpoints
Files directories, file operations, streaming upload (optionally in chunks) and download, file history, batch copy/move/delete, zip download, smart links, starred items
Sharing share links, upload links, sharing with users and groups, folder permissions
Groups groups, members, group libraries; departments and organizations (Pro / multi-tenancy)
Admin system info, statistics, users, libraries, trash, devices, links, groups, logs, notifications
Extras search, tags, file comments, wikis, metadata (Seafile 13+)

Endpoints that only exist in the Professional edition, or that need a server setting, raise SeafilePermissionError or SeafileNotFoundError on servers without them.

Installation

pip install aioseafile

Example

import asyncio

from aioseafile import Seafile


async def main() -> None:
    """Run the example."""
    async with Seafile(api_url="https://cloud.example.com") as seafile:
        await seafile.get_auth_token("me@example.com", "password")
        account = await seafile.get_account_info()
        print(f"{account.usage} of {account.quota_total or 'unlimited'} bytes used")
        for library in await seafile.get_libraries():
            print(library.name, library.size)


if __name__ == "__main__":
    asyncio.run(main())

Pass token= instead of calling get_auth_token to reuse a stored token. Admin methods (get_admin_*, create_admin_*, ...) raise SeafilePermissionError for non-admin accounts.

Uploading and downloading

Uploads and downloads are streamed, so large files never have to fit in memory. Use chunk_size to upload in several requests, for example behind a reverse proxy that limits the request size; each chunk is retried on transient errors. Pass on_progress to be told how many bytes were uploaded so far.

async def backup(seafile: Seafile, library_id: str, stream: AsyncIterator[bytes], size: int) -> None:
    """Upload a backup and read it back."""
    await seafile.create_directory(library_id, "/backups")
    await seafile.upload_file(library_id, "/backups", "backup.tar", stream, size=size, chunk_size=50 * 1024 * 1024)
    async for chunk in seafile.download_file(library_id, "/backups/backup.tar"):
        ...

Seafile builds upload and download links from its SERVICE_URL setting, which often differs from the address the client uses. The client rebases these links onto api_url, or onto file_server_url when the file server runs elsewhere.

Contributing

This is an active open-source project. We are always open to people who want to use the code or contribute to it.

We've set up a separate document for our contribution guidelines.

Thank you for being involved! 😍

Setting up development environment

The simplest way to begin is by utilizing the Dev Container feature of Visual Studio Code or by opening a CodeSpace directly on GitHub. By clicking the button below you immediately start a Dev Container in Visual Studio Code.

Open in Dev Containers

This Python project relies on [UV][poetry] as its dependency manager, providing comprehensive management and control over project dependencies.

Installation

Install all packages, including all development requirements:

uv sync --all-groups && prek install

UV creates by default an virtual environment where it installs all necessary pip packages.

Pre-commit

This repository uses the pre-commit framework, all changes are linted and tested with each commit. To setup the pre-commit check, run:

uv run prek install

And to run all checks and tests manually, use the following command:

uv run prek run --all-files

Testing

It uses pytest as the test framework. To run the tests:

uv run pytest

To update the syrupy snapshot tests:

uv run pytest --snapshot-update

License

MIT License

Copyright (c) 2026 Erwin Douna

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for aioseafile 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aioseafile 0.1.3
File Size Uploaded Provenance Actions
aioseafile-0.1.3.tar.gz 52.1 kB With provenance Details for aioseafile-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aioseafile 0.1.3
File Interpreter ABI Platform Actions
aioseafile-0.1.3-py3-none-any.whl Python 3 none any Details for aioseafile-0.1.3-py3-none-any.whl

Total release size: 114.7 kB

Release files / aioseafile-0.1.3.tar.gz

Download URL aioseafile-0.1.3.tar.gz
Size 52.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e9d3e59774209a67fff2f80e07ef1d57bcfeb74eca92491d83ad8cf1cf656d7c
BLAKE2b-256 checksum
How to use checksums
ef75c6e97fbe48b6f71cfc593c32bbcf26e967c51e831e6a394f251d88cffae9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / aioseafile-0.1.3-py3-none-any.whl

Download URL aioseafile-0.1.3-py3-none-any.whl
Size 62.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96655b13e5f86dc4e203b35df4fbae8487b062f766f58c078b7a617aec96b13c
BLAKE2b-256 checksum
How to use checksums
2de7c63320ade84713cb7364f6ff3d9f5a437e0c870d994e4799efddfa4fb838
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for aioseafile 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aioseafile-0.1.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page