Dev: Component Layout¶
To start implementing a new component, we can use the provided cookiecutter.
There’s a directory in the project root, ${PYESM}/dev_tools. It
contains a few tools to help get set up. Assuming you are currently in the
project root, you can start like this:
$ ./dev_tools/component_cookiecutter \
${COMP_NAME} \
${COMP_VERSION} \
${COMP_TYPE}
For our example, we will do the following:
$ ./dev_tools/component_cookiecutter random_clouds 0.1 Generic
The file tree you have just created should look like this:
random_clouds
├── .git
├── __init__.py
├── random_clouds_0.1_cleanup_default_files.json
├── random_clouds_0.1_prepare_default_files.json
├── random_clouds_0.1_prepare_modify_files.json
└── random_clouds_simulation.py
Examining the output of this command, you can see that:
- A new
gitrepository has been initialized for you,random_clouds. You should add a remote to this, and add it as agit submoduleto the mainPYESMproject:
# Set up a remote and address somewhere, e.g. GitHub, GitLab, ...
$ cd random_clouds
$ git remote add ${REMOTE_NAME:-origin} ${ADDRESS:-ERR}
$ cd ..
$ git submodule add ${ADDRESS} random_clouds
- We have files for
__init__pyandrandom_clouds_simulation.py - Filetables have been generated with example entries. These will absolutely not work, since they point to paths that are not on your computer.
Note
Certain other files probably need to be added at some point, specifically those that implement classes dealing with archiving, analysis, and visualization. These are still to come…
Next, we will look at the classes implemented in __init__.py and random_clouds_simulation.py.
Previous: Dev: Introduction
Next: Dev: Basic Classes