# verify conda is up-to-date
(base) $ conda update -n base -c defaults conda
# test: create and delete an example environment called sibltest
(base) $ conda env list # verify sibltest is absent
(base) $ conda create --name sibltest python=3.7 scipy matplotlib
(base) $ conda env list # verify sibtest is present
#
(base) $ conda env remove --name sibltest
(base) $ conda env list # verify sibltest is absent
# create the actual environment siblenv
(base) $ conda create --name siblenv python=3.8 black dash flake8 matplotlib notebook pytest pytest-cov seaborn scikit-image scipy
(base) $ conda activate siblenv
(siblenv) $ cd ~/sibl/cli/; pip install -e . # for xyfigure
(siblenv) $ cd ~/sibl/geo/; pip install -e . # for xyfigure PTG extension
Based on sharing an environment documentation, to make a configuration file that is cross-platorm, use
(siblenv) $ conda env export --from-history > environment.yml
The environment.yml
file will contain the following
name: siblenv
channels:
- defaults
dependencies:
- python=3.8
- black
- dash
- flake8
- matplotlib
- notebook
- pytest
- pytest-cov
- seaborn
- scikit-image
- scipy
Conda is preferred to Pip for installation of most packages.
Clients should create their conda virtual environment from the above server-generated environment.yml file using the following commands
(base) $ conda env create -f environment.yml
(base) $ conda env list # verify the environment was installed
(base) $ conda activate siblenv
(siblenv) $
The xyfigure
package is on the PyPI index but not on the conda index.
xyfigure
either from PyPI or the wheel file.ptg
from the wheel file.Install from a terminal via PyPI:
(siblenv) $ pip install xyfigure
Install from a wheel file.
The file can be obtained from Chad directly, or
from here. Then
(siblenv) $ pip install --user xyfigure-0.0.n-py3-non-any.whl # where 0.0.n is the version number
Verify installation: check that xyfigure
is contained in the list generated by
(siblenv) $ pip list
Update current install to the latest version:
(siblenv) $ pip install xyfigure --upgrade
To install a specific version, e.g., version 0.0.5
:
(siblenv) $ pip install --user xyfigure==0.0.5
Git-flow is a wrapper around Git. The git flow init
command is an extension of the
default git init command and doesn’t change anything in the repository other than
creating branches for you.
> git flow init # and accept all defaults as shown below
⋊> ~/sibl on master ◦ git flow init (siblenv) Fri Jul 23 16:33:18 2021
Which branch should be used for bringing forth production releases?
- master
Branch name for production releases: [master]
Branch name for "next release" development: [develop]
How to name your supporting branch prefixes?
Feature branches? [feature/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
⋊> ~/sibl on develop
Augment the default master
branch (main
is now often used instead of master
) with
a develop
branch. A simple way to do this is for one developer to create an empty
develop
branch locally and push it to the server:
⋊> ~/sibl on develop
⨯> git push -u origin develop (siblenv) Fri Jul 23 16:34:32 2021
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for 'develop' on GitHub by visiting:
remote: https://github.com/sandialabs/sibl/pull/new/develop
remote:
To github.com:sandialabs/sibl.git
* [new branch] develop -> develop
Branch 'develop' set up to track remote branch 'develop' from 'origin'.
⋊> ~/sibl on develop ⨯
Other developers should now clone the central repository and create a tracking
branch for the develop
branch:
$ git flow init
Initialized empty Git repository in ~/project/.git/
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master]
Branch name for "next release" development: [develop]
How to name your supporting branch prefixes?
Feature branches? [feature/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
$ git branch # show available branches
* develop
master
Now create a feature branch:
> git flow feature start feature_branch
# Example:
> git flow feature start io_refactor
To push the current branch and set the remote as upstream, use
> git push --set-upstream origin feature/feature_branch
# Example:
> git push --set-upstream origin feature/io_refactor
The proceed with local implementation, and git commit -m 'message'
and git push
to push
local implementation up to the repo on the feature_branch
.
When the feature implementation is completed:
feature_branch
into the develop
branch:> git flow feature finish feature_branch
# Example
> git flow feature finish io_refactor
The command line will switch back to the develop
branch, list changes, and finally:
Summary of actions:
- The feature branch 'feature/io_refactor' was merged into 'develop'
- Feature branch 'feature/io_refactor' has been removed
- You are now on branch 'develop'
> git checkout master
> git merge develop
# ----
# sync
# ----
$ (base) [~]$ cd ~/sibl
$ (base) [~/sibl] git status
$ (base) [~/sibl] git pull
$ (base) [~/sibl] git add, git commit -m "message", git push
#
# ---------
# implement
# ---------
$ (base) [~/sibl]$ conda activate siblenv
$ (siblenv) [~/sibl]$ # development
#
# ------
# pytest
# ------
# check unit tests
$ (siblenv) [~/sibl]$ pytest # unit tests must pass prior to push to repository
$ (siblenv) [~/sibl]$ pytest -v # for more verbose unittest output
#
# ---------
# blacktest
# ---------
$ (siblenv) [~/sibl] black --check .
#
# or to check specific folders one at a time
$ (siblenv) [~/sibl] black --check cli/
$ (siblenv) [~/sibl] black --check geo/
#
# if above check failse, the diff or fix
# diff: (without automatic code modification)
$ (siblenv) [~/sibl] black --check some_specific_file.py --diff
$ (siblenv) [~/sibl] black --check some_folder/ --diff
# fix: (with automatic code modification)
$ (siblenv) [~/sibl] black some_specific_file.py
$ (siblenv) [~/sibl] black some_folder/
$ (siblenv) [~/sibl]
#
# ---------
# covertest
# ---------
$ (siblenv) [~/sibl]$ pytest --cov=.
#
# or to test specific folders
$ (siblenv) [~/sibl]$ pytest --cov=cli/src/xyfigure --cov=geo/src/ptg
#
# and to add missing coverage line number reporting
$ (siblenv) [~/sibl]$ pytest --cov=cli/src/xyfigure --cov=geo/src/ptg --cov-report term-missing