Skip to main content

Reusable library for tab management using SQLAlchemy

Project description

SuperTab: A Tab Management Library

Overview

supertab is a Python library designed to simplify tab management with SQLAlchemy and a MySQL database. It provides a reusable interface for managing tabs, allowing for operations like creating, closing, reordering, and querying tabs.

Features

  • Manage hierarchical tab structures.
  • Seamless integration with SQLAlchemy.
  • Easily create and update database records for tabs.
  • Handle tab-specific logic like ordering and level-based hierarchies.

Installation

Prerequisite

Ensure Python 3.7+ is installed.

Local Installation

Clone this repository:

git clone https://github.com/your_username/supertab.git
cd supertab
pip install .






Getting Started


1. Setting Up the Database
Use the init_engine function to initialize the database connection:
from supertab import init_engine
DATABASE_URL = "mysql+pymysql://username:password@hostname/super_tab"
engine = init_engine(DATABASE_URL, pool_size=10)


2. Creating Tables
Automatically create tables in the database:
from supertab import Base
Base.metadata.create_all(bind=engine)


3. Using the TabManager
Create an instance of TabManager:
from supertab import TabManager
tab_manager = TabManager(engine)

Example: Open a Tab
tab_info = {"title": "Home", "url": "/home"}
new_tab = tab_manager.open_tab(
    unique_identifier="user123",
    created_by=1,
    tab_info=tab_info,
    parent_tab_id=None
)
print(new_tab)

Example: Close a Tab
tab_manager.close_tab(tab_id=42)

Example: Reorder Tabs
tab_manager.reorder_tabs(tab_id=42, new_order=3)

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

supertab-1.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

supertab-1.0.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file supertab-1.0.0.tar.gz.

File metadata

  • Download URL: supertab-1.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9

File hashes

Hashes for supertab-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8eaa034e51cef278340939acbb13837a9bba61991b0aadd7d3ac0a3c71ba6540
MD5 f0e6dfa54d00f9e3b1fccf22b2e81574
BLAKE2b-256 61b143677ff7ec032f7968e6ad9e3931da247d33b022dadff38d31a8e59e472d

See more details on using hashes here.

File details

Details for the file supertab-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: supertab-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9

File hashes

Hashes for supertab-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9addf56fb48dbfa3d4533b356b1cfb440dfdd50be4bdbc3b748aa2d4ab1516d
MD5 0557c0d7f0d3aa2dd8cd35765d14dbea
BLAKE2b-256 07d844f8f13de2cb302d7832c01abbc183ec6501c20cab928fb267e09af53e81

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