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.3-cp311-cp311-win_amd64.whl (313.2 kB view details)

Uploaded CPython 3.11Windows x86-64

pathkit-0.1.3-cp311-cp311-manylinux_2_17_x86_64.whl (409.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pathkit-0.1.3-cp311-cp311-macosx_11_0_arm64.whl (311.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pathkit-0.1.3-cp311-cp311-macosx_10_9_x86_64.whl (326.9 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pathkit-0.1.3-cp310-cp310-win_amd64.whl (312.2 kB view details)

Uploaded CPython 3.10Windows x86-64

pathkit-0.1.3-cp310-cp310-manylinux_2_17_x86_64.whl (408.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pathkit-0.1.3-cp310-cp310-macosx_11_0_arm64.whl (310.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pathkit-0.1.3-cp310-cp310-macosx_10_9_x86_64.whl (327.1 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pathkit-0.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f0975b066522f879f3e81aedd2c627f317df7c58f5f30553b8705bd60a207b72
MD5 c37a005243874569165f89b379bc3764
BLAKE2b-256 38bffb0958fa9df6412ddc96b1189ff9c2bcb99c50089576e63e916926db97d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.3-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c98b30187c56f8eede8c5a40826eda47cc1a28b1492315e36107b18020a39fcc
MD5 f56e74aa46b128deaeac4fe3c250bf3a
BLAKE2b-256 537f28d2a3baf17a2c4d96a4912b7ad5667d533a7eae3e24b07271771b699b5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c88908ccc79784dc50505fe3d50bccb4671b25bcbc5e434b9bedf542bc142982
MD5 539d9e9df43d294d4f38cd8de9a17051
BLAKE2b-256 2b0594ccd1dcca9092cbd5071e15559ab4843227b4e3609e4224d2fe29d46349

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 188469fa7aa96f0c67750bd56dc3c02a3a8c4d90474f762b54e07647e23ff770
MD5 c2302c1de0f7422b4ed3eb1f116555d0
BLAKE2b-256 6d18919c0967f2e06b67ee7e4037674f3c7eb051e836caffd5b8a051492a741d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pathkit-0.1.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 95537643634191610ec26b61be385b4ad71587a10e1ed9a86a4a0a4108425c4c
MD5 e2ea5c60af572e60b9a5c34b93825ddb
BLAKE2b-256 43bf1faed46ac295d5e30e91fdd1d3ee656f8b9f57a97f17905327b7c47b298b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.3-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b9d51fdf180fcb17365e55a0c9d2839c0e948ed896614610dbe5b174f6ccb3cd
MD5 b7ea7ecde10ec798dd9235e08751758b
BLAKE2b-256 4001a65f26fbfce646802c187f9dca7482461f987caccb26d460b93f1e4bdc4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ed58e0fd3ee05a9be5f17fed71840fd96ad4b9593a0e4f9d4eba6668c76ba00
MD5 e5cd7beb84b46fca918e01ca1fc8e8bb
BLAKE2b-256 4e86cf6cda55d14cede827cd60a995f21f40cd3a2064a0f96ff1663cc5c74739

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7f7579c5f6e0ec2fb5f85b6be553f6711a265a173fc77c7a4388a5f14d85c900
MD5 205c30c546f61a5edc2c13a6ffb325b8
BLAKE2b-256 0e74159b0d8ed542ef9f260773af04adc7973dbe22fb2a7bfa0376040f8bccdc

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