Skip to main content

A folder of functions and classes that are easy to import

Project description

important

🎁 Import Ant 🐜 The folder of python functions and classes we can import

PyPI version test pypi build

import ant avatar

📦 Installation

Import Ant is meant to be as light weight as possible, say you want to import some re-useable code for redis, but you don't want to install every dependency for kafka, snowflake, etc. You can install just the redis part with out worring to manage the distribution about anything else.

Very simple version

pip install import-a

With other distributions

pip install "import-a[redis]"

or

pip install "import-a[kafka,redis]"
pip install "import-a[kafka,snowflake]"

or just get greedy and install everything, with a specified version 🚀🏎💣🔪🔫🔨🧨🧱🧲🧪🧬🧯🧰

pip install "import-a[all]==0.0.1"

🔌 Connectors

❄️ Snowflake

from important.snowflake import SnowFlakeDatabricks
sf = SnowFlakeDatabricks.from_config()

# read data into a pandas dataframe
df = sf("SELECT * FROM some_table")

🍄 Redis

from important.redis import Redis, RedisAsync, RedisController

Vanilla Redis

# connect to redis
redis_client = Redis(host="localhost", db=0)

control = RedisController.from_task(redis_client, task="channel_pop")

# save data by key
control[dict(channel_id=137, user_id=424242)] = "Some string data"

Async Redis

redis_client = RedisAsync(host="localhost", db=0)

control = RedisControllerAsync.from_task(
    redis_client, task="channel_pop")

# save data by key, sadly the await expression doesn't support the [] syntax
await control.set(dict(channel_id=137, user_id=424242), "Some string data")

# get data by key
await control[dict(channel_id=137, user_id=424242)]

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

import-a-0.0.20.tar.gz (75.0 kB view hashes)

Uploaded Source

Built Distribution

import_a-0.0.20-py3-none-any.whl (75.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page