data-ops
data operations related code
motivation
data-ops is a library with tested and used code aligning on some standards regarding code structure and quality and to avoid reinventing the wheel. It builds on top of dataops-abs.
installation
`pip install tgedr-dataops`
package namespaces and its contents
commons
- S3Connector: base class to be extended, providing a connection session with aws s3 resources
- utils_fs: utility module with file system related functions (example)
- utils_github: utility module for github, with no
Source/Sinkdependency; raises its ownGithubApiException/GithubAccountNotFoundException. Provides:- coordinate parsing and formatting:
parse_github_source,parse_github_file,format_github_file(refs are pinned with a?ref=<branch>suffix, so branch names containing/stay unambiguous) - host resolution:
normalize_host,enterprise_subdomain,api_base_url(publicgithub.comand GitHub Enterprise Cloud<organization>.ghe.com) - url builders:
contents_url,raw_file_url,account_repositories_url list_account_repositories(account, token, host, timeout, filters, session): lists the repositories of an account or organization, following pagination until the last page and returning curated metadata dicts;RepositoryFiltersfilters bysuffix,include_archived,include_forks,include_private,include_disabled(example)
- coordinate parsing and formatting:
quality
- PandasValidation : GreatExpectationsValidation implementation to validate pandas dataframes with Great Expectations library (example)
sink
- LocalFsFileSink: Sink implementation class used to save/persist an object/file to a local fs location (example)
- S3FileSink: Sink implementation class used to save/persist a local object/file to an s3 bucket (example)
source
-
AbstractS3FileSource: abstract Source class used to retrieve objects/files from s3 bucket to local fs location circumventing some formats download limitation
-
GithubFileSource: Source implementation class used to retrieve files from a github repository to a local fs location (example)
list:sourceis<owner>/<repo>(also accepts araw.githubusercontent.comurl, or<organization>.ghe.com/<owner>/<repo>), plus optionalref/branch,pathandsuffix; returns<owner>/<repo>/<path>?ref=<ref>coordinatesget:filesholds those coordinates (the?ref=suffix is optional and wins over thebranchcontext key, which defaults tomain);targetis interpreted as a folder only when it already exists as one, otherwise as a file path, matchingLocalFsFileSource/S3FileSource- a coordinate keeps the ref it was listed with, so repos whose default branch is not
main(e.g.master,development) round-trip fromlisttogetcorrectly - colliding file names in a folder target are saved as
<account>_<repo>_<name>, so collecting manyREADME.mdfiles no longer overwrites them - config accepts optional
token,timeout,host(e.g.<organization>.ghe.comfor GitHub Enterprise Cloud with data residency) anduse_api_download; the token can also come fromGITHUB_TOKEN/GH_TOKENor url userinfo, and is never logged
from tgedr_dataops.source.github_file_source import GithubFileSource o = GithubFileSource() # or GithubFileSource({"token": ..., "host": "<organization>.ghe.com"}) files = o.list(context={"source": "jtviegas/airesdeornelas", "branch": "development", "suffix": "README.md"}) # ['jtviegas/airesdeornelas/README.md?ref=development'] o.get(context={"files": files, "target": "/tmp/out/README.md"}) # file target # ['/tmp/out/README.md'] o.get(context={"files": files, "target": "/tmp/out"}) # existing folder target # ['/tmp/out/README.md']
-
LocalFsFileSource: Source implementation class used to retrieve local objects/files to another local fs location (example)
-
PdDfS3Source: Source implementation class used to read a pandas dataframe from s3, whether a csv or an excel (xslx) file (example csv, example excel)
-
S3FileCopy: Source implementation class used to copy objects/files from an s3 bucket to another s3 bucket (example)
-
S3FileExtendedSource: Source implementation class used to retrieve objects/files from s3 bucket to local fs location with the extra method
get_metadataproviding sile metadata ("LastModified", "ContentLength", "ETag", "VersionId", "ContentType")(example) -
S3FileSource: Source implementation class used to retrieve objects/files from s3 bucket to local fs location (example)
store
- DataFrameSplits : dataclass container for
train,test, and optionalvalidationpandas DataFrames, providing helpers to build, merge, and convert splits to/from Hugging Face datasets - FsSinglePartitionParquetStore : abstract Store implementation defining persistence on parquet files with an optional single partition, regardless of the location it should persist
- HuggingFaceDatasetStore : Store implementation class for interacting with Hugging Face Hub datasets, supporting CRUD operations on datasets and their splits (example)
- LocalFsSinglePartitionParquetStore : FsSinglePartitionParquetStore implementation using local file system (example)
- S3FsSinglePartitionParquetStore : FsSinglePartitionParquetStore implementation using aws s3 file system (example)
- ParquetStore : Store implementation class for interacting with Parquet files using a filesystem interface (example)
known issues/further development
- update data while changing its partition value (check unit test)
development
-
main requirements:
- uv
- bash
-
Clone the repository like this:
git clone git@github.com:tgedr/dataops
-
cd into the folder:
cd dataops -
install requirements:
./helper.sh reqs
Metadata
Release files for tgedr-dataops 1.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tgedr_dataops-1.6.1.tar.gz | 37.9 kB | Without provenance | Details for tgedr_dataops-1.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tgedr_dataops-1.6.1-py3-none-any.whl | Python 3 | none | any | Details for tgedr_dataops-1.6.1-py3-none-any.whl |
Total release size: 90.2 kB
Release files / tgedr_dataops-1.6.1.tar.gz
| Download URL | tgedr_dataops-1.6.1.tar.gz |
|---|---|
| Size | 37.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2466907b181b73241f483f69ba6618f1d00844300d297d3dcfce231c32f8c04b
|
|
BLAKE2b-256 checksum How to use checksums |
b373ce0e75e0c9b04b373c8be3da3a20fc53672aab9cd00f95e422cd0914172b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / tgedr_dataops-1.6.1-py3-none-any.whl
| Download URL | tgedr_dataops-1.6.1-py3-none-any.whl |
|---|---|
| Size | 52.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c656b903f86fa2d00c6d5950af87e05b02098f5029dc08bca3bf1ff85f9c5dd
|
|
BLAKE2b-256 checksum How to use checksums |
4c94908ad57643ad65762d9a9cdeb37e49985cfcc9659fd8a99612f4f73ebcf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for tgedr-dataops 1.6.1
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.