pathkit文件操作
简介
pathkit 是一个用于文件操作的 Python 包,提供一个易于使用的接口来操作文件。
依赖性
基础依赖(安装pathkit时将自动安装):
- portalocker
- cryptography
操作具体文件系统需要额外依赖(根据需求手动安装):
| 文件系统 | 依赖 |
|---|---|
| HDFS | hdfs |
| MinIO | minio |
安装
# 通过 pip 安装:
pip install pathkit
初始化连接配置
from pathkit.config import EnvConfig
# 示例:
# 配置名为 'hdfs' 的连接信息
EnvConfig.write("hdfs", url=url)
# 配置名为 'minio' 的连接信息
EnvConfig.write("minio", endpoint=endpoint, access_key=access_key, secret_key=secret_key,
bucket_name=bucket_name, secure=secure)
# 配置名为 'ftp' 的连接信息
EnvConfig.write("ftp", host=host, user=user, passwd=passwd, pasv=pasv)
文件操作
from pathkit import MinIOPath
p = MinIOPath("/xxx/yyy")
# 判断是否存在
p.exists
# 判断是否为目录
p.is_dir()
# 读取文件内容
p.read()
# 写入文件
p.write(b'xxx')
# 上传文件
p.upload("/xxx/zzz")
# 删除文件
p.delete()
# 创建目录
p.mkdir()
# 遍历目录
p.glob()
# 文件修改时间
p.mtime
# 递归遍历目录
p.rglob()
功能
- 支持多种文件系统(如 HDFS、MinIO、FTP、Local)
- 简洁的 API
Metadata
Release files for pathkit 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pathkit-0.1.4-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| pathkit-0.1.4-cp311-cp311-manylinux_2_17_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.17+ x86-64 | Details |
| pathkit-0.1.4-cp311-cp311-macosx_11_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 11.0+ ARM64 | Details |
| pathkit-0.1.4-cp311-cp311-macosx_10_9_x86_64.whl | CPython 3.11 | CPython 3.11 | macOS 10.9+ x86-64 | Details |
| pathkit-0.1.4-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details |
| pathkit-0.1.4-cp310-cp310-manylinux_2_17_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.17+ x86-64 | Details |
| pathkit-0.1.4-cp310-cp310-macosx_11_0_arm64.whl | CPython 3.10 | CPython 3.10 | macOS 11.0+ ARM64 | Details |
| pathkit-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl | CPython 3.10 | CPython 3.10 | macOS 10.9+ x86-64 | Details |
Total release size: 2.7 MB
Release files / pathkit-0.1.4-cp311-cp311-win_amd64.whl
| Download URL | pathkit-0.1.4-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 314.5 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5d1d857ff856ffbd26abe76cc983bd635d9d78f5d5630634d18d13c41af4aafe
|
|
BLAKE2b-256 checksum How to use checksums |
bd6c5ac1fc3319b39b5cbbb8b333326bb094464b206bed50f2a968460dbf81f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / pathkit-0.1.4-cp311-cp311-manylinux_2_17_x86_64.whl
| Download URL | pathkit-0.1.4-cp311-cp311-manylinux_2_17_x86_64.whl |
|---|---|
| Size | 411.3 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
e84fca658ad94259845c6387bf1e1b0977a3fc166ed825ef0d3967ee7e13aa50
|
|
BLAKE2b-256 checksum How to use checksums |
a3d7ae747f05e67cf5783a4acbd284e989e9185a63415a066c5f2851490ab730
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / pathkit-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | pathkit-0.1.4-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 313.1 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
27204a8685f60503109faa563054af86cbfffb5ae170a4773250a477437fba87
|
|
BLAKE2b-256 checksum How to use checksums |
9cfb5566a1b72599afcff6ff27a9d2470a17a64831e75495af0d19e66a11672c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / pathkit-0.1.4-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | pathkit-0.1.4-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 329.8 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
a151bdee6cfbe250c6acf1afb8a2e431b408bd2b3f3cba6d081ac97a424da6d5
|
|
BLAKE2b-256 checksum How to use checksums |
1a8f771901a9778cc8447ba9d0d554a45475c6f15db1dd233ad62dce945c16ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / pathkit-0.1.4-cp310-cp310-win_amd64.whl
| Download URL | pathkit-0.1.4-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 314.0 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1c79a5790a0faa9abcffd934a587fe4d9380b529000f2e5cc45acd6ea23e4252
|
|
BLAKE2b-256 checksum How to use checksums |
85d6251b30ed3242f11a382652d3e8a625fc2b7f2948401a3813b7784a4c2c95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / pathkit-0.1.4-cp310-cp310-manylinux_2_17_x86_64.whl
| Download URL | pathkit-0.1.4-cp310-cp310-manylinux_2_17_x86_64.whl |
|---|---|
| Size | 409.8 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
d046a8d6bf46e68a99fd3651612a3bddbaed4b9d68b3b2fafc0ab11e007d2d90
|
|
BLAKE2b-256 checksum How to use checksums |
3186ef12760861bbb49b38b42307b3cca7a7c7aef460946d4bcc8541874d5063
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / pathkit-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | pathkit-0.1.4-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 312.8 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1e6df1f59bf848a26382e7052f94533c7c73f14a1608488722fc9aa63f4b9468
|
|
BLAKE2b-256 checksum How to use checksums |
d7661160603e419b96296e5a59647dfde52c5bb115d8f6a18ec78c99294e40d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / pathkit-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | pathkit-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 330.0 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
ccb598dd44e67e03c6b76d4304c2e03eda96caf35b25173501004ac48d8bf812
|
|
BLAKE2b-256 checksum How to use checksums |
4c4344e29744beda0bc47c823529d9b7b96a4e860966c617ee30ff9a0a68b9d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Security for pathkit 0.1.4
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.