Package: pyPhases
pyPhasesA toolobx for configuration based data generation.The main concepts are:Phases: A phase is a python based process that can generate data that depends on configuration values. Phases can also access data from different phases usingself.getData("myDataId", MyDataType).Config: A config is saved in adict-like manner and is connected to the project. The configuration can be loaded from phases withgetConfig("myConfigField").Exporter: An exporter can save data persitently to a storage. A Storage has specific python types it can handle. You can populate your data to a exporter usingself.registerData("myDataId", myData)if any exporter can handle the data type.Project: A project is the composition of all the concepts its stores the config values, knows about the phases and can execute phases. For a automatic config based composition, the connected toolphasescan be used.InstallPython>= 3.6is required.pip install phases pyPhasesHello World ExampleThe project is using two phases, one to generate the sentence to be said and the other one to actually say it.First we need a data directory where where the data will be stored (defaultdata):mkdir datapoject.yamlname:HelloWorldexporter:# exporter that can handle primitive types-PickleExporterphases:-name:GenerateItexports:-sentence-name:SayItdata:-name:sentencedependsOn:-whoconfig:who:worldHelloWorld/phases/GenerateIt.pyfrompyPhasesimportPhaseclassGenerateIt(Phase):"""This phase generates the sentence to be said."""defmain(self):self.log("Generating the sentence")greetWho=self.getConfig("who")self.registerData("sentence","Hello%s!"%greetWho)HelloWorld/phases/SayIt.pyfrompyPhasesimportPhaseclassSayIt(Phase):"""This phase says the sentence."""defmain(self):sentence=self.getData("sentence",str)self.logSuccess(sentence)Run the Example:python -m phases run SayItFirst Output will generate the sentence in phaseGenerateIt:gitpod /workspace/pyphases-hello-world (main) $ phases run SayIt[phases] Phases v1.0.2 with pyPhases v1.1.5 (Log level: LogLevel.INFO)[SayIt] RUN phase SayIt: SayIt[Project] Data sentenceworld--current was not found, try to find phase to generate it[GenerateIt] RUN phase GenerateIt: GenerateIt[GenerateIt] Generating the sentence[SayIt] Hello world!The data is now stored in the file:data/sentence--currentIf your run it again (python -m phases run SayIt) the data is loaded using the Pickleexporter:gitpod /workspace/pyphases-hello-world (main) $ phases run SayIt[phases] Phases v1.0.2 with pyPhases v1.1.5 (Log level: LogLevel.INFO)[SayIt] RUN phase SayIt: SayIt[SayIt] Hello world!If you change the config valuewhoin the project towhole world. The data is generated again:gitpod /workspace/pyphases-hello-world (main) $ phases run --set who="whole world" SayIt[phases] Phases v1.0.2 with pyPhases v1.1.5 (Log level: LogLevel.INFO)[SayIt] RUN phase SayIt: SayIt[Project] Data sentencewholeworld--current was not found, try to find phase to generate it[GenerateIt] RUN phase GenerateIt: GenerateIt[GenerateIt] Generating the sentence[SayIt] Hello whole world!if you want to explicit generate the data you can just run the first phase:python -m phases run GenerateItExample projectshttps://gitlab.com/tud.ibmt.public/pyphases/pyphasesml-example-bumpdetectorhttps://gitlab.com/tud.ibmt.public/pyphases/arousaldetectorDevelopmentbuildpython setup.py sdist bdist_wheelpublishtwine upload dist/*documentationsphinx-apidoc -o docs/source pyPhasessphinx-build -b html docs/source docs/buildtestpython -m unittest discover -v