From 652fe37501e4d3bf4674ed7d38172a5a6021a814 Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Wed, 5 Jun 2024 18:17:40 -0600 Subject: [PATCH 01/22] Hello World from the new MusicBox main(). --- src/acom_music_box/goMusicBox.bat | 1 + src/acom_music_box/music_box_main.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/acom_music_box/goMusicBox.bat create mode 100644 src/acom_music_box/music_box_main.py diff --git a/src/acom_music_box/goMusicBox.bat b/src/acom_music_box/goMusicBox.bat new file mode 100644 index 00000000..1c159795 --- /dev/null +++ b/src/acom_music_box/goMusicBox.bat @@ -0,0 +1 @@ +python music_box_main.py \ No newline at end of file diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py new file mode 100644 index 00000000..30ad43b5 --- /dev/null +++ b/src/acom_music_box/music_box_main.py @@ -0,0 +1,19 @@ +from acom_music_box import MusicBox + +import math +import sys + + + +# Display progress message on the console. +# endString = set this to '' for no return +def progress(message, endString='\n'): + if (True): # disable here in production + print(message, end=endString) + sys.stdout.flush() + + + +if __name__ == "__main__": + progress("Hello, MusicBox World!") + sys.exit(0) From 5e5b6be9eb0888aa2f325cb12e18d04d5aabaf61 Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Tue, 11 Jun 2024 16:20:04 -0600 Subject: [PATCH 02/22] Python main() is producing valid floating-point output. --- src/acom_music_box/goBuild.bat | 3 ++ src/acom_music_box/music_box.py | 36 +++++++++++++------ src/acom_music_box/music_box_conditions.py | 2 +- src/acom_music_box/music_box_logger.py | 32 +++++++++++++++++ src/acom_music_box/music_box_main.py | 28 ++++++++++----- src/acom_music_box/music_box_model_options.py | 2 +- tests/goTest.bat | 1 + 7 files changed, 83 insertions(+), 21 deletions(-) create mode 100644 src/acom_music_box/goBuild.bat create mode 100644 src/acom_music_box/music_box_logger.py create mode 100644 tests/goTest.bat diff --git a/src/acom_music_box/goBuild.bat b/src/acom_music_box/goBuild.bat new file mode 100644 index 00000000..2d958737 --- /dev/null +++ b/src/acom_music_box/goBuild.bat @@ -0,0 +1,3 @@ +cd ..\.. +pip install . +cd src\acom_music_box \ No newline at end of file diff --git a/src/acom_music_box/music_box.py b/src/acom_music_box/music_box.py index f9b2b112..763c9a7b 100644 --- a/src/acom_music_box/music_box.py +++ b/src/acom_music_box/music_box.py @@ -9,6 +9,7 @@ from .music_box_conditions import Conditions import csv import musica +import music_box_logger class MusicBox: """ @@ -36,13 +37,15 @@ def __init__(self, box_model_options=None, species_list=None, reaction_list=None evolving_conditions (List[EvolvingConditions]): List of evolving conditions over time. config_file (String): File path for the configuration file to be located. Default is "camp_data/config.json". """ - self.box_model_options = box_model_options + self.box_model_options = box_model_options if box_model_options is not None else BoxModelOptions() self.species_list = species_list if species_list is not None else SpeciesList() self.reaction_list = reaction_list if reaction_list is not None else ReactionList() - self.initial_conditions = initial_conditions + self.initial_conditions = initial_conditions if initial_conditions is not None else Conditions() self.evolving_conditions = evolving_conditions if evolving_conditions is not None else EvolvingConditions([], []) self.config_file = config_file if config_file is not None else "camp_data/config.json" + self.solver = None + def add_evolving_condition(self, time_point, conditions): @@ -428,7 +431,7 @@ def solve(self, path_to_output = None): list: A 2D list where each inner list represents the results of the simulation at a specific time step. """ - + #sets up initial conditions to be current conditions curr_conditions = self.initial_conditions @@ -448,7 +451,7 @@ def solve(self, path_to_output = None): next_conditions_index = 1 next_conditions = self.evolving_conditions.conditions[1] next_conditions_time = self.evolving_conditions.times[1] - + #initalizes output headers output_array = [] @@ -458,10 +461,16 @@ def solve(self, path_to_output = None): headers.append("ENV.temperature") headers.append("ENV.pressure") + music_box_logger.progress("solve0152 self.solver = {}".format(self.solver)) + + if (self.solver is None): + music_box_logger.progress("Warning: MusicBox object {} has no solver." + .format(self)) rate_constant_ordering = musica.user_defined_reaction_rates(self.solver) + species_constant_ordering = musica.species_ordering(self.solver) - + #adds species headers to output ordered_species_headers = [k for k, v in sorted(species_constant_ordering.items(), key=lambda item: item[1])] for spec in ordered_species_headers: @@ -478,9 +487,11 @@ def solve(self, path_to_output = None): next_output_time = curr_time #runs the simulation at each timestep - + music_box_logger.progress("solve03 path_to_output = {}".format(path_to_output)) + while(curr_time <= self.box_model_options.simulation_length): + #outputs to output_array if enough time has elapsed if(next_output_time <= curr_time): row = [] @@ -507,8 +518,10 @@ def solve(self, path_to_output = None): else: next_conditions = None + + music_box_logger.progress("solve033 species_constant_ordering = {}".format(species_constant_ordering)) - + #updates M accordingly if 'M' in species_constant_ordering: BOLTZMANN_CONSTANT = 1.380649e-23 @@ -516,21 +529,22 @@ def solve(self, path_to_output = None): GAS_CONSTANT = BOLTZMANN_CONSTANT * AVOGADRO_CONSTANT ordered_concentrations[species_constant_ordering['M']] = curr_conditions.pressure / (GAS_CONSTANT * curr_conditions.temperature) + music_box_logger.progress("solve035 args = {} {} {} {} {}".format(self.box_model_options.chem_step_time, curr_conditions.temperature, curr_conditions.pressure, ordered_concentrations, ordered_rate_constants)) #solves and updates concentration values in concentration array + if (not ordered_concentrations): + music_box_logger.progress("Warning: ordered_concentrations list is empty.") musica.micm_solve(self.solver, self.box_model_options.chem_step_time, curr_conditions.temperature, curr_conditions.pressure, ordered_concentrations, ordered_rate_constants) - - #increments time curr_time += self.box_model_options.chem_step_time - + #outputs to file if output is present if(path_to_output != None): with open(path_to_output, 'w', newline='') as output: writer = csv.writer(output) writer.writerows(output_array) - + #returns output_array return output_array diff --git a/src/acom_music_box/music_box_conditions.py b/src/acom_music_box/music_box_conditions.py index f44c5076..7870d8a6 100644 --- a/src/acom_music_box/music_box_conditions.py +++ b/src/acom_music_box/music_box_conditions.py @@ -19,7 +19,7 @@ class Conditions: reactionRates (List[ReactionRate]): A list of reaction rates. """ - def __init__(self, pressure, temperature, species_concentrations=None, reaction_rates=None): + def __init__(self, pressure=0.83, temperature=303.0, species_concentrations=None, reaction_rates=None): """ Initializes a new instance of the Conditions class. diff --git a/src/acom_music_box/music_box_logger.py b/src/acom_music_box/music_box_logger.py new file mode 100644 index 00000000..4ca3f4bf --- /dev/null +++ b/src/acom_music_box/music_box_logger.py @@ -0,0 +1,32 @@ +import sys + +# Class Logger is included here for completeness, +# but not used because progress() is such a lighweight function. +class Logger: + """ + Logs messages to the console, which can then be captured to a log file. + + Attributes: + """ + + def __init__(self): + """ + Initializes a new instance of the Reaction class. + + Args: + name (str): The name of the reaction. + reaction_type (str): The type of the reaction. + reactants (List[Reactant]): A list of Reactant instances representing the reactants. Default is an empty list. + products (List[Product]): A list of Product instances representing the products. Default is an empty list. + scaling_factor (float, optional): A scaling factor for the reaction rate. Defaults to None. + """ + pass + + + +# Display progress message on the console. +# endString = set this to '' for no return +def progress(message, endString='\n'): + if (True): # disable here in production + print(message, end=endString) + sys.stdout.flush() diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index 30ad43b5..9086923f 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -1,19 +1,31 @@ from acom_music_box import MusicBox import math +import datetime import sys +import music_box_logger -# Display progress message on the console. -# endString = set this to '' for no return -def progress(message, endString='\n'): - if (True): # disable here in production - print(message, end=endString) - sys.stdout.flush() +if __name__ == "__main__": + music_box_logger.progress("{}".format(__file__)) + music_box_logger.progress("Start time: {}".format(datetime.datetime.now())) + + music_box_logger.progress("Hello, MusicBox World!") + + # set up the home configuration directory TODO: Make this a command-line argument. + musicBoxHomeDir = "C:\\2024\\MusicBox\\music-box\\tests\\configs\\analytical_config\\" + + # create and load a MusicBox object + myBox = MusicBox() + myBox.readConditionsFromJson(musicBoxHomeDir + "my_config.json") + music_box_logger.progress("myBox = {}".format(myBox)) + # create solver and solve + myBox.create_solver(musicBoxHomeDir + myBox.config_file) + mySolution = myBox.solve() + music_box_logger.progress("mySolution = {}".format(mySolution)) -if __name__ == "__main__": - progress("Hello, MusicBox World!") + music_box_logger.progress("End time: {}".format(datetime.datetime.now())) sys.exit(0) diff --git a/src/acom_music_box/music_box_model_options.py b/src/acom_music_box/music_box_model_options.py index 4f9989b8..e20843fe 100644 --- a/src/acom_music_box/music_box_model_options.py +++ b/src/acom_music_box/music_box_model_options.py @@ -12,7 +12,7 @@ class BoxModelOptions: simulationLength (float): Length of the simulation in hours. """ - def __init__(self, chem_step_time, output_step_time, simulation_length, grid="box"): + def __init__(self, chem_step_time=1.0, output_step_time=5.0, simulation_length=100.0, grid="box"): """ Initializes a new instance of the BoxModelOptions class. diff --git a/tests/goTest.bat b/tests/goTest.bat new file mode 100644 index 00000000..55b033e9 --- /dev/null +++ b/tests/goTest.bat @@ -0,0 +1 @@ +pytest \ No newline at end of file From 321d2b9452a43b471670ac77a38726444858ab4f Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Mon, 24 Jun 2024 17:33:24 -0600 Subject: [PATCH 03/22] Added command-line arguments. --- src/acom_music_box/goMusicBox.bat | 2 +- src/acom_music_box/music_box.py | 7 +----- src/acom_music_box/music_box_logger.py | 6 +----- src/acom_music_box/music_box_main.py | 30 ++++++++++++++++++++++++-- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/acom_music_box/goMusicBox.bat b/src/acom_music_box/goMusicBox.bat index 1c159795..3af2a04f 100644 --- a/src/acom_music_box/goMusicBox.bat +++ b/src/acom_music_box/goMusicBox.bat @@ -1 +1 @@ -python music_box_main.py \ No newline at end of file +python music_box_main.py homeDir="C:\\2024\MusicBox\music-box\\tests\\configs\\analytical_config\\" diff --git a/src/acom_music_box/music_box.py b/src/acom_music_box/music_box.py index 763c9a7b..ffbc3d74 100644 --- a/src/acom_music_box/music_box.py +++ b/src/acom_music_box/music_box.py @@ -487,9 +487,7 @@ def solve(self, path_to_output = None): next_output_time = curr_time #runs the simulation at each timestep - music_box_logger.progress("solve03 path_to_output = {}".format(path_to_output)) - while(curr_time <= self.box_model_options.simulation_length): #outputs to output_array if enough time has elapsed @@ -518,9 +516,7 @@ def solve(self, path_to_output = None): else: next_conditions = None - - music_box_logger.progress("solve033 species_constant_ordering = {}".format(species_constant_ordering)) - + #updates M accordingly if 'M' in species_constant_ordering: @@ -529,7 +525,6 @@ def solve(self, path_to_output = None): GAS_CONSTANT = BOLTZMANN_CONSTANT * AVOGADRO_CONSTANT ordered_concentrations[species_constant_ordering['M']] = curr_conditions.pressure / (GAS_CONSTANT * curr_conditions.temperature) - music_box_logger.progress("solve035 args = {} {} {} {} {}".format(self.box_model_options.chem_step_time, curr_conditions.temperature, curr_conditions.pressure, ordered_concentrations, ordered_rate_constants)) #solves and updates concentration values in concentration array if (not ordered_concentrations): music_box_logger.progress("Warning: ordered_concentrations list is empty.") diff --git a/src/acom_music_box/music_box_logger.py b/src/acom_music_box/music_box_logger.py index 4ca3f4bf..5cd213c0 100644 --- a/src/acom_music_box/music_box_logger.py +++ b/src/acom_music_box/music_box_logger.py @@ -1,7 +1,7 @@ import sys # Class Logger is included here for completeness, -# but not used because progress() is such a lighweight function. +# but not used because progress() is such a lightweight function. class Logger: """ Logs messages to the console, which can then be captured to a log file. @@ -15,10 +15,6 @@ def __init__(self): Args: name (str): The name of the reaction. - reaction_type (str): The type of the reaction. - reactants (List[Reactant]): A list of Reactant instances representing the reactants. Default is an empty list. - products (List[Product]): A list of Product instances representing the products. Default is an empty list. - scaling_factor (float, optional): A scaling factor for the reaction rate. Defaults to None. """ pass diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index 9086923f..614517c4 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -8,14 +8,40 @@ +# Retrieve named arguments from the command line and +# return in a dictionary of keywords. +# argPairs = list of arguments, probably from sys.argv +# named arguments are formatted like this=3.14159 +# return dictionary of keywords and values +def getArgsDictionary(argPairs): + argDict = {} + + for argPair in argPairs: + # the arguments are: arg=value + pairValue = argPair.split('=') + if (len(pairValue) < 2): + argDict[pairValue[0]] = None + continue + + argDict[pairValue[0]] = pairValue[1] + + return(argDict) + + + if __name__ == "__main__": music_box_logger.progress("{}".format(__file__)) music_box_logger.progress("Start time: {}".format(datetime.datetime.now())) music_box_logger.progress("Hello, MusicBox World!") - # set up the home configuration directory TODO: Make this a command-line argument. - musicBoxHomeDir = "C:\\2024\\MusicBox\\music-box\\tests\\configs\\analytical_config\\" + # retrieve and parse the command-line arguments + myArgs = getArgsDictionary(sys.argv) + + # set up the home configuration directory + musicBoxHomeDir = "music-box\\tests\\configs\\analytical_config\\" # default + if ("homeDir" in myArgs): + musicBoxHomeDir = myArgs.get("homeDir") # create and load a MusicBox object myBox = MusicBox() From 509037bdf0626a69ac0e1d288d6c79b4a185163e Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Tue, 25 Jun 2024 10:36:59 -0600 Subject: [PATCH 04/22] Write out the solution. --- src/acom_music_box/music_box_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index 614517c4..cb0d583d 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -50,7 +50,7 @@ def getArgsDictionary(argPairs): # create solver and solve myBox.create_solver(musicBoxHomeDir + myBox.config_file) - mySolution = myBox.solve() + mySolution = myBox.solve(musicBoxHomeDir + "my_solution.csv") music_box_logger.progress("mySolution = {}".format(mySolution)) music_box_logger.progress("End time: {}".format(datetime.datetime.now())) From 5851f6ed015943fde3dbaf7b93f4931868580992 Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Wed, 26 Jun 2024 16:42:54 -0600 Subject: [PATCH 05/22] Import music_box_logger the right way. --- src/acom_music_box/__init__.py | 1 + src/acom_music_box/music_box.py | 4 +++- src/acom_music_box/music_box_main.py | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/acom_music_box/__init__.py b/src/acom_music_box/__init__.py index 17fdbe40..ff481af8 100644 --- a/src/acom_music_box/__init__.py +++ b/src/acom_music_box/__init__.py @@ -18,5 +18,6 @@ from .music_box_conditions import Conditions from .music_box_evolving_conditions import EvolvingConditions +from acom_music_box import music_box_logger from .music_box import MusicBox diff --git a/src/acom_music_box/music_box.py b/src/acom_music_box/music_box.py index ffbc3d74..32f6a63a 100644 --- a/src/acom_music_box/music_box.py +++ b/src/acom_music_box/music_box.py @@ -7,9 +7,11 @@ from .music_box_species_list import SpeciesList from .music_box_model_options import BoxModelOptions from .music_box_conditions import Conditions +from acom_music_box import music_box_logger + import csv import musica -import music_box_logger + class MusicBox: """ diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index cb0d583d..fbe9756f 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -1,11 +1,11 @@ from acom_music_box import MusicBox +from acom_music_box import music_box_logger + import math import datetime import sys -import music_box_logger - # Retrieve named arguments from the command line and From be55094fb63018232d73ed1662783fb086ae2820 Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Fri, 28 Jun 2024 11:13:05 -0600 Subject: [PATCH 06/22] Move log statements into main(). --- src/acom_music_box/music_box.py | 2 +- src/acom_music_box/music_box_main.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/acom_music_box/music_box.py b/src/acom_music_box/music_box.py index 32f6a63a..2c67d55c 100644 --- a/src/acom_music_box/music_box.py +++ b/src/acom_music_box/music_box.py @@ -463,7 +463,7 @@ def solve(self, path_to_output = None): headers.append("ENV.temperature") headers.append("ENV.pressure") - music_box_logger.progress("solve0152 self.solver = {}".format(self.solver)) + #music_box_logger.progress("solve0152 self.solver = {}".format(self.solver)) if (self.solver is None): music_box_logger.progress("Warning: MusicBox object {} has no solver." diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index fbe9756f..fdf2b48b 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -50,6 +50,7 @@ def getArgsDictionary(argPairs): # create solver and solve myBox.create_solver(musicBoxHomeDir + myBox.config_file) + music_box_logger.progress("myBox.solver = {}".format(myBox.solver)) mySolution = myBox.solve(musicBoxHomeDir + "my_solution.csv") music_box_logger.progress("mySolution = {}".format(mySolution)) From a388a2bb98fff769cc7e95c1e335585b63b340dd Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Fri, 28 Jun 2024 16:14:35 -0600 Subject: [PATCH 07/22] Removed realistic physical defaults, replaced with None. --- src/acom_music_box/music_box.py | 1 - src/acom_music_box/music_box_conditions.py | 3 ++- src/acom_music_box/music_box_model_options.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/acom_music_box/music_box.py b/src/acom_music_box/music_box.py index 2c67d55c..fd948ba4 100644 --- a/src/acom_music_box/music_box.py +++ b/src/acom_music_box/music_box.py @@ -463,7 +463,6 @@ def solve(self, path_to_output = None): headers.append("ENV.temperature") headers.append("ENV.pressure") - #music_box_logger.progress("solve0152 self.solver = {}".format(self.solver)) if (self.solver is None): music_box_logger.progress("Warning: MusicBox object {} has no solver." diff --git a/src/acom_music_box/music_box_conditions.py b/src/acom_music_box/music_box_conditions.py index 7870d8a6..73c8ba0f 100644 --- a/src/acom_music_box/music_box_conditions.py +++ b/src/acom_music_box/music_box_conditions.py @@ -19,7 +19,8 @@ class Conditions: reactionRates (List[ReactionRate]): A list of reaction rates. """ - def __init__(self, pressure=0.83, temperature=303.0, species_concentrations=None, reaction_rates=None): + def __init__(self, pressure=None, temperature=None, species_concentrations=None, reaction_rates=None): + """ Initializes a new instance of the Conditions class. diff --git a/src/acom_music_box/music_box_model_options.py b/src/acom_music_box/music_box_model_options.py index e20843fe..b2a9c4ef 100644 --- a/src/acom_music_box/music_box_model_options.py +++ b/src/acom_music_box/music_box_model_options.py @@ -12,7 +12,8 @@ class BoxModelOptions: simulationLength (float): Length of the simulation in hours. """ - def __init__(self, chem_step_time=1.0, output_step_time=5.0, simulation_length=100.0, grid="box"): + def __init__(self, chem_step_time=None, output_step_time=None, simulation_length=None, grid="box"): + """ Initializes a new instance of the BoxModelOptions class. From b1cd963c8b484938d8325d0dde1b68e093f8575b Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Mon, 1 Jul 2024 16:16:56 -0600 Subject: [PATCH 08/22] Throw exception for None solver instead of Warning. --- src/acom_music_box/music_box.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acom_music_box/music_box.py b/src/acom_music_box/music_box.py index fd948ba4..6cc43374 100644 --- a/src/acom_music_box/music_box.py +++ b/src/acom_music_box/music_box.py @@ -465,7 +465,7 @@ def solve(self, path_to_output = None): if (self.solver is None): - music_box_logger.progress("Warning: MusicBox object {} has no solver." + raise Exception("Error: MusicBox object {} has no solver." .format(self)) rate_constant_ordering = musica.user_defined_reaction_rates(self.solver) From bf52a88aeaf70d4fb9c655fed529e6aec3263c60 Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Tue, 2 Jul 2024 14:08:23 -0600 Subject: [PATCH 09/22] Removed ACOM Logger. Set up music_box operation as executable script and python command line. --- pyproject.toml | 7 +++++-- src/acom_music_box/__init__.py | 1 - src/acom_music_box/music_box.py | 25 +++++++++++++++-------- src/acom_music_box/music_box_logger.py | 28 -------------------------- src/acom_music_box/music_box_main.py | 26 +++++++++++++++--------- 5 files changed, 39 insertions(+), 48 deletions(-) delete mode 100644 src/acom_music_box/music_box_logger.py diff --git a/pyproject.toml b/pyproject.toml index e9952782..ef84a7a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,8 +11,11 @@ classifiers = ["License :: OSI Approved :: Apache Software License"] dynamic = ["version", "description"] dependencies = [ - "musica==0.6.1.dev0" + "musica==0.7.0" ] [project.urls] -Home = "https://github.com/NCAR/music-box" \ No newline at end of file +Home = "https://github.com/NCAR/music-box" + +[project.scripts] +music_box = "acom_music_box.music_box_main:main" diff --git a/src/acom_music_box/__init__.py b/src/acom_music_box/__init__.py index ff481af8..17fdbe40 100644 --- a/src/acom_music_box/__init__.py +++ b/src/acom_music_box/__init__.py @@ -18,6 +18,5 @@ from .music_box_conditions import Conditions from .music_box_evolving_conditions import EvolvingConditions -from acom_music_box import music_box_logger from .music_box import MusicBox diff --git a/src/acom_music_box/music_box.py b/src/acom_music_box/music_box.py index 6cc43374..e1378ed8 100644 --- a/src/acom_music_box/music_box.py +++ b/src/acom_music_box/music_box.py @@ -1,18 +1,21 @@ import json import os +import logging +logger = logging.getLogger(__name__) + from .music_box_evolving_conditions import EvolvingConditions from .music_box_reaction_list import ReactionList from .music_box_reaction import Reaction, Branched, Arrhenius, Tunneling, Troe_Ternary from .music_box_species_list import SpeciesList from .music_box_model_options import BoxModelOptions from .music_box_conditions import Conditions -from acom_music_box import music_box_logger import csv import musica + class MusicBox: """ Represents a box model with attributes such as box model options, species list, reaction list, @@ -414,7 +417,7 @@ def create_solver(self, path_to_config): None """ # Create a solver object using the configuration file - self.solver = musica.create_micm(path_to_config) + self.solver = musica.create_solver(path_to_config) def solve(self, path_to_output = None): @@ -519,17 +522,22 @@ def solve(self, path_to_output = None): next_conditions = None + # calculate air density from the ideal gas law + BOLTZMANN_CONSTANT = 1.380649e-23 + AVOGADRO_CONSTANT = 6.02214076e23; + GAS_CONSTANT = BOLTZMANN_CONSTANT * AVOGADRO_CONSTANT + air_density = curr_conditions.pressure / (GAS_CONSTANT * curr_conditions.temperature) + #updates M accordingly if 'M' in species_constant_ordering: - BOLTZMANN_CONSTANT = 1.380649e-23 - AVOGADRO_CONSTANT = 6.02214076e23; - GAS_CONSTANT = BOLTZMANN_CONSTANT * AVOGADRO_CONSTANT - ordered_concentrations[species_constant_ordering['M']] = curr_conditions.pressure / (GAS_CONSTANT * curr_conditions.temperature) + ordered_concentrations[species_constant_ordering['M']] = air_density #solves and updates concentration values in concentration array if (not ordered_concentrations): - music_box_logger.progress("Warning: ordered_concentrations list is empty.") - musica.micm_solve(self.solver, self.box_model_options.chem_step_time, curr_conditions.temperature, curr_conditions.pressure, ordered_concentrations, ordered_rate_constants) + logger.info("Warning: ordered_concentrations list is empty.") + musica.micm_solve(self.solver, self.box_model_options.chem_step_time, + curr_conditions.temperature, curr_conditions.pressure, air_density, + ordered_concentrations, ordered_rate_constants) #increments time @@ -537,6 +545,7 @@ def solve(self, path_to_output = None): #outputs to file if output is present if(path_to_output != None): + logger.info("path_to_output = {}".format(path_to_output)) with open(path_to_output, 'w', newline='') as output: writer = csv.writer(output) writer.writerows(output_array) diff --git a/src/acom_music_box/music_box_logger.py b/src/acom_music_box/music_box_logger.py deleted file mode 100644 index 5cd213c0..00000000 --- a/src/acom_music_box/music_box_logger.py +++ /dev/null @@ -1,28 +0,0 @@ -import sys - -# Class Logger is included here for completeness, -# but not used because progress() is such a lightweight function. -class Logger: - """ - Logs messages to the console, which can then be captured to a log file. - - Attributes: - """ - - def __init__(self): - """ - Initializes a new instance of the Reaction class. - - Args: - name (str): The name of the reaction. - """ - pass - - - -# Display progress message on the console. -# endString = set this to '' for no return -def progress(message, endString='\n'): - if (True): # disable here in production - print(message, end=endString) - sys.stdout.flush() diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index fdf2b48b..dd949b8e 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -1,11 +1,13 @@ from acom_music_box import MusicBox -from acom_music_box import music_box_logger import math import datetime import sys +import logging +logger = logging.getLogger(__name__) + # Retrieve named arguments from the command line and @@ -29,12 +31,14 @@ def getArgsDictionary(argPairs): -if __name__ == "__main__": - music_box_logger.progress("{}".format(__file__)) - music_box_logger.progress("Start time: {}".format(datetime.datetime.now())) +def main(): + logging.basicConfig(stream=sys.stdout, level=logging.INFO) + logger.info("{}".format(__file__)) + logger.info("Start time: {}".format(datetime.datetime.now())) - music_box_logger.progress("Hello, MusicBox World!") + logger.info("Hello, MusicBox World!") + # retrieve and parse the command-line arguments myArgs = getArgsDictionary(sys.argv) @@ -46,13 +50,17 @@ def getArgsDictionary(argPairs): # create and load a MusicBox object myBox = MusicBox() myBox.readConditionsFromJson(musicBoxHomeDir + "my_config.json") - music_box_logger.progress("myBox = {}".format(myBox)) + logger.info("myBox = {}".format(myBox)) # create solver and solve myBox.create_solver(musicBoxHomeDir + myBox.config_file) - music_box_logger.progress("myBox.solver = {}".format(myBox.solver)) + logger.info("myBox.solver = {}".format(myBox.solver)) mySolution = myBox.solve(musicBoxHomeDir + "my_solution.csv") - music_box_logger.progress("mySolution = {}".format(mySolution)) + logger.info("mySolution = {}".format(mySolution)) - music_box_logger.progress("End time: {}".format(datetime.datetime.now())) + logger.info("End time: {}".format(datetime.datetime.now())) sys.exit(0) + + +if __name__ == "__main__": + main() From 1893020f8b134f4f5772eaef3477da35f5fef00b Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Tue, 2 Jul 2024 15:25:49 -0600 Subject: [PATCH 10/22] Use argparse and configure it for key=value pairs. --- src/acom_music_box/music_box_main.py | 37 +++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index dd949b8e..f716e8ad 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -8,26 +8,34 @@ import logging logger = logging.getLogger(__name__) +import argparse + +# configure argparse for key-value pairs +class KeyValueAction(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + for value in values: + key, val = value.split('=') + setattr(namespace, key, val) + # Retrieve named arguments from the command line and # return in a dictionary of keywords. -# argPairs = list of arguments, probably from sys.argv +# argPairs = list of arguments, probably from sys.argv[1:] # named arguments are formatted like this=3.14159 # return dictionary of keywords and values def getArgsDictionary(argPairs): - argDict = {} - - for argPair in argPairs: - # the arguments are: arg=value - pairValue = argPair.split('=') - if (len(pairValue) < 2): - argDict[pairValue[0]] = None - continue + parser = argparse.ArgumentParser(description='Process some key=value pairs.') + parser.add_argument( + 'key_value_pairs', + nargs='+', # This means one or more arguments are expected + action=KeyValueAction, + help='Arguments in key=value format' + ) - argDict[pairValue[0]] = pairValue[1] + argDict = vars(parser.parse_args(argPairs)) # return dictionary - return(argDict) + return(argDict) @@ -38,10 +46,11 @@ def main(): logger.info("Hello, MusicBox World!") - # retrieve and parse the command-line arguments - myArgs = getArgsDictionary(sys.argv) - + logger.info("sys.argv = {}".format(sys.argv)) + myArgs = getArgsDictionary(sys.argv[1:]) + logger.info("Command line = {}".format(myArgs)) + # set up the home configuration directory musicBoxHomeDir = "music-box\\tests\\configs\\analytical_config\\" # default if ("homeDir" in myArgs): From 37aeb2f4391f49217e736c6cc47a10b43c15e750 Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Tue, 2 Jul 2024 16:13:57 -0600 Subject: [PATCH 11/22] Revise command-line arguments to configFile and outputDir. --- src/acom_music_box/goMusicBox.bat | 2 +- src/acom_music_box/music_box_main.py | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/acom_music_box/goMusicBox.bat b/src/acom_music_box/goMusicBox.bat index 3af2a04f..84ee4585 100644 --- a/src/acom_music_box/goMusicBox.bat +++ b/src/acom_music_box/goMusicBox.bat @@ -1 +1 @@ -python music_box_main.py homeDir="C:\\2024\MusicBox\music-box\\tests\\configs\\analytical_config\\" +python music_box_main.py configFile="C:\2024\MusicBox\music-box\tests\configs\analytical_config\my_config.json" outputDir="C:\2024\MusicBox\music-box\tests\configs\analytical_config" diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index f716e8ad..e1d5bb10 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -9,6 +9,7 @@ logger = logging.getLogger(__name__) import argparse +import os @@ -47,24 +48,30 @@ def main(): logger.info("Hello, MusicBox World!") # retrieve and parse the command-line arguments - logger.info("sys.argv = {}".format(sys.argv)) myArgs = getArgsDictionary(sys.argv[1:]) logger.info("Command line = {}".format(myArgs)) - # set up the home configuration directory - musicBoxHomeDir = "music-box\\tests\\configs\\analytical_config\\" # default - if ("homeDir" in myArgs): - musicBoxHomeDir = myArgs.get("homeDir") - + # set up the home configuration file + musicBoxConfigFile = "music-box\\tests\\configs\\analytical_config\\my_config.json" # default + if ("configFile" in myArgs): + musicBoxConfigFile = myArgs.get("configFile") + + # set up the output directory + musicBoxOutputDir = ".\\" # default + if ("outputDir" in myArgs): + musicBoxOutputDir = myArgs.get("outputDir") + # create and load a MusicBox object myBox = MusicBox() - myBox.readConditionsFromJson(musicBoxHomeDir + "my_config.json") + myBox.readConditionsFromJson(musicBoxConfigFile) logger.info("myBox = {}".format(myBox)) - # create solver and solve - myBox.create_solver(musicBoxHomeDir + myBox.config_file) + # create solver and solve, writing output to requested directory + campConfig = os.path.dirname(musicBoxConfigFile) + "\\" + myBox.config_file + logger.info("CAMP config = {}".format(campConfig)) + myBox.create_solver(campConfig) logger.info("myBox.solver = {}".format(myBox.solver)) - mySolution = myBox.solve(musicBoxHomeDir + "my_solution.csv") + mySolution = myBox.solve(musicBoxOutputDir + "\\my_solution.csv") logger.info("mySolution = {}".format(mySolution)) logger.info("End time: {}".format(datetime.datetime.now())) From 287f23ed511323cf1e50f8ac77a95290f26e7620 Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Wed, 3 Jul 2024 09:28:29 -0700 Subject: [PATCH 12/22] pull smoke test action from other branch --- .github/workflows/smoke_test.yml | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/smoke_test.yml diff --git a/.github/workflows/smoke_test.yml b/.github/workflows/smoke_test.yml new file mode 100644 index 00000000..40c8f363 --- /dev/null +++ b/.github/workflows/smoke_test.yml @@ -0,0 +1,34 @@ +# This is a basic workflow that is manually triggered + +name: Manual workflow + +# Controls when the action will run. Workflow runs when manually triggered using the UI +# or API. +on: + workflow_dispatch: + # Inputs the workflow accepts. + inputs: + name: + # Friendly description to be shown in the UI instead of 'name' + description: 'Person to greet' + # Default value if no value is explicitly provided + default: 'World' + # Input has to be provided for the workflow to run + required: true + # The data type of the input + type: string + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "greet" + greet: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Runs a single command using the runners shell + - name: Install + run: pip install . + - name: Solve + run: music_box configFile="music-box\tests\configs\analytical_config\my_config.json" outputDir="music-box\tests\configs\analytical_config" From bb13ecd33ac1857f627dbb3df017c9f50fb3e633 Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Wed, 3 Jul 2024 15:26:34 -0600 Subject: [PATCH 13/22] Modified to look like the MusicBox template. --- .github/workflows/smoke_test.yml | 65 +++++++++++++++++--------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/.github/workflows/smoke_test.yml b/.github/workflows/smoke_test.yml index 40c8f363..27cca0dc 100644 --- a/.github/workflows/smoke_test.yml +++ b/.github/workflows/smoke_test.yml @@ -1,34 +1,37 @@ -# This is a basic workflow that is manually triggered - -name: Manual workflow - -# Controls when the action will run. Workflow runs when manually triggered using the UI -# or API. -on: - workflow_dispatch: - # Inputs the workflow accepts. - inputs: - name: - # Friendly description to be shown in the UI instead of 'name' - description: 'Person to greet' - # Default value if no value is explicitly provided - default: 'World' - # Input has to be provided for the workflow to run - required: true - # The data type of the input - type: string - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel +name: smoke + +on: [push, workflow_dispatch] + jobs: - # This workflow contains a single job called "greet" - greet: - # The type of runner that the job will run on - runs-on: ubuntu-latest + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] - # Steps represent a sequence of tasks that will be executed as part of the job + runs-on: ${{ matrix.os }} steps: - # Runs a single command using the runners shell - - name: Install - run: pip install . - - name: Solve - run: music_box configFile="music-box\tests\configs\analytical_config\my_config.json" outputDir="music-box\tests\configs\analytical_config" + + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: actions/setup-python@v5 + with: + python-version: '3.9' + cache: 'pip' + + - run: pip install -r requirements.txt + + - name: Install this package + run: pip install -e . + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run the smoke tests + run: | + pip install . + music_box configFile="tests\configs\analytical_config\my_config.json" outputDir="tests\configs\analytical_config" + From 25976774282d792a71002ed407b828ad8b7bf5fe Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Wed, 3 Jul 2024 15:46:33 -0600 Subject: [PATCH 14/22] Display the working directory. --- src/acom_music_box/music_box_main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index e1d5bb10..1016dc4f 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -46,6 +46,7 @@ def main(): logger.info("Start time: {}".format(datetime.datetime.now())) logger.info("Hello, MusicBox World!") + logger.info("Working directory = {}".format(os.getcwd())) # retrieve and parse the command-line arguments myArgs = getArgsDictionary(sys.argv[1:]) From 71f0b83b15ea19d915c48879f245346ca793bb1f Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Wed, 3 Jul 2024 17:55:56 -0600 Subject: [PATCH 15/22] Removed redundant pip install. --- .github/workflows/smoke_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/smoke_test.yml b/.github/workflows/smoke_test.yml index 27cca0dc..b90845ee 100644 --- a/.github/workflows/smoke_test.yml +++ b/.github/workflows/smoke_test.yml @@ -32,6 +32,5 @@ jobs: - name: Run the smoke tests run: | - pip install . music_box configFile="tests\configs\analytical_config\my_config.json" outputDir="tests\configs\analytical_config" From 3e0072a0d9ffebf104bf1f13b83c6ee92b5173ef Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Tue, 9 Jul 2024 18:15:25 -0500 Subject: [PATCH 16/22] Action test (#174) * listing debug information * ok actually printing wd * trying forward slashes * trying to join files independent of os slashes * removing csv file --- .github/workflows/smoke_test.yml | 11 ++++------- requirements.txt | 5 ----- src/acom_music_box/music_box_main.py | 4 ++-- 3 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 requirements.txt diff --git a/.github/workflows/smoke_test.yml b/.github/workflows/smoke_test.yml index b90845ee..4fcece83 100644 --- a/.github/workflows/smoke_test.yml +++ b/.github/workflows/smoke_test.yml @@ -4,6 +4,7 @@ on: [push, workflow_dispatch] jobs: build: + continue-on-error: true strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] @@ -20,17 +21,13 @@ jobs: python-version: '3.9' cache: 'pip' - - run: pip install -r requirements.txt + - name: Install dependencies + run: python -m pip install --upgrade pip - name: Install this package run: pip install -e . - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - name: Run the smoke tests run: | - music_box configFile="tests\configs\analytical_config\my_config.json" outputDir="tests\configs\analytical_config" + music_box configFile=tests/configs/analytical_config/my_config.json outputDir=tests/configs/analytical_config diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index d32852a8..00000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -musica==0.6.1.dev0 -pandas -pipx -pytest -twine \ No newline at end of file diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index 1016dc4f..8035e88f 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -68,11 +68,11 @@ def main(): logger.info("myBox = {}".format(myBox)) # create solver and solve, writing output to requested directory - campConfig = os.path.dirname(musicBoxConfigFile) + "\\" + myBox.config_file + campConfig = os.path.join(os.path.dirname(musicBoxConfigFile), myBox.config_file) logger.info("CAMP config = {}".format(campConfig)) myBox.create_solver(campConfig) logger.info("myBox.solver = {}".format(myBox.solver)) - mySolution = myBox.solve(musicBoxOutputDir + "\\my_solution.csv") + mySolution = myBox.solve(os.path.join(musicBoxOutputDir, "mySolution.csv")) logger.info("mySolution = {}".format(mySolution)) logger.info("End time: {}".format(datetime.datetime.now())) From b739bd751fc27d9d1955cb8d703f27f46139a26a Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Fri, 12 Jul 2024 14:51:36 -0600 Subject: [PATCH 17/22] Re-added file that was inadvertently deleted, and updated musica version tp 0.7.0 --- requirements.txt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..f3ddcdcc --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +musica==0.7.0 +pandas +pipx +pytest +twine \ No newline at end of file From 1ca853f9f92ed88c67d174298f2c64c7707ff828 Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Fri, 12 Jul 2024 16:03:01 -0600 Subject: [PATCH 18/22] Removed helper scripts from repository. --- src/acom_music_box/goBuild.bat | 3 --- src/acom_music_box/goMusicBox.bat | 1 - 2 files changed, 4 deletions(-) delete mode 100644 src/acom_music_box/goBuild.bat delete mode 100644 src/acom_music_box/goMusicBox.bat diff --git a/src/acom_music_box/goBuild.bat b/src/acom_music_box/goBuild.bat deleted file mode 100644 index 2d958737..00000000 --- a/src/acom_music_box/goBuild.bat +++ /dev/null @@ -1,3 +0,0 @@ -cd ..\.. -pip install . -cd src\acom_music_box \ No newline at end of file diff --git a/src/acom_music_box/goMusicBox.bat b/src/acom_music_box/goMusicBox.bat deleted file mode 100644 index 84ee4585..00000000 --- a/src/acom_music_box/goMusicBox.bat +++ /dev/null @@ -1 +0,0 @@ -python music_box_main.py configFile="C:\2024\MusicBox\music-box\tests\configs\analytical_config\my_config.json" outputDir="C:\2024\MusicBox\music-box\tests\configs\analytical_config" From 3c4a16d34e9ad90e5ecaae68c2d5ec6215b2dd01 Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Fri, 12 Jul 2024 17:24:32 -0600 Subject: [PATCH 19/22] Removed another batch helper script. --- tests/goTest.bat | 1 - 1 file changed, 1 deletion(-) delete mode 100644 tests/goTest.bat diff --git a/tests/goTest.bat b/tests/goTest.bat deleted file mode 100644 index 55b033e9..00000000 --- a/tests/goTest.bat +++ /dev/null @@ -1 +0,0 @@ -pytest \ No newline at end of file From ff332ca47961e61928699f2347b248edc7e1b369 Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Fri, 12 Jul 2024 18:35:30 -0600 Subject: [PATCH 20/22] Check for configFile parameter. Give error and example if not found. --- src/acom_music_box/music_box_main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index 8035e88f..1c5bd6a7 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -53,7 +53,7 @@ def main(): logger.info("Command line = {}".format(myArgs)) # set up the home configuration file - musicBoxConfigFile = "music-box\\tests\\configs\\analytical_config\\my_config.json" # default + musicBoxConfigFile = None if ("configFile" in myArgs): musicBoxConfigFile = myArgs.get("configFile") @@ -62,6 +62,13 @@ def main(): if ("outputDir" in myArgs): musicBoxOutputDir = myArgs.get("outputDir") + # check for required arguments and provide examples + if (musicBoxConfigFile is None): + errorString = "Error: The configFile parameter is required." + errorString += (" Example: configFile={}" + .format(os.path.join("tests", "configs", "analytical_config", "my_config.json"))) + raise Exception(errorString) + # create and load a MusicBox object myBox = MusicBox() myBox.readConditionsFromJson(musicBoxConfigFile) From 0b3989eaaa081d6d0264ad5bed9c9075b26b9186 Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Fri, 12 Jul 2024 18:44:16 -0600 Subject: [PATCH 21/22] Add key=value required parameter to argparse help. --- src/acom_music_box/music_box_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acom_music_box/music_box_main.py b/src/acom_music_box/music_box_main.py index 1c5bd6a7..3a3c6f08 100644 --- a/src/acom_music_box/music_box_main.py +++ b/src/acom_music_box/music_box_main.py @@ -31,7 +31,7 @@ def getArgsDictionary(argPairs): 'key_value_pairs', nargs='+', # This means one or more arguments are expected action=KeyValueAction, - help='Arguments in key=value format' + help="Arguments in key=value format. Example: configFile=my_config.json" ) argDict = vars(parser.parse_args(argPairs)) # return dictionary From 23740dd00c49b1746fda6fa50cf031929c8dcf0c Mon Sep 17 00:00:00 2001 From: Carl Drews Date: Mon, 15 Jul 2024 14:53:27 -0600 Subject: [PATCH 22/22] Rename smoke test to CI Tests. Deleted test.yml. --- .../{smoke_test.yml => CI_Tests.yml} | 2 +- .github/workflows/test.yml | 36 ------------------- 2 files changed, 1 insertion(+), 37 deletions(-) rename .github/workflows/{smoke_test.yml => CI_Tests.yml} (97%) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/smoke_test.yml b/.github/workflows/CI_Tests.yml similarity index 97% rename from .github/workflows/smoke_test.yml rename to .github/workflows/CI_Tests.yml index 4fcece83..ac1c6fa0 100644 --- a/.github/workflows/smoke_test.yml +++ b/.github/workflows/CI_Tests.yml @@ -1,4 +1,4 @@ -name: smoke +name: CI Tests on: [push, workflow_dispatch] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index c2dfb4f2..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: build - -on: [push, workflow_dispatch] - -jobs: - build: - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - - runs-on: ${{ matrix.os }} - steps: - - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: actions/setup-python@v5 - with: - python-version: '3.9' - cache: 'pip' - - - run: pip install -r requirements.txt - - - name: Install this package - run: pip install -e . - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Run tests - run: | - cd tests - pytest \ No newline at end of file