From f90e83a9686e6d8ced90f7cde89c64e755a5b43a Mon Sep 17 00:00:00 2001 From: isms Date: Mon, 2 Nov 2015 09:09:45 -0500 Subject: [PATCH] Add support for .env loading --- {{ cookiecutter.repo_name }}/requirements.txt | 3 ++- {{ cookiecutter.repo_name }}/src/make_dataset.py | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/{{ cookiecutter.repo_name }}/requirements.txt b/{{ cookiecutter.repo_name }}/requirements.txt index 8ac80e4..92afd0e 100644 --- a/{{ cookiecutter.repo_name }}/requirements.txt +++ b/{{ cookiecutter.repo_name }}/requirements.txt @@ -2,4 +2,5 @@ click Sphinx coverage s3cmd==1.6.0 -flake8 \ No newline at end of file +flake8 +python-dotenv \ No newline at end of file diff --git a/{{ cookiecutter.repo_name }}/src/make_dataset.py b/{{ cookiecutter.repo_name }}/src/make_dataset.py index 4088223..65f3985 100644 --- a/{{ cookiecutter.repo_name }}/src/make_dataset.py +++ b/{{ cookiecutter.repo_name }}/src/make_dataset.py @@ -4,8 +4,8 @@ import logging @click.command() -@click.argument('input_filepath', type=str) -@click.argument('output_filepath', type=str) +@click.argument('input_filepath', type=click.Path(exists=True)) +@click.argument('output_filepath', type=click.Path()) def main(input_filepath, output_filepath): logger = logging.getLogger(__name__) logger.info('making final data set from raw data') @@ -15,5 +15,9 @@ if __name__ == '__main__': log_fmt = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' logging.basicConfig(level=logging.INFO, format=log_fmt) + project_dir = os.path.join(os.path.dirname(__file__), os.pardir) + dotenv_path = os.path.join(project_dir, '.env') + dotenv.load_dotenv(dotenv_path) + main()