You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+37-75Lines changed: 37 additions & 75 deletions
Original file line number
Diff line number
Diff line change
@@ -3,110 +3,72 @@ Information for developers
3
3
4
4
Create python environment dfm_tools_env and install dfm_tools in developer mode:
5
5
6
-
- download and install Anaconda 64 bit Python 3.7 (or higher) from https://www.anaconda.com/distribution/#download-section (miniconda should also be sufficient, but this is not yet tested). Install it with the recommended settings, but check 'add Anaconda3 to my PATH environment variable' if you want to use conda from the windows command prompt instead of anaconda prompt
6
+
- download and install Anaconda 64 bit Python 3.8 (or higher) from https://www.anaconda.com/distribution/#download-section (miniconda should also be sufficient, but this is not yet tested). Install it with the recommended settings.
7
7
- download git from https://git-scm.com/download/win, install with default settings
8
-
- create a branch called work_yourname on https://github.com/Deltares/dfm_tools
9
8
- open git bash window where you want to clone the dfm_tools github repository (e.g. C:\\DATA\\)
9
+
- git clone https://github.com/deltares/dfm_tools (creates a folder dfm_tools with the checked out repository)
-``git clone -b work_yourname https://github.com/Deltares/dfm_tools dfm_tools`` (repo gets cloned in C:\\DATA\\dfm_tools, this is a checkout of the work_yourname branch)
14
-
- update your branch if main has been updated: add+commit+push everything in branch first, ``git checkout main``, ``git pull``, ``git checkout development``, ``git merge main -m ''``, ``git push``
15
13
- open anaconda prompt and navigate to dfm_tools local folder, e.g. ``C:\\DATA\\dfm_tools``
16
-
-``conda env create -f environment.yml`` (creates an environment called dfm_tools_env) TODO: yml now contains almost the same as requirements.txt, with additionally pdoc3/pytest/bump2version. Update this manual according to this
17
-
-``conda info --envs`` (should show dfm_tools_env virtual environment in the list)
14
+
-``conda env create -f environment.yml`` (creates an environment called dfm_tools_env) TODO: yml now contains almost the same as requirements.txt. Update this manual according to this
- optional: ``conda install spyder -c conda-forge`` (installs spyder, using conda-forge channel since it was also used in environment.yml)
17
+
-``python -m pip install -r requirements_dev.txt`` (installs pytest and other developer dependencies)
20
18
-``python -m pip install -e .`` (pip developer mode, any updates to the local folder are immediately available in your python. It also installs all required non-conda packages) >> maybe add ``test`` to install also test requirements [like this](https://stackoverflow.com/questions/15422527/best-practices-how-do-you-list-required-dependencies-in-your-setup-py)
21
-
- test if dfm_tools is properly installed by printing the version number: ``python -c "import dfm_tools; print(dfm_tools.__version__); import netCDF4"``
22
19
-``conda deactivate``
23
20
- to remove dfm_tools_env when necessary: ``conda remove -n dfm_tools_env --all``
24
-
- open 'Spyder(dfm_tools_env)' via your windows start menu (not 'Spyder' or 'Spyder(Anaconda3)', since dfm_tools was installed in dfm_tools_env)
25
-
- Make your local changes to dfm_tools scripts
26
-
27
-
Work with your branch:
28
21
22
+
Contributing:
23
+
- do not commit/push changes to the main branch
24
+
- open an existing issue or create a new issue at https://github.com/Deltares/dfm_tools/issues
25
+
- create a branch via ``Development`` on the right. This branch is now linked to the issue and the issue will be closed when the branch is merged with main agian
29
26
- open git bash window in local dfm_tools folder (e.g. C:\\DATA\\dfm_tools)
30
-
-``git checkout work_yourname`` (checkout your branch, never do anything while the master is selected)
31
-
- to update: ``git pull`` (combination of git fetch and git merge)
32
-
- get clean checkout again (overwrite local changes):
33
-
- ``git fetch --all`` (fetches changes)
34
-
- ``git reset --hard`` (resets local checkout of repos branch to server version)
35
-
- ``git pull`` (fetches and merges changes, local checkout of repos branch is now updated again)
36
-
-``git pull origin master`` (gets edits from master to current local branch, might induce conflicts. maybe better to just push to your branch and then handle pull request on github website)
27
+
- optional: ``git remote update origin --prune`` (update local branch list, git provides the correct command upon branch creation)
28
+
-``git checkout [branchname]``
29
+
- make your local changes to the dfm_tools code (also create unittests), after each subtask do ``git commit -am 'description of what you did'`` (``-am`` adds all changed files to the commit)
30
+
- you can run the testbank locally, but github can also do it for you after you ``push``
31
+
- check if all edits were committed with ``git status``, if there are new files created also do ``git add [path-to-file]``
32
+
-``git push`` (this pushes it to your branch on github)
33
+
- open a pull request at the branch on github, there you can see what you just pushed and the results of the automated tests will show.
34
+
- optionally do another iteration of add+commits+push (and maybe bumpversion)
35
+
- merge the branch if you are done with the sissue and the automated tests are successful.
37
36
38
37
Running the testbank:
39
38
40
39
- open anaconda prompt in local dfm_tools folder (e.g. C:\\DATA\\dfm_tools)
41
40
-``conda activate dfm_tools_env``
42
41
-``pytest`` (runs all tests)
43
-
-``pytest -m unittest``
44
-
-``pytest -m systemtest``
45
42
-``pytest -m "not acceptance"``
46
-
-``pytest -m acceptance``(runs the acceptance tests, which are the scripts in [the examples folder](https://github.com/Deltares/dfm_tools/tree/main/tests/examples))
- the following arguments are automatically provided via pytest.ini: ``-v --tb=short``, add ``--cov=dfm_tools`` for a coverage summary
43
+
-``pytest -m acceptance`` (runs the acceptance tests, which are the scripts in [the examples folder](https://github.com/Deltares/dfm_tools/tree/main/tests/examples)) and [the examples_workinprogress folder](https://github.com/Deltares/dfm_tools/tree/main/tests/examples_workinprogress))
44
+
-``pytest -m "not requireslocaldata"`` (this is what github does)
50
45
51
-
Regenerate html documentation:
46
+
Generate documentation (automatically runs via Github Actions upon push to main):
52
47
53
48
- open anaconda prompt in local dfm_tools folder (e.g. C:\\DATA\\dfm_tools)
54
49
-``conda activate dfm_tools_env``
55
-
-``pdoc --html dfm_tools -o docs --force``
56
-
57
-
Commit and push your changes to your branch:
58
-
59
-
- open git bash window in local dfm_tools folder (e.g. C:\\DATA\\dfm_tools)
60
-
-``git checkout work_yourname`` (checkout your branch, never do anything while the master is selected)
61
-
-``git add .``
62
-
-``git commit -m "message to be included with your commit"``
63
-
-``git push`` (pushes changes to server, do not do this in while working in the master)
- open anaconda prompt in local dfm_tools folder (e.g. C:\\DATA\\dfm_tools)
69
-
-optional?: ``conda activate dfm_tools_env``
56
+
-``conda activate dfm_tools_env``
70
57
-``bumpversion major`` or ``bumpversion minor`` or ``bumpversion patch`` (changes version numbers in files and commits changes)
71
-
- push this change in version number with ``git push`` (from git bash window or cmd also ok?)
72
-
- request merging of your branch on https://github.com/Deltares/dfm_tools/branches
73
-
74
-
More info (was in readme previously):
75
-
76
-
- what are all these packages for?:
77
-
- shapely for slicing 2D/3D data (conda-forge channel is necessary since main channel version is 1.6.4, minimal requirement is 1.7.0)
78
-
- cartopy for satellite imagery, coastlines etc on plots (conda-forge channel recommended by cartopy developers, and currently also necessary for correct shapely version)
79
-
- pyepsg is necessary for cartopy and probably also for other libraries
80
-
- geopandas for shapefile related operations
81
-
- contextily for satellite imagery on plots, seems faster than cartopy
82
-
- xarray developers advise to install dependecies dask/netCDF4/bottleneck with conda-forge also: https://docs.xarray.dev/en/v0.8.0/installing.html
83
-
- xugrid: wrapper around xarray by Huite Bootsma, for ugrid support
84
-
- cdsapi/pydap: to download ERA5 and CMEMS data. Minimal pydap version is 3.3.0 (only available via conda-forge on 10-11-2022)
85
-
- launch Spyder:
86
-
- open 'Spyder(dfm_tools_env)' via your windows start menu (not 'Spyder' or 'Spyder(Anaconda3)', since dfm_tools was installed in the dfm_tools_env environment only)
87
-
- copy the code from [Example usage](#example-usage) to your own scripts to get started
88
-
- Qt error upon launching Spyder?: remove the system/user environment variable 'qt_plugin_path' set by an old Delft3D4 installation procedure.
89
-
- netCDF4 DLL error upon import in Spyder?: remove Anaconda paths from the Path user environment variable (https://github.com/spyder-ide/spyder/issues/19220)
All works, except for dfm_tools, somehow not installed even tough it is installed
73
+
- Qt error upon launching Spyder?: remove the system/user environment variable 'qt_plugin_path' set by an old Delft3D4 installation procedure.
74
+
- netCDF4 DLL error upon import in Spyder?: remove Anaconda paths from the Path user environment variable (https://github.com/spyder-ide/spyder/issues/19220)
0 commit comments