Skip to main content

rse-files-core

RSE standard file storage package for Python APIs.

Features:

  • GCS upload/download helpers
  • storage configuration from local environment or HashiCorp Vault
  • filename and storage key sanitization
  • SHA-256 checksums
  • PDF/content-type/max-size validation
  • standardized metadata and exceptions

Usage

from rse_files import (
    build_storage_key,
    create_file_storage,
    validate_pdf_bytes,
)

storage = create_file_storage()

validate_pdf_bytes(content)

storage_key = build_storage_key(
    namespace="nc",
    owner_type="action-plan-evidence",
    owner_id=123,
    filename="evidencia.pdf",
)

metadata = storage.upload_bytes(
    content=content,
    storage_key=storage_key,
    content_type="application/pdf",
    filename="evidencia.pdf",
)

public_url = storage.get_public_url(storage_key)

get_public_url only builds the canonical public GCS URL for a valid storage key. It does not change bucket IAM, object ACLs, signed URL settings, or CDN settings. Public access must be configured explicitly in the target bucket infrastructure.

Local Configuration

When RSE_ENV=local, the package reads regular environment variables:

RSE_FILES_STORAGE_PROVIDER=gcs
RSE_FILES_BUCKET=my-bucket
RSE_FILES_PREFIX=uploads

Vault

When RSE_ENV is stg or prd, the package reads Vault using:

  • RSE_ENV as the KV v2 mount point
  • RSE_VAULT_HOST as the Vault URL
  • RSE_VAULT_TOKEN as the Vault token
  • RSE_FILES_VAULT_PATH as the secret path, defaulting to shared

Expected keys:

rse_files_storage_provider
rse_files_bucket
rse_files_prefix

Fallback keys are also accepted for compatibility:

document_storage_provider
gcs_documents_bucket
gcs_documents_prefix

Example:

stg/shared.rse_files_storage_provider = gcs
stg/shared.rse_files_bucket = rse-documents-stg
stg/shared.rse_files_prefix = files

Metadata

Release files for rse-files-core 0.2.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 rse-files-core 0.2.3
File Size Uploaded Provenance Actions
rse_files_core-0.2.3.tar.gz 5.8 kB Without provenance Details for rse_files_core-0.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rse-files-core 0.2.3
File Interpreter ABI Platform Actions
rse_files_core-0.2.3-py3-none-any.whl Python 3 none any Details for rse_files_core-0.2.3-py3-none-any.whl

Total release size: 15.2 kB

Release files / rse_files_core-0.2.3.tar.gz

Download URL rse_files_core-0.2.3.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
29e3054d8469d4aebece00f52488ad3b4c19f662ef62aabd9731b55b42be2b3f
BLAKE2b-256 checksum
How to use checksums
eee721b8f9dfd50af94a76299d1fc1b054004352f84aeab7b3e082d00d93b81c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.10.0 Windows/10

Release files / rse_files_core-0.2.3-py3-none-any.whl

Download URL rse_files_core-0.2.3-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b983b41e489b52f50aa0ba4d2063d2a5667477e74a2ef241ae86a0a3331874a
BLAKE2b-256 checksum
How to use checksums
4ba2b4173ea43c3bcda14f35d7e6b86fa07b7e0bdd5b3b147665120d57283189
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.10.0 Windows/10

Security for rse-files-core 0.2.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.

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