🏗️ A Python library package which provides application foundation components - streamlined async initialization, configuration management, platform directories, logging setup, and environment handling for Python applications.
Key Features ⭐
🚀 Async Application Initialization: Single prepare() function that sets up your entire application foundation with sensible defaults.
📁 Platform Directory Management: Automatic discovery and creation of platform-specific directories for configuration, data, and cache.
⚙️ TOML Configuration System: Hierarchical configuration loading with includes, template variables, and overrides. Can bring your own configuration system too.
🎯 Distribution Detection: Automatic detection of development vs production deployment modes with package introspection.
📝 Logging Configuration: Logging setup with plain and rich modes and environment variable overrides.
🔄 Resource Management: Integration with AsyncExitStack for proper cleanup of async resources.
🏷️ Safety: Full type annotations with immutable data structures for thread safety.
Installation 📦
Method: Install Python Package
Install via uv pip command:
uv pip install emcd-appcore
Or, install via pip:
pip install emcd-appcore
Optional Dependencies ⚙️
For CLI applications, install the cli extra which includes Tyro and Rich:
pip install emcd-appcore[cli]
For enhanced console output without CLI framework:
pip install emcd-appcore[rich]
Examples 💡
Quick Start 🚀
The simplest way to initialize your application:
>>> import asyncio
>>> import contextlib
>>> import appcore
>>> async def main( ):
... async with contextlib.AsyncExitStack( ) as exits:
... auxdata = await appcore.prepare( exits )
... print( f"App: {auxdata.application.name}" )
... return auxdata.configuration
>>> # asyncio.run( main( ) ) # Returns configuration dictionary
Platform Directories 📁
Access platform-specific directories for your application:
>>> async def display_directories( ):
... async with contextlib.AsyncExitStack( ) as exits:
... application = appcore.ApplicationInformation(
... name = 'my-app', publisher = 'MyCompany' )
... auxdata = await appcore.prepare( exits, application = application )
... dirs = auxdata.directories
... print( f"Config: {dirs.user_config_path}" )
... print( f"Data: {dirs.user_data_path}" )
... print( f"Cache: {dirs.user_cache_path}" )
>>> # asyncio.run( display_directories( ) )
Building CLI Applications 🔧
Build command-line applications using the appcore.cli module:
>>> import asyncio
>>> from appcore import cli, state
>>> class HelloCommand( cli.Command ):
... async def execute( self, auxdata: state.Globals ) -> None:
... print( f"Hello from {auxdata.application.name}!" )
>>> class MyApplication( cli.Application ):
... async def execute( self, auxdata: state.Globals ) -> None:
... command = HelloCommand( )
... await command( auxdata )
>>> # asyncio.run( MyApplication( )( ) )
The appcore CLI tool demonstrates these capabilities in action - inspect configuration, environment variables, and platform directories:
$ python -m appcore configuration --display.presentation json $ python -m appcore environment $ python -m appcore directories --display.target-file dirs.txt
For a comprehensive implementation example, see sources/appcore/introspection.py which shows advanced patterns including subcommands, display options, and presentation formats.
Dependencies & Architecture 🏛️
Appcore is built on a foundation of proven, lightweight dependencies:
Configuration: Uses standard library tomli for TOML parsing with accretive data structures that can grow but never shrink.
Platform Integration: Leverages platformdirs for cross-platform directory discovery and aiofiles for async file operations.
Logging Enhancement: Optional integration with Rich for enhanced console output with graceful fallbacks.
Distribution Management: Uses importlib-metadata and importlib-resources for package introspection and resource handling.
The architecture emphasizes:
Immutability: All configuration and state objects are immutable after creation, preventing accidental modifications.
Async-First: Built from the ground up for async/await patterns with proper resource management.
Dependency Injection: Configurable components that can be replaced or extended without modifying core functionality.
Type Safety: Comprehensive type annotations for excellent IDE support and static analysis.
Contribution 🤝
Contribution to this project is welcome! However, it must follow the code of conduct for the project.
Please file bug reports and feature requests in the issue tracker or submit pull requests to improve the source code or documentation.
For development guidance and standards, please see the development guide.
Additional Indicia
Metadata
Release files for emcd-appcore 1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| emcd_appcore-1.7.tar.gz | 32.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| emcd_appcore-1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.9 kB
Release files / emcd_appcore-1.7.tar.gz
| Download URL | emcd_appcore-1.7.tar.gz |
|---|---|
| Size | 32.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85c49b3ea21c3326ecb3c41ee1d8c8991078d29a19fda0a011ba38c8af662e97
|
|
BLAKE2b-256 checksum How to use checksums |
b81dc7124e02b6b380d237a680a39c3994063c284962137e4d841e7ae0390e55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 19, 2026.
Transparency logRelease files / emcd_appcore-1.7-py3-none-any.whl
| Download URL | emcd_appcore-1.7-py3-none-any.whl |
|---|---|
| Size | 45.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57d944bc2562e3f1486ef2f4925fb7a1fa98dd54777577591be70f3f31a89709
|
|
BLAKE2b-256 checksum How to use checksums |
f9b9ae2a146614140c49e505f07e79019fbe1264274f1df0d4ac7b514943474a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 19, 2026.
Transparency log