Skip to main content

Shared Python packages

Project description

Data engineering shared python libs

This project is used by the data engineering team to share common libraries between multiple projects

Table of Contents

  1. Authors
  2. Project Structure
  3. Getting Started
  4. Usage
  5. Development Setup
  6. Database Migrations
  7. Documentation

1. Authors

Principal maintainers: data.engineering

Team: Data Engineering

2. Project Structure

shared-libs-py/

    ├── .tests/         <- local notebooks, data, etc.
    |
    ├── .vscode/        <- vscode config files
    |
    ├── devops/
    |   ├── ci
    |   |   └── build.yaml
    |   |   └── pr.yaml
    |   ├── cd
    |   |   └── deployment.yaml
    |
    ├── src/
    |   └──shared/
    │       ├── azure/           <- several azure libaries
    │       ├── db/              <- various config files related to project
    │       └── utils/           <- utility modules
    │
    ├── tests/
    │   ├── unit/
    │
    ├── Dockerfile          <- basic Dockerfile template
    ├── .dockerignore
    │
    ├── .gitignore
    ├── Makefile            <- environement creation and basic checks
    ├── pyproject.toml      <- basic standards config
    ├── README.md           <- project README template
    └── uv.lock             <- uv dependencies locker

3. Getting Started

Prerequisites

  • Make
  • Python 3.11
  • Docker & Docker Compose
  • Liquibase (for database migrations)

Installation

Clone this repository

git clone <repository-url>
cd shared-libs-py

Set create env and install libs

make env

Docker Setup

Start the services using Docker Compose:

docker-compose up -d

4. Usage

Below you will see the instructions to install the package under two different methods depending on your project's package manager.

4.1 Using UV

  1. Go to: https://dev.azure.com/oneocean/
  2. Click on "User Settings" -> "Personal access tokens".
  3. Use "+ New Token" button to generate new token. It will only require read access to "Packaging"
  4. Create 2 environment variables:
export UV_INDEX_ONEOCEAN_FEED_USERNAME=pylib
export UV_INDEX_ONEOCEAN_FEED_PASSWORD=[YOUR_TOKEN_HERE]
  1. Add the package to pyproject.toml by using the following command:
uv add shared-libs-py --index oneocean-feed="https://pkgs.dev.azure.com/oneocean/Data/_packaging/OneOcean/pypi/simple/"

4.1 Using pip

  1. Go to: https://dev.azure.com/oneocean/
  2. Click on "User Settings" -> "Personal access tokens".
  3. Use "+ New Token" button to generate new token. It will only require read access to "Packaging"
  4. Create a pip.config file in the following path ~/.pip/pip.conf.
  5. Add the index into the pip.conf by using the following configuration in it.
[global]
index-url = https://pypi.org/simple
extra-index-url = https://pylib:[YOUR_TOKEN_HERE]@pkgs.dev.azure.com/oneocean/Data/_packaging/OneOcean/pypi/simple/

5. Development Setup

PR checks

This project uses the following linters and formatters:

  • Black - Code formatting (docs)
  • isort - Import sorting (docs)
  • Ruff - Fast Python linter (docs)
  • Pylint - Static code analysis (docs)
  • Bandit - Security-focused linter (docs)

To run all checks:

make checks

To automatically fix issues where possible:

make fix

CI

  • Pr: Once a PR is created, checks like black, isort, ruff, etc. are automatically executed. The PR cannot be completed until at least 1 reviewer approves it.
  • Build: Create a docker image and push it to acr. Cache is used to speed up the process. Once the image is created, dependency tracker is executed in order to scan for vulnerabilites and security issues.

CD

  • Deployment: When the build is completed, the task will publish the python package into the company's atifacts feed.

6. Documentation

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

shared_libs_py-1.0.2.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

shared_libs_py-1.0.2-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file shared_libs_py-1.0.2.tar.gz.

File metadata

  • Download URL: shared_libs_py-1.0.2.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for shared_libs_py-1.0.2.tar.gz
Algorithm Hash digest
SHA256 1dc23dafc1ea480d2405f090f3cde91e114923d4a91d799be96c7657eab132d3
MD5 361c6f1b992659d0e1d36c450cfd5154
BLAKE2b-256 16a1d3ce9849e38dbb25ca743bb61469c310d3c5b71fa08652157b80b0f677a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for shared_libs_py-1.0.2.tar.gz:

Publisher: publish.yaml on aleepl/shared-libs-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file shared_libs_py-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: shared_libs_py-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for shared_libs_py-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d41de400105996bc0987294e57a56f2f1d0e7ac32c4497972ebce0efc05bca94
MD5 47560c468ffc3dfa5fb3880a6ab6bcb8
BLAKE2b-256 ab3f37c381d8549e3e860d7ed4e88bc927678360b3790fa240c55edf89634583

See more details on using hashes here.

Provenance

The following attestation bundles were made for shared_libs_py-1.0.2-py3-none-any.whl:

Publisher: publish.yaml on aleepl/shared-libs-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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