Skip to main content

Nutricare data access package

Project description

nutricare-data-packages

Nutricare 的数据访问基础包,封装 MongoDB 仓储与本地存储抽象基类。

安装

pip install nutricare-data-packages

快速使用

from pathlib import Path

from nutricare_data_packages import StorageBase


class ReportStorage(StorageBase):
    @property
    def storage_subdir(self) -> str:
        return "reports"

    def _write_impl(self, relative_path: str, data: bytes) -> Path:
        target = self.resolve_path(relative_path)
        target.parent.mkdir(parents=True, exist_ok=True)
        target.write_bytes(data)
        return target


storage = ReportStorage()
storage.write_metadata(
        relative_path=relative_path,
        size=len(content),
        status="pending",
    )
path = storage.write(relative_path, content)

本地构建与发布

python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
python -m twine upload dist/*

Project details


Download files

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

Source Distribution

nutricare_data_packages-0.1.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

nutricare_data_packages-0.1.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file nutricare_data_packages-0.1.1.tar.gz.

File metadata

  • Download URL: nutricare_data_packages-0.1.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for nutricare_data_packages-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c4cdac38b8636fac4953e092583519e3c6286947549540024799e8b7c5ff9fab
MD5 6af1c1ee06ef90e5e50388dceadc21e7
BLAKE2b-256 42850f3ce9f2053e8ca7b51ff1526013ba6a6e2110eaba2f36d2e39f3d4724de

See more details on using hashes here.

File details

Details for the file nutricare_data_packages-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nutricare_data_packages-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0603cb975a0725b90d193e60260935f3c786fbbc9dac7b2ef1e2e17aedc00fe4
MD5 d270fc1e2d65917fb91e37051d451b5b
BLAKE2b-256 768c7b0b724be61bd8671d3f30c68888cdf985aa0de356621f16c7d2523df6ee

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