Closed danielolsen closed 3 years ago
Just wondering where do we use this version file? If it is not read by any of the functions in the wrapper, should we put it in the documentation/readme instead?
Just wondering where do we use this version file? If it is not read by any of the functions in the wrapper, should we put it in the documentation/readme instead?
It is not used by the wrapper, but it is required to run Switch, so we need to get this into the folder of prepared inputs somehow in order to be able to successfully launch a Switch optimization.
Can we get the version from the requirements file? So we only change the version in one place.
Can we get the version from the requirements file? So we only change the version in one place.
Done. The code is more complex (since we use inspect
to determine where the requirements.txt file is and then re
to parse it), but if we ever change the Switch version in the requirements, it will get updated automatically in the generated switch_inputs_version.txt file.
Can we get the version from the requirements file? So we only change the version in one place.
Done. The code is more complex (since we use
inspect
to determine where the requirements.txt file is and thenre
to parse it), but if we ever change the Switch version in the requirements, it will get updated automatically in the generated switch_inputs_version.txt file.
Can't we just do:
import switch_model
switch_model.__version__
?
Can we get the version from the requirements file? So we only change the version in one place.
Done. The code is more complex (since we use
inspect
to determine where the requirements.txt file is and thenre
to parse it), but if we ever change the Switch version in the requirements, it will get updated automatically in the generated switch_inputs_version.txt file.Can't we just do:
import switch_model switch_model.__version__
?
You are right, this is much simpler. We potentially have an issue if the preparation is done in a different python environment than the python environment which will run Switch, but as long as the user installs the requirements based on the requirements.txt or Pipfile, everything should be alright.
Pull Request doc
Purpose
Create the required switch_inputs_version.txt file in the folder containing all other inputs.
What the code is doing
We add the Switch version to const.py, then import this to populate the file.
Testing
Manual testing (file is created and contains expected information).
Time estimate
2 minutes.