Skip to main content

Objects Quickly - AI tools at your finger tips

Project description

OQ - Objects Quickly

Quick access to popular data science and machine learning libraries.

Overview

OQ (Objects Quickly) is a convenience package that provides instant access to commonly used objects and functions from popular Python data science and machine learning libraries. It eliminates the need for repetitive imports and gives you quick access to the tools you need.

Key Features

  • Optional Dependencies: All scientific/ML libraries are optional - only import what you have installed
  • Flexible Imports: Use module-specific imports (import oq.pd) or get everything at once (import oq)
  • Configurable: Control which modules are imported and in what order
  • Zero Setup: Works out of the box with intelligent defaults
  • Name Collision Handling: Import order determines precedence when function names overlap

Installation

Basic Installation

pip install oq

This installs only the core package with configuration support.

With Optional Dependencies

Install specific libraries:

# Data science essentials
pip install oq[datascience]  # numpy, pandas, scipy, matplotlib, seaborn

# Machine learning
pip install oq[ml]  # scikit-learn, xgboost, lightgbm

# Deep learning
pip install oq[deeplearning]  # torch, tensorflow

# Visualization
pip install oq[viz]  # matplotlib, seaborn, plotly

# Everything
pip install oq[all]

Or install individual libraries:

pip install oq[numpy]
pip install oq[pandas]
pip install oq[sklearn]
# etc.

Available individual extras: numpy, pandas, scipy, matplotlib, seaborn, plotly, sklearn, xgboost, lightgbm, torch, tensorflow, statsmodels

Usage

Module-Specific Imports

Import and use objects from specific libraries:

# Import pandas utilities
from oq import pd

# Use pandas objects directly
df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
print(pd.concat([df, df]))

# Import numpy utilities
from oq import np

# Use numpy objects directly
arr = np.array([1, 2, 3])
print(np.mean(arr))

Root-Level Import (Auto-Import)

Import everything from all installed libraries at once:

import oq

# All objects from installed libraries are available directly
df = oq.DataFrame({'a': [1, 2, 3]})  # from pandas
arr = oq.array([1, 2, 3])  # from numpy
model = oq.RandomForestClassifier()  # from sklearn

Module Abbreviations

OQ uses intuitive abbreviations for popular libraries:

Abbreviation Library Description
np numpy Numerical computing
pd pandas Data manipulation and analysis
sp scipy Scientific computing
plt matplotlib.pyplot Plotting and visualization
sns seaborn Statistical visualization
sk sklearn Machine learning (scikit-learn)
xgb xgboost Gradient boosting
lgb lightgbm Light gradient boosting
torch torch Deep learning (PyTorch)
tf tensorflow Deep learning (TensorFlow)
px plotly.express Interactive visualization
sm statsmodels Statistical modeling

Configuration

Default Behavior

By default, OQ:

  • Auto-imports all available modules to the root namespace
  • Imports in this order: np, pd, sp, plt, sns, sk, xgb, lgb, torch, tf, px, sm
  • Later imports take precedence in case of name conflicts

Custom Configuration

You can customize OQ's behavior by creating a configuration file. OQ uses the config2py package for configuration management.

Create a config file at one of these locations:

  • ~/.config/oq/config.json
  • Custom location set via OQ_APP_DATA_DIR environment variable

Example configuration:

{
  "import_config": {
    "auto_import_to_root": true,
    "module_order": [
      "pd",
      "np",
      "sk"
    ],
    "enabled_modules": {
      "np": true,
      "pd": true,
      "sp": false,
      "plt": true,
      "sns": false,
      "sk": true,
      "xgb": false,
      "lgb": false,
      "torch": false,
      "tf": false,
      "px": false,
      "sm": false
    }
  }
}

Configuration options:

  • auto_import_to_root: Whether to auto-import modules to oq namespace (default: true)
  • module_order: Order in which modules are imported (determines precedence for name conflicts)
  • enabled_modules: Which modules to import when using import oq

Handling Name Conflicts

When multiple libraries define functions with the same name, the import order determines which one is used:

import oq

# If both numpy and torch are installed, and numpy comes first in module_order:
oq.tensor  # This will be torch.tensor (later in import order wins)

To avoid conflicts, use module-specific imports:

from oq import np, torch

np_array = np.array([1, 2, 3])
torch_tensor = torch.tensor([1, 2, 3])

How It Works

OQ uses dynamic introspection to extract callable objects from installed libraries:

  1. Conditionally imports libraries (fails gracefully if not installed)
  2. Uses the guide package to extract all public callables
  3. Injects them into the module namespace
  4. Makes them available for your use

This means:

  • No manual maintenance of exported functions
  • Always up-to-date with the latest library versions
  • Only imports what you have installed
  • Zero overhead if you don't use certain libraries

Examples

Data Analysis Workflow

import oq

# Load data
df = oq.read_csv('data.csv')

# Analyze
print(df.describe())

# Transform
arr = oq.array(df['column'])
normalized = oq.scale(arr)  # sklearn's scale

# Visualize
oq.figure(figsize=(10, 6))
oq.plot(df['x'], df['y'])
oq.show()

Machine Learning Pipeline

from oq import pd, np, sk

# Load data
df = pd.read_csv('data.csv')
X = df.drop('target', axis=1)
y = df['target']

# Train model
model = sk.RandomForestClassifier()
model.fit(X, y)

# Predict
predictions = model.predict(X)
accuracy = sk.accuracy_score(y, predictions)
print(f'Accuracy: {accuracy}')

Quick Exploration

import oq

# Just start working with your data
data = oq.array([[1, 2], [3, 4], [5, 6]])
df = oq.DataFrame(data, columns=['A', 'B'])
print(df.corr())

# Plot
oq.scatter(df['A'], df['B'])

Development

Running Tests

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Author

Thor Whalen

Links

Related Projects

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

oq-0.0.5.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

oq-0.0.5-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file oq-0.0.5.tar.gz.

File metadata

  • Download URL: oq-0.0.5.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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}

File hashes

Hashes for oq-0.0.5.tar.gz
Algorithm Hash digest
SHA256 cca77959360b6d3e60917a3a219da3ef25a9397b3d571488e5bafc929587e4be
MD5 7c66fa71ea1e5015730d70a63bbb9788
BLAKE2b-256 45e5e22c96a5d70498a0a08919df025584f4337fcc393cb112dafe5f24cd7984

See more details on using hashes here.

File details

Details for the file oq-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: oq-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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}

File hashes

Hashes for oq-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e6eaa7055a333e1fcaa37890aa97f95f6e6bbc2583494722a9faafcd336c0ca0
MD5 4f5c99bad8257a3648c419d5cfc38fec
BLAKE2b-256 270624896fe1dfb2d7416ede216e5ba12802f794852456ccca24e310c38a614b

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