Python Boilerplate contains all the boilerplate you need to create a Python package with command line
- Free software: MIT license
Set up an environment
conda create -n gpt_env python=3.11.5 conda activate gpt_env pip install -r requirements.txt
Set up an environment variable to store GPT-4 API key
conda activate gpt_env conda env config vars set OPENAI_API_KEY="<your api key>" conda deactivate # reactivate conda activate gpt_env echo $OPENAI_API_KEY # make sure the key setup # in python %python import os import openai openai.api_key = os.environ["OPENAI_API_KEY"]
From OpenAI website for the best practice for API key safety: https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
- Python 3.11+
Example usage
Check Notebook GPT4_pipeline_Demo
Command line usage
cd ./cellmaps_annotate_hierarchy python .query_llm_for_analysis.py --config ./gpt4_config.json \ --initialize \ --input ./data/example_NeST_table_sub.tsv \ --input_sep ','\ --set_index 'NEST ID' \ --gene_column Genes\ --gene_sep ',' \ --start 0 \ --end 27 \ --output_file 'data/demo_commandline.tsv'
git clone https://github.com/idekerlab/cellmaps_annotate_hierarchy cd cellmaps_annotate_hierarchy make dist pip install dist/cellmaps_annotate_hierarchycmd*whl
Run make command with no arguments to see other build/deploy options including creation of Docker image
make
Output:
clean remove all build, test, coverage and Python artifacts clean-build remove build artifacts clean-pyc remove Python file artifacts clean-test remove test and coverage artifacts lint check style with flake8 test run tests quickly with the default Python test-all run tests on every Python version with tox coverage check code coverage quickly with the default Python docs generate Sphinx HTML documentation, including API docs servedocs compile the docs watching for changes testrelease package and upload a TEST release release package and upload a release dist builds source and wheel package install install the package to the active Python's site-packages dockerbuild build docker image and store in local repository dockerpush push image to dockerhub
Below are steps to make changes to this code base, deploy, and then run against those changes.
Make changes
Modify code in this repo as desired
Build and deploy
# From base directory of this repo cellmaps_annotate_hierarchy pip uninstall cellmaps_annotate_hierarchy -y ; make clean dist; pip install dist/cellmaps_annotate_hierarchy*whl
TODO: Add description of needed files
Example usage
TODO: Add information about example usage
docker run -v `pwd`:`pwd` -w `pwd` idekerlab/cellmaps_annotate_hierarchy:0.1.0 cellmaps_annotate_hierarchycmd.py # TODO Add other needed arguments here
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.