Skip to main content

Utils and common libraries for Python

Project description

Contributor Covenant

SwissKnife

Hey! Welcome to SwissKnife, a set of tools and functionalities built by the Data Engineering team at @uDATech.

This library is born from an urge of having a common repo to gather some functions that are widely used accross our tools.

Suggestions and contributions are more than welcome, always respecting our Code of Conduct.

Installation guide

This repo is available to download via PyPI and it has different sets of functionalities that can be independently installed:

  • Basic set:

    • Packages included:
      • info
    pip install UDASwissKnife
    
  • Extended set:

    • Packages included:
      • avro
      • gcloud
    pip install UDASwissKnife[avro,gcloud]
    
  • Complete set:

    • Includes both Basic and Extended sets
    pip install UDASwissKnife[all]
    

Using the modules

info

The main goal of this module is to identify the environment in which we are currently working. This is done thanks to an environment variable $ENV which contains the name of the working environment. The accepted case insensitive values of this working environment are:

The object SwissKnife.info.CURRENT_ENVIRONMENT, which is of type ExecutionEnvironment, an enum that contains the following entries:

  • PRO
  • PRE
  • TEST
  • DEV (default)

Then, it's possible to know the working environment using a set of methods which return a boolean indicating whether we are in that environment or not:

  • is_pro()
  • is_pre()
  • is_test()
  • is_dev()

It's also possible to obtain the working environment using object SwissKnife.info.CURRENT_ENVIRONMENT.

Why is there a Dockerfile?

The one and only purpose of the Dockerfile is to execute the tests defined in the project. By building and running the Docker image, tests results will be printed in the terminal. If it's needed to save the result in a file, run:

sudo docker run swissknife:latest > nosetests.xml

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

UDASwissKnife-0.12.0.tar.gz (14.6 kB view hashes)

Uploaded source

Built Distribution

UDASwissKnife-0.12.0-py3-none-any.whl (16.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page