A Python package for generating and executing data processing scripts using AI language models
Project description
geniescript
A Python CLI tool that helps scientists and researchers generate and execute data processing scripts using AI language models. This tool simplifies the process of creating Python scripts for data analysis, transformation, and visualization tasks.
Installation
pip install geniescript
Usage
- Set your OpenAI API key:
export OPENAI_API_KEY=your_api_key_here
-
Create a source file (e.g.,
analysis.genie) with instructions describing your data processing task. -
Run the script:
geniescript run analysis.genie
The tool will:
- Generate a Python script based on your data processing instructions using AI
- Save the generated code to
analysis.genie.py - Execute the generated Python script
If you run the command again with the same instructions, it will skip the generation step and directly execute the existing Python script.
Command Options
--no-execute: Generate the Python file without executing it. This is useful when you want to review or modify the generated code before processing your data.
geniescript run analysis.genie --no-execute
--script-args: Pass command line arguments to the generated Python script, such as input file paths or processing parameters. These arguments will be accessible via sys.argv in the generated script.
geniescript run analysis.genie --script-args="input_data.csv output_results.csv"
Examples
- Basic command output example:
# Create a script that uses system commands
echo "Create a Python script that uses the 'cat' command to output the first 10 prime numbers" > analysis.genie
# Run it
geniescript run analysis.genie
- CSV processing with command-line arguments:
# Create a script to analyze data
echo "Create a Python script that processes CSV data. The script should:
- Read the input CSV file from the first command-line argument (sys.argv[1])
- Calculate basic statistics (mean, median, std) for each numeric column
- Save results to the output CSV file specified in the second argument (sys.argv[2])" > analyze.genie
# Run it with input/output file paths
geniescript run analyze.genie --script-args="experiment_data.csv stats_results.csv"
System Files
You can include system files in your instructions using the special comment syntax:
// system path/to/system/file.txt
These files will be included in the system prompt for the AI model. This is useful for providing additional context about your data format, analysis requirements, or processing parameters. System files are also an excellent way to teach the AI about specific packages that are installed in your environment and how to use them effectively.
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 geniescript-0.1.1.tar.gz.
File metadata
- Download URL: geniescript-0.1.1.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.18 Linux/6.8.0-49-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6702a2ad6ba107fe4a75c573308feac07f9318041a145da32d94a762cd9faac
|
|
| MD5 |
9aeaa1e65e0cbc9bfaddc82a2f60bdff
|
|
| BLAKE2b-256 |
e5c3d7ad93b7ac7beba05e4eec0acae582a5aa8a012e40ce13d97d1181a68c78
|
File details
Details for the file geniescript-0.1.1-py3-none-any.whl.
File metadata
- Download URL: geniescript-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.18 Linux/6.8.0-49-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46f41183c692c82591ef9179e21d509bedf39083878491997ec4a372e4470c2b
|
|
| MD5 |
a0c6292dd66a8dfe682f2ce0bd0a053d
|
|
| BLAKE2b-256 |
7659fa7dbad5f4fa952383200c211bffc5ab73df34a9ab14f431ec30b2e2b718
|