Application data directory management and user profile storage with Pydantic models and filesystem-based persistence
Project description
App Data
Application data directory management and user profile storage with Pydantic models and filesystem-based persistence.
Overview
vcti-app-data provides two components for managing application state on disk.
AppDataDirectory is a context manager that creates and scopes operations to
an application data directory. ProfileManager handles CRUD operations for
named user profiles, each stored as a JSON file in its own directory, with
active profile tracking and a default profile that cannot be deleted.
Installation
pip install vcti-app-data>=1.0.0
Quick Start
Application data directory
from vcti.app_data import AppDataDirectory
with AppDataDirectory("~/.config/my_app").context() as ctx:
# Working directory is now ~/.config/my_app (created if needed)
(ctx.path / "config.json").write_text('{"theme": "dark"}')
# Original working directory restored on exit
Profile management
from vcti.app_data import ProfileManager
mgr = ProfileManager("~/.config/my_app/profiles")
# Default profile created automatically
mgr.create_profile("dev", name="Development", tags=["dev"])
mgr.create_profile("prod", name="Production", attributes={"region": "us-east"})
mgr.set_active_profile("dev")
print(mgr.get_active_profile()) # "dev"
for profile in mgr.list_profiles():
print(f"{profile.id}: {profile.info.name}")
mgr.delete_profile("prod")
# Deleting the active profile resets to default
Core API
AppDataDirectory
| Method | Description |
|---|---|
context() |
Context manager — creates dir, changes CWD, restores on exit |
path |
The directory path |
ProfileManager
| Method | Description |
|---|---|
create_profile(profile_id, name, ...) |
Create a new profile |
get_profile(profile_id) |
Get profile by ID |
update_profile_info(profile_id, **kwargs) |
Update profile fields |
delete_profile(profile_id) |
Delete profile (not default) |
list_profiles() |
List all profiles (sorted by ID) |
set_active_profile(profile_id) |
Set the active profile |
get_active_profile() |
Get active profile ID |
profile_exists(profile_id) |
Check if profile exists |
Pydantic Models
| Model | Purpose |
|---|---|
ProfileInfo |
name, description, avatar, tags, attributes |
Profile |
id + ProfileInfo |
ProfileList |
Collection of profiles (RootModel) |
Dependencies
- pydantic (>=2.0) — data validation and JSON serialization
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vcti_app_data-1.0.0.tar.gz.
File metadata
- Download URL: vcti_app_data-1.0.0.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91d59dfc75e27dccc0239a7a319dac83d7a95eecf21d291e5852f931b35bb4b9
|
|
| MD5 |
ae57656478cc228fb51e0f8efa881fa6
|
|
| BLAKE2b-256 |
5c188805406188ea79fc912ff63b2af73314b79f1916718ea9d9e3a4a895d980
|
Provenance
The following attestation bundles were made for vcti_app_data-1.0.0.tar.gz:
Publisher:
publish.yml on vcollab/vcti-python-app-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_app_data-1.0.0.tar.gz -
Subject digest:
91d59dfc75e27dccc0239a7a319dac83d7a95eecf21d291e5852f931b35bb4b9 - Sigstore transparency entry: 1194129216
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-app-data@bf11a660be866884d212665685fc935272515c8b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bf11a660be866884d212665685fc935272515c8b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vcti_app_data-1.0.0-py3-none-any.whl.
File metadata
- Download URL: vcti_app_data-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97c0fe25cabd622980ec9838e1399d5a9245d1a767ddcf0e91e6c8aeeccf782f
|
|
| MD5 |
0becd3acaa621039c381f27a132fca49
|
|
| BLAKE2b-256 |
714e21b0f5b10e10848d14503a482e436c0b101f211461fc0b8963cc1e52b24a
|
Provenance
The following attestation bundles were made for vcti_app_data-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on vcollab/vcti-python-app-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_app_data-1.0.0-py3-none-any.whl -
Subject digest:
97c0fe25cabd622980ec9838e1399d5a9245d1a767ddcf0e91e6c8aeeccf782f - Sigstore transparency entry: 1194129219
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-app-data@bf11a660be866884d212665685fc935272515c8b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bf11a660be866884d212665685fc935272515c8b -
Trigger Event:
workflow_dispatch
-
Statement type: