Skip to main content

A Python library for Concept-Connection System (CCS) - offline-first knowledge graph management

Project description

CCS

A Python library for CCS functionality.

Installation

From source (development mode)

# Clone the repository
git clone https://github.com/yourusername/ccs.git
cd ccs

# Install in development mode
pip install -e .

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

From PyPI (once published)

pip install ccs

Usage

Initialization

from ccs import init, CCSConfig

await init(
    url="https://api.example.com",
    nodeUrl="https://node.example.com",
    applicationName="MyApp",
    config=CCSConfig(storagePath="./data/ccs/")
)

Get instance concept by character value and type

Fetches a concept from the backend that matches a given character value and type string (e.g. a URL tagged as "the_source_url").

from ccs.api import GetInstanceConceptByCharacterType

concept = await GetInstanceConceptByCharacterType(
    characterValue="https://www.google.com/maps/place/gorjana/data=...",
    type="the_source_url",
)

if concept.id != 0:
    print(concept.id)             # server-assigned concept ID
    print(concept.characterValue) # the matched character value

Request body sent to /api/get_instance_concept_by_character_type:

{
    "characterValue": "https://...",
    "type": "the_source_url"
}

Returns a Concept object. If no match is found or an error occurs, returns a default empty Concept with id=0.

Login output formatting (frontend-friendly)

Use the package to call backend login and return a normalized payload that your frontend can store directly.

from ccs import init, CCSConfig, login, format_login_payload

await init(
    url="https://boomconsole.com",
    nodeUrl="https://boomconsole.com",
    applicationName="boomconsole",
    config=CCSConfig(storagePath="./data/ccs/")
)

# Calls /api/auth/login and returns normalized payload.
# By default this does NOT persist login data.
payload = await login("user@example.com", "password")
print(payload)

# If you already have raw backend login JSON, just format it:
normalized = format_login_payload(raw_login_response, fallback_email="user@example.com")

Normalized output shape:

{
  "token": "...",
  "refreshToken": "...",
  "email": "user@example.com",
  "userId": 10489,
  "userConcept": 100417172,
  "entityId": 100827857,
  "amcode": "base64-encoded-roles-json"
}

Optional storage behavior:

# Only if you explicitly want package-level storage:
payload = await login("user@example.com", "password", store_session=True, persist=True)

Project Structure

CCS-Python/
├── pyproject.toml          # Package configuration
├── README.md               # This file
├── src/
│   └── ccs/                # Main package
│       ├── __init__.py     # Package initialization & exports
│       ├── core.py         # Core functionality
│       └── utils.py        # Utility functions
├── tests/                  # Test suite
│   ├── __init__.py
│   ├── test_core.py
│   └── test_utils.py
└── docs/                   # Documentation (optional)

Development

Running tests

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

# Run tests
pytest

# Run tests with coverage
pytest --cov=ccs

Code formatting

# Format code with black
black src/ tests/

# Lint with ruff
ruff check src/ tests/

Type checking

mypy src/

Building & Publishing

Build the package

pip install build
python -m build

This creates distribution files in the dist/ directory:

  • ccs-0.1.0.tar.gz (source distribution)
  • ccs-0.1.0-py3-none-any.whl (wheel distribution)

Publish to PyPI

pip install twine

# Upload to TestPyPI first (recommended)
twine upload --repository testpypi dist/*

# Upload to PyPI
twine upload dist/*

License

MIT License - see LICENSE file for details.

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

mftsccs-0.1.14.tar.gz (59.6 kB view details)

Uploaded Source

Built Distribution

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

mftsccs-0.1.14-py3-none-any.whl (74.9 kB view details)

Uploaded Python 3

File details

Details for the file mftsccs-0.1.14.tar.gz.

File metadata

  • Download URL: mftsccs-0.1.14.tar.gz
  • Upload date:
  • Size: 59.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for mftsccs-0.1.14.tar.gz
Algorithm Hash digest
SHA256 7920f95c8b26e9bdb6ce7076745a619741c6df1b2eaa84db95b3d1537f6438cd
MD5 0e61f6397ffbb2f70041573d2bade62f
BLAKE2b-256 e0269aa536195efc72a1026121a9be1a69d02b4e8798c8f0e0162deefe72c0bd

See more details on using hashes here.

File details

Details for the file mftsccs-0.1.14-py3-none-any.whl.

File metadata

  • Download URL: mftsccs-0.1.14-py3-none-any.whl
  • Upload date:
  • Size: 74.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for mftsccs-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 38ef861b29107ce10d690802850eaef9d80392d08d5c3e3770667b28beef6f6e
MD5 45e20f5b24ab39cf69d34b62755b40c7
BLAKE2b-256 d75d5ad5562f85c221cd3a72decdecd4ee7ce86c70c63b6e7e3ce509589b1fd6

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