Skip to main content

Formatter Build Status codecov PyPI version PyPI - Python Version

Description

Provides S3 path manipulation, similar to PurePath in pathlib. S3Path is only meant for path manipulation and does not implement any methods which interact with S3 itself. Avoiding S3 interaction means that a user can use their own boto3 session and are not forced to use the default one.

For S3Path implementations that do path manipulation and interaction, see s3path instead.

Installation

This is a pure python package, so it can be installed with pip install s3-path-wrangler or any other dependency manager.

Usage

This library provides a single (meant to be) immutable class - S3Path. Class features:

from s3_path_wrangler.paths import S3Path

# various options for creating path objects
full_path = S3Path("s3://your-bucket/some/path/file.json")
from_list = S3Path.from_parts(["your-bucket", "some", "path", "file.json"], is_absolute=True)
relative = S3Path("some/path/")
relative_from_list = S3Path.from_parts(["some", "path"]) # or is_absolute=False

# convenient attributes
assert full_path.parts == ["your-bucket", "some", "path", "file.json"]
assert full_path.is_absolute == True
assert full_path.bucket == "your-bucket"
assert full_path.key == "some/path/file.json"
assert full_path.name == "file.json"
assert full_path.parent == S3Path("s3://your-bucket/some/path")

# paths are comparable to strings (directories will not have trailing slashes)
assert S3Path.from_parts(["some", "path"]) == "some/path"

# paths can be manipulated via '/'
assert relative / "file.json" == S3Path("some/path/file.json")

Development

This library uses the poetry package manager, which has to be installed before installing other dependencies. Afterwards, run poetry install to create a virtualenv and install all dependencies.

Black is used (and enforced via workflows) to format all code. Poetry will install it automatically, but running it is up to the user. To format the entire project, run black ..

To run tests, either activate the virtualenv via poetry shell and run pytest ./tests, or simply run poetry run pytest ./tests.

Contributing

This project uses the Apache 2.0 license and is maintained by the data science team @ Barbora. All contribution are welcome in the form of PRs or raised issues.

Metadata

Release files for s3-path-wrangler 0.5.0

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

Source distribution (sdist)

Source distribution for s3-path-wrangler 0.5.0
File Size Uploaded Provenance Actions
s3-path-wrangler-0.5.0.tar.gz 9.0 kB Without provenance Details for s3-path-wrangler-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for s3-path-wrangler 0.5.0
File Interpreter ABI Platform Actions
s3_path_wrangler-0.5.0-py3-none-any.whl Python 3 none any Details for s3_path_wrangler-0.5.0-py3-none-any.whl

Total release size: 18.3 kB

Release files / s3-path-wrangler-0.5.0.tar.gz

Download URL s3-path-wrangler-0.5.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
47da0fe4fd115f790026b261066d7ac3ac93b6075cdd7297b1610f20f17c6f56
BLAKE2b-256 checksum
How to use checksums
547d7b6e161dfb061de53347bbb18b458371bb30426bc90bd944d8c2d84ab1b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.9.6 Linux/5.8.0-1036-azure

Release files / s3_path_wrangler-0.5.0-py3-none-any.whl

Download URL s3_path_wrangler-0.5.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c5e3fbfdff7617d36690d4aa1b0f5324e90dc8c55862f01308f706a4c40dfb6
BLAKE2b-256 checksum
How to use checksums
3f718f1a5b605c15b7608a91b8eab136b0fbbe074def19aea9c5cac91c713f13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.9.6 Linux/5.8.0-1036-azure

Security for s3-path-wrangler 0.5.0

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.

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