espin086 / GPT-Jobhunter

AI-powered job analysis and resume coaching tool using GPT. Analyzes job postings and provides personalized recommendations to job seekers for improving their resumes.
MIT License
55 stars 15 forks source link

Add user input in setup.py for the API key so that a pip install can get the code running #95

Closed espin086 closed 8 months ago

espin086 commented 8 months ago

Need to do this so setup.py can also set up the API key during installation as another way to setup the project:

To permanently save the API key from setup.py to the user's environment, you can make use of environment variables. Here's how you can do it:

  1. Open the setup.py file in a text editor.
  2. Add the following code at the beginning of the file:

import os

# Check if the API key is already set as an environment variable
if 'API_KEY' not in os.environ:
    api_key = input('Enter your API key: ')
    os.environ['API_KEY'] = api_key
marcolab commented 8 months ago

Hi! I would like to work on this issue

espin086 commented 8 months ago

@marcolab yes please get started on this, appreciate your help, please make sure to look at the contribution guide for how to make this update

marcolab commented 8 months ago

@espin086 I've looked into it and it seems like it is not possible to add user input to setup.py. Perhaps an alternative solution could be to have an additional pip installation option (as shown here), but it might be overkill

espin086 commented 8 months ago

@marcolab - can you try the input() function built into python?

Here is what I was thinking:

import os

# Check if the environmental variable is present
if 'ENV_VARIABLE_NAME' in os.environ:
    env_variable = os.environ['ENV_VARIABLE_NAME']
else:
    # If the environmental variable is not present, prompt the user for input
    env_variable = input("Enter the value for ENV_VARIABLE_NAME: ")
AtharvaJadhav7 commented 8 months ago

@espin086 maybe we can get api key input using cli?