creativecommons / quantifying

quantify the size and diversity of the commons--the collection of works that are openly licensed or in the public domain
MIT License
22 stars 30 forks source link

[Feature] refactor scripts to put shared code in a shared library #91

Closed TimidRobot closed 3 months ago

TimidRobot commented 3 months ago

Problem

put shared code in a shared library

Description

Potential new shared module:

# Standard library
import datetime
import os.path

def setup():
    # Datetime
    datetime_today = datetime.datetime.today()

    # Paths
    path_work_dir = os.path.dirname(
        os.path.abspath(os.path.realpath(__file__))
    )
    path_repo_root = os.path.dirname(
        os.path.abspath(os.path.realpath(path_work_dir))
    )
    path_dotenv = os.path.abspath(
        os.path.realpath(os.path.join(path_work_dir, ".env"))
    )
    return path_repo_root, path_work_dir, path_dotenv, datetime_today

used in scripts (assumes above is named quantify):

# First-party/Local
import quantify

# ...

PATH_REPO_ROOT, PATH_WORK_DIR, PATH_DOTENV, DATETIME_TODAY = quantify.setup()
load_dotenv(PATH_DOTENV)
TimidRobot commented 3 months ago

@nox1134 please comment on this issue so i can assign it to you

TimidRobot commented 3 months ago

@IamMQaisar please comment on this issue so i can assign it to you

IamMQaisar commented 3 months ago

Yes! @TimidRobot

nox1134 commented 3 months ago

Hi @TimidRobot!