code-for-venezuela / c4v-py

3 stars 3 forks source link

Luis/install profiles #98

Closed LDiazN closed 2 years ago

LDiazN commented 3 years ago

Problem

We need to provide multiple installation profiles, so that users of this library can have lighter installation of the project in case they don't need some dependency-heavy features, like classification or the dashboard. Also, a missing dependency should be notified gracefully when using the cli tool, a meaningful message should be printed so the user can know which actions to take to solve it.

Solution

Added "extra" dependencies as installation profles. Added profiles:

Also, as the microscope.Manager object is the main interface for the CLI tool, optional features were included as part of the functions and not the module itself. for example:

def run_classification_from_experiment(
        self, branch: str, experiment: str, data: List[ScrapedData]
    ) -> List[Dict[str, Any]]:
        """
           docs
        """
        from c4v.classifier.classifier_experiment import ClassifierExperiment

        classifier_experiment = ClassifierExperiment.from_branch_and_experiment(
            branch, experiment
        )

        return classifier_experiment.classify(data)

Note that imports in python won't run the entire python file twice when they are called more than once, so they are lazy by default.

Relevant files:

Further work