Workflow instructions for
teneva
developers.
-
Install python (version 3.8; you may use anaconda package manager);
-
Create a virtual environment:
conda create --name teneva python=3.8 -y
-
Activate the environment:
conda activate teneva
-
Install special dependencies (for developers only):
pip install sphinx twine jupyterlab
You will also need
pip install numba==0.57.1
only for the functionact_one.getter
. -
Switch to the
dev
branch and pull:git checkout dev && git pull origin dev
-
Install
teneva
from the source:python setup.py install
-
Reinstall
teneva
from the source (after updates of the code):clear && pip uninstall teneva -y && python setup.py install
-
Rebuild the docs (after updates of the code):
python doc/build.py
-
Run all the tests:
python test/test.py
-
Optionally delete the virtual environment at the end of the work:
conda activate && conda remove --name teneva --all -y
Note that we carry out the entire development process in the
dev
branch; when we are ready to release, we merge it into the master branch.
-
Choose the most suitable module from
teneva
folder; -
Choose the name for the new function in lowercase;
-
Add the new function in alphabetical order, separating it with two empty lines from neighboring functions;
-
Add the new function import in alphabetical order into
__init__.py
; -
Make documentation (i.e.,
docstring
) for the new function similar to other functions (note that we use the guide from google); -
Prepare a demo for the new function (add it in alphabetical order) in the related jupyter notebook (with the same name as a module name) in the
demo
folder similar to demos for other functions in the jupyter notebook with the same name as a module name;Note that it's important to use a consistent style for all functions, as the code is then automatically exported from the jupyter notebooks to assemble the online documentation.
-
Add function name into the dict in docs
doc/map.py
and rebuild the docs (runpython doc/build.py
), check the result in the web browser (seedoc/_build/html/index.html
); -
[For now, this item can be skipped.] Prepare tests for the new function in the corresponding module inside the
test
folder, and then run all the testspython test/test.py
; -
Make commit like
[NEW](MODULE.FUNCTION) OPTIONAL_COMMENT
(see the next section with details of commit's message style); -
[For now, this item can be skipped.] Add related comment in
changelog.md
(with the tagNEW
) for the upcoming version; -
Use the new function locally until update of the package version.
Note that we carry out the entire development process in the
dev
branch; when we are ready to release, we merge it into the master branch. Before you commit, please check that you are on thedev
branch (git branch -a
).
For the convenience of tracking changes, it is worth following a certain structure in the naming of commits. The following style is proposed:
[KIND](func) OPTIONAL_COMMENT
[KIND1, KIND2](func1, func2, func3) OPTIONAL_COMMENT
For example, [UPG](vis.show) Check that r <= n
(i.e., we added new features for the function show
in the module vis
) or [UPG, STL, DEM](data.accuracy_on_data) Replace "getter" with "get_many"
or even like this: [STL, DEM](matrices, vectors) Minor stylistic changes and comments
.
The following possible values are suggested for the KIND
:
-
GLB
- global changes (remove support ofpython 3.6
, changing the behavior logic of a large group of functions, etc.). The name of the files in parentheses can be omitted in this case. Example:[GLB] Add draft for workflow instructions for teneva developers
-
RNM
- renames of existing modules, functions, etc. Example:[RNM](tensors.tensor_const -> core.tensors.const) Since it is used very often
-
UPG
- upgrade of existing modules, functions, etc. Example:[UPG](vis.show) Check that r <= n
-
NEW
- new modules, functions, etc. Example:[NEW](act_one.get) Compute value of the TT-tensor in provided multi-index
-
DEM
- changes in demo (jupyter notebooks). Note that the assembly of the documentation must also be performed in this case (python doc/build.py
). In the brackets, we indicate the corresponding function or module, but not the modified notebook itself. Example:[DEM](vis.show) Add example for the case r <= n
-
TST
- new tests (or its updates) for modules and functions. Example:[TST](vis.show) Add special tests
-
FIX
- fixes for small bugs. Example:[FIX](vis.show) Add mode size value for output
-
BUG
- fixes for big bugs. Example:[BUG](vis.show) Remove invalid ...
-
STL
- fixes for style (pep, etc.) of functions and modules. Example:[STL](vis.show) More accurate docstring
-
DOC
- updates for content of the docs (it is the text of the documentation, not the descriptions (docstrings) of functions and demonstrations in jupyter notebook)[DOC] Add link to the jax repo
-
DEV
- some code related to the development of new approaches, etc.[DEV](act_one.super_function) Try to integrate the tensor
Note that the same tag names should be used in the
changelog.md
.
-
Check that you are on the
dev
branch asgit branch -a
; -
Select the function
MODULE.FUNCTION
fromteneva
; -
Check or (optionally) update the style of the function's code (in this case run
clear && pip uninstall teneva -y && python setup.py install
); -
Check or (optionally) update the function's demo and rerun the demo jupyter;
-
Update the docs as
clear && python doc/build.py
; -
Write the tests for function in
test/test_MODULE.py
file; -
Run the tests as
clear && python test/test.py
; -
Do commit like
[STL, DEM, TST](MODULE.FUNCTION)
.
Note that we carry out the entire development process in the
dev
branch; when we are ready to release, we merge it into the master branch.
-
Check existing branches:
git branch -a
-
Optionally delete the
dev
branch:git branch --delete dev
-
Create a new
dev
branch:git branch dev
-
Select the
dev
branch as a current:git checkout dev
-
Sometimes merge the
dev
branch with themaster
:git checkout dev && git merge master
-
Push the branch
dev
after commits:git checkout dev && git push origin dev
-
Pull the
master
branch:git checkout master && git pull origin master
-
Pull the
dev
branch:git checkout dev && git pull origin dev
-
Merge the
dev
branch with themaster
(master -> dev
):git checkout dev && git merge master
-
Reinstall teneva locally:
clear && pip uninstall teneva -y && python setup.py install
-
Run all the tests:
clear && python test/test.py
-
Build the docs:
clear && python doc/build.py
-
Add a description of the changes made in the
changelog.md
in the new sectionVersion 0.X.Y (upcoming)
;The command
git log --oneline --decorate
may be helpfull. -
Do commit
[GLB] Ready to the new version
and push:git push origin dev
-
Merge the
master
branch with thedev
(dev -> master
):git checkout master && git merge dev
-
Update the package version (like
0.14.X
) in the fileteneva/__init__.py
; -
Build the docs:
clear && python doc/build.py
-
Remove
upcoming
tag from the new version title in thechangelog.md
; -
Do commit like
[GLB] Update version (0.14.X)
and push:git push origin master
-
Upload the new version to
pypi
(login: AndreiChertkov):rm -r ./dist && python setup.py sdist bdist_wheel && twine upload dist/*
-
Reinstall the package from
pypi
and check that installed version is new:pip uninstall teneva -y && pip install --no-cache-dir --upgrade teneva
-
Check the teneva docs build;
-
Check the teneva docs site.
-
Merge the
dev
branch with themaster
(master -> dev
) and push:git checkout dev && git merge master && git push origin dev