Skip to main content

Easy way to handle File

Project description

pathkit文件操作

简介

pathkit 是一个用于文件操作的 Python 包,提供一个易于使用的接口来操作文件。

依赖性

基础依赖(安装pathkit时将自动安装):
  • portalocker
  • cryptography
操作具体文件系统需要额外依赖(根据需求手动安装):
文件系统 依赖
HDFS hdfs
MinIO minio

安装

# 通过 pip 安装:
pip install pathkit

初始化连接配置

  1. 配置文件的写入

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pathkit-0.1.4-cp311-cp311-win_amd64.whl (314.5 kB view details)

Uploaded CPython 3.11Windows x86-64

pathkit-0.1.4-cp311-cp311-manylinux_2_17_x86_64.whl (411.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pathkit-0.1.4-cp311-cp311-macosx_11_0_arm64.whl (313.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pathkit-0.1.4-cp311-cp311-macosx_10_9_x86_64.whl (329.8 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pathkit-0.1.4-cp310-cp310-win_amd64.whl (314.0 kB view details)

Uploaded CPython 3.10Windows x86-64

pathkit-0.1.4-cp310-cp310-manylinux_2_17_x86_64.whl (409.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pathkit-0.1.4-cp310-cp310-macosx_11_0_arm64.whl (312.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pathkit-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl (330.0 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pathkit-0.1.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pathkit-0.1.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 314.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for pathkit-0.1.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5d1d857ff856ffbd26abe76cc983bd635d9d78f5d5630634d18d13c41af4aafe
MD5 4a6221b7303f3981c5206fcaeace5352
BLAKE2b-256 bd6c5ac1fc3319b39b5cbbb8b333326bb094464b206bed50f2a968460dbf81f9

See more details on using hashes here.

File details

Details for the file pathkit-0.1.4-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.4-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e84fca658ad94259845c6387bf1e1b0977a3fc166ed825ef0d3967ee7e13aa50
MD5 02dbecdcc01b5e2f599890641fdec93b
BLAKE2b-256 a3d7ae747f05e67cf5783a4acbd284e989e9185a63415a066c5f2851490ab730

See more details on using hashes here.

File details

Details for the file pathkit-0.1.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27204a8685f60503109faa563054af86cbfffb5ae170a4773250a477437fba87
MD5 ad57510c3a47f4908ce1416aec60bd57
BLAKE2b-256 9cfb5566a1b72599afcff6ff27a9d2470a17a64831e75495af0d19e66a11672c

See more details on using hashes here.

File details

Details for the file pathkit-0.1.4-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a151bdee6cfbe250c6acf1afb8a2e431b408bd2b3f3cba6d081ac97a424da6d5
MD5 4672fbffd7c11431e4445d17c89b4866
BLAKE2b-256 1a8f771901a9778cc8447ba9d0d554a45475c6f15db1dd233ad62dce945c16ee

See more details on using hashes here.

File details

Details for the file pathkit-0.1.4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pathkit-0.1.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 314.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for pathkit-0.1.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1c79a5790a0faa9abcffd934a587fe4d9380b529000f2e5cc45acd6ea23e4252
MD5 a32faa223a9b7a8bd2484ff9d099aae4
BLAKE2b-256 85d6251b30ed3242f11a382652d3e8a625fc2b7f2948401a3813b7784a4c2c95

See more details on using hashes here.

File details

Details for the file pathkit-0.1.4-cp310-cp310-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.4-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d046a8d6bf46e68a99fd3651612a3bddbaed4b9d68b3b2fafc0ab11e007d2d90
MD5 cb4370612efa65acc7348a6383dcbce9
BLAKE2b-256 3186ef12760861bbb49b38b42307b3cca7a7c7aef460946d4bcc8541874d5063

See more details on using hashes here.

File details

Details for the file pathkit-0.1.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e6df1f59bf848a26382e7052f94533c7c73f14a1608488722fc9aa63f4b9468
MD5 512eb757b9d6c9d969fd5053b8d6d93b
BLAKE2b-256 d7661160603e419b96296e5a59647dfde52c5bb115d8f6a18ec78c99294e40d9

See more details on using hashes here.

File details

Details for the file pathkit-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ccb598dd44e67e03c6b76d4304c2e03eda96caf35b25173501004ac48d8bf812
MD5 d68c96f29efad46cb44e341274de03d5
BLAKE2b-256 4c4344e29744beda0bc47c823529d9b7b96a4e860966c617ee30ff9a0a68b9d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page