Metadata-Version: 2.1
Name: salomos
Version: 0.1.9
Summary: Salomos is a Python package that provides a domain-specific language (DSL) processor for executing commands based on sentences stored in a SQLite database.
Home-page: https://python.dobyemail.com
Author: Tom Sapletta
Author-email: info@softreck.dev
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: sqlite3

# Salomos

Salomos is a Python package that provides utilities for processing domain-specific languages (DSLs) and managing associated data.

## Installation

To install Salomos, simply run:

```
pip install salomos
```

## Key Components

### DBManager

The `DBManager` class (`db_manager.py`) handles database operations for the Salomos package. It provides methods to:

- Initialize the database
- Load sentences and objects from the database
- Close the database connection

### DSLProcessor 

The `DSLProcessor` class (`dsl_processor.py`) is responsible for processing DSL sentences. It offers functionality to:

- Import modules and resolve class names
- Find matching elements based on a name
- Process a DSL sentence and execute corresponding actions
- Perform operations like print, add, concatenate

## Usage Example

Here's a basic example of how to use the Salomos package:

```python
from salomos.db_manager import DBManager
from salomos.dsl_processor import DSLProcessor
from dotenv import load_dotenv
import os

load_dotenv()

# Get the logger level from environment variable
LOGGER_LEVEL = os.getenv("LOGGER_LEVEL", "INFO")

# Initialize the database manager
db = DBManager("path/to/database.db")
db.init_database()

# Create a DSL processor instance
processor = DSLProcessor(db)

# Load a DSL sentence and objects from the database
sentence = db.load_sentence()
objects = db.load_objects()

# Process the DSL sentence
result = processor.process_sentence(sentence, objects)

# Print the result
processor.print(result)

# Close the database connection
db.close()
```

This example demonstrates the typical workflow of using Salomos:

1. Load environment variables from a `.env` file using `load_dotenv()`.

2. Get the logger level from the `LOGGER_LEVEL` environment variable, defaulting to "INFO" if not set.

3. Initialize a `DBManager` with the path to your database file and call `init_database()`.

4. Create a `DSLProcessor` instance, passing it the database manager. 

5. Load a DSL sentence and any associated objects from the database using the `load_sentence()` and `load_objects()` methods of the database manager.

6. Process the loaded sentence using the `process_sentence()` method of the DSL processor, passing the sentence and objects. This returns the result of executing the sentence.

7. Use the `print()` method of the DSL processor to display the result.

8. Close the database connection when finished using the `close()` method of the database manager.

Refer to the documentation for more details on the available methods and their usage.

## Contributing

Contributions are welcome! Please see the [contributing guidelines](CONTRIBUTING.md) for more details.

## License

This project is licensed under the [MIT License](LICENSE).
