Skip to main content

Quick access to code favorites

Project description

qo

Quick access to code (personalized/collaborative) favorites.

We all have our go-to utils and awesome tools. Some of us are annoyed at having to type long dotpaths to the object we want to import. Some of us probably forget where that particular object is in the first place.

This is to mitigate that.

Instead do this:

from qo.my_medley import that_object

Also have several my_medley sets of favorites, since what you'll need depends on the context.

Word of advice: This tool is meant for the quick-and-dirty development context

Don't use this for production or any long-term code. It's meant for pulling things together quickly. Once the code matures, you should import "normally".

Usage

See what modules are available to import

>>> from qo import source_module_names
>>> source_module_names
['tw', 'ca']

See what that module is about (if the author cared to say)

>>> from qo import tw
>>> print(tw.__doc__)

A medley of my most frequently used tools.

Import it (as a module object)

from qo import tw
# or from qo import tw as my_own_name

Inject the module's contents in your current namespace (if you're that type)

from qo.tw import *

Inject everything there is in your namespace (but expect unpredictable name collisions)

from qo import *

Inspiration

When I have to do this:

from sklearn.linear_model import Ridge
from sklearn.metrics import confusion_matrix
from sklearn.linear_model import LinearRegression
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.svm import SVR
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import AdaBoostRegressor
from sklearn.neural_network import MLPRegressor
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.neighbors import KNeighborsRegressor
from sklearn.ensemble import StackingRegressor
from sklearn.linear_model import RidgeCV, LassoCV
from sklearn.preprocessing import StandardScaler

I go 🤮.

I can never remember what is where. Some packages (like numpy) percolate the best-of up to the root so that these objects can be imported from there. Others (like sklearn) don't. How do we solve this for ourselves -- and while we're at it, handle multiple packages from a same place (qo)?

When in fast mode, these kinds of things can really slow one down. Irrelevant details are detrimental to thinking. Where an object is irrelevant when you're modeling.

I thought this might be more appropriate:

from qo import (
    Ridge, confusion_matrix, LinearRegression, AdaBoostClassifier, RandomForestClassifier,
    SVR, RandomForestRegressor, LogisticRegression, DecisionTreeRegressor, AdaBoostRegressor,
    MLPRegressor, GradientBoostingRegressor, KNeighborsRegressor, StackingRegressor,
    RidgeCV, LassoCV, StandardScaler
)

So I did it.

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

qo-0.0.21.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

qo-0.0.21-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file qo-0.0.21.tar.gz.

File metadata

  • Download URL: qo-0.0.21.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for qo-0.0.21.tar.gz
Algorithm Hash digest
SHA256 8d50b5bed372b9ab8d97e21df5fe4e21b07d5c34e1f13bf136fa728de5364642
MD5 566b165d1f1978313a07d561761e6dae
BLAKE2b-256 7c044e317f15ee5e48b37aecfbeb7c4e456ad7dc43168b5c5afeca9a7e259ff6

See more details on using hashes here.

File details

Details for the file qo-0.0.21-py3-none-any.whl.

File metadata

  • Download URL: qo-0.0.21-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for qo-0.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 b6788a8f19386520cdc677eb33e7eb258e75e84cf35faba1291cec2106ffa339
MD5 53ee6277af6e0e1b2547a00a2e51306a
BLAKE2b-256 38ac0c8b8fd430d40580f519be42dcfa27367a24076c8d07effd01d7e59f0880

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