Project

General

Profile

Change in snowtools code structure

Added by Léo Viallon Galinier almost 3 years ago

Dear snowtools users,

Please note a major change in the code architecture on master branch of snowtools repository these last days:

The main snowtools code is now in a snowtools folder (in which you will find all modules you are used to import). To import a snowtools module, from snowtools itself, from an other package or from your personal code, it is now compulsory to use absolute imports. e.g. :

from snowtools.utils.prosimu import prosimu

This have been done for three main reasons:

  • It is the recommended import form in accordance with PEP8
  • The code organization is now coherent with the way it is expected by vortex (python library that use snowtools to run experiment on Meteo-France supercomputers)
  • The git repository will now contain at its root some useful files to describe the package (requirements, install instructions, README, etc.) and be in a near future directly installable with `pip` for users that are simple users (not for developers).

Impacts for you, after upgrading to the latest version:

  • You have to adapt imports in your personal codes relying on snowtools imports
  • Alias to s2m and proreader that may be defined in your ~/.bashrc or .bash_profile-like file have to point to the new location of files (note that SNOWTOOLS_CEN remains unchanged):
    alias s2m="python $SNOWTOOLS_CEN/snowtools/tasks/s2m_command.py" 
    alias proreader="python3 $SNOWTOOLS_CEN/snowtools/plots/GUI_Proreader.py"

Note that the python path does not have to be updated! If you think you need to modify your `PYTHONPATH`, please check you really have absolute imports everywhere (`from snowtools.[...] import`).

To update the code:

  • Go into the folder containing the git repository snowtools_git
  • Please check you do not have any uncommited file (with `git status` for instance).
  • Pull the latest version of the code with
    git pull
  • As git does not remove by itself folders that are no longer use, you have to delete them by hand or by doing
    git clean --force -x -d
    (check before with `git clean -n -x -d` that you do not have any personal uncommited or untracked file that would be deleted)

Despite the attention paid to required changes in code and several tests, it may remains some inconsistencies and bug linked to this change. Do not hesitate to open an issue on https://redmine.umr-cnrm.fr/projects/snowtools_git/issues.

Please also note the next major change in your timetables: python2 will not be supported in snowtools after the end of this year (2021). Please check in advance that your experiments and code run well on python3 and do not hesitate to open an issue if you encounter any problem, as snowtools is now considered to be fully working with python3.


Comments