项目作者: lvoegtlin

项目描述 :
CLI Tool to init new reproducible project with the help of conda and github
高级语言: Python
项目地址: git://github.com/lvoegtlin/cobra.git
创建时间: 2019-08-23T09:50:30Z
项目社区:https://github.com/lvoegtlin/cobra

开源协议:MIT License

下载


Cobra

PyPI version

Cobra is a project creation and management tool for python and git.
It creates a conda environment and a github repository based on your requirements.

Requirements

You can use the base conda to install cobra.

conda config --set auto_activate_base true

Installation

You have three different options to install cobra. Just always keep in mind that the python version need to be > 3.5.

pip

If your pip path is pointing to the pip3 you can also you just pip.

  1. pip3 install cobra-projects

Then execute the command

  1. cobra --install

and follow the instructions.

github

  1. Download the sourcecode from github.
  2. Move into the cobra root directory (folder which contains the setup.py file) cd cobra
  3. Install it pip install .

Then execute the command

  1. cobra --install

and follow the instructions.

Uninstallation

If you have to re-install or uninstall cobra:

  1. Delete the access token from your github page (Settings -> Developer settings -> Personal access tokens -> delete (cobra)
  2. rm -rf ~/.cobra
  3. pip3/pip uninstall cobra-projects

Usage

  1. usage: cobra [-h] [--install] [--test] [--clear] {create,list,remove} ...
  2. Project creation (cobra) command line tool
  3. positional arguments:
  4. {create,list,remove} The different functions of cobra
  5. create Create a new cobra project
  6. list Lists all existing cobra projects
  7. remove Remove a cobra project
  8. optional arguments:
  9. -h, --help show this help message and exit
  10. --install Start the installation wizard.
  11. --test Puts cobra into testing mode
  12. --clear Clears all user files

Create

To create a new project you can use the create command.
The minimum requirements is the -n parameter to give the project a name.
You can also lik the project with already existing conda environments or github repos.

CARE:
The -gh, --git-hook command is in beta. This command exports before each git commit the conda environment.

  1. usage: cobra create [-h] -n PROJECT_NAME [-p PYTHON_VERSION] [-r REPO_NAME]
  2. [-c CONDA_NAME] [-gh]
  3. optional arguments:
  4. -h, --help show this help message and exit
  5. -n PROJECT_NAME, --project-name PROJECT_NAME
  6. Name of the project
  7. -p PYTHON_VERSION, --python-version PYTHON_VERSION
  8. Python version for the project. Default: 3.5
  9. -r REPO_NAME, --repo-name REPO_NAME
  10. If you already have a github repo for the project.
  11. Enter the repo name.
  12. -c CONDA_NAME, --conda-name CONDA_NAME
  13. If you already have a conda environment for the
  14. project. Enter the name.
  15. -gh, --git-hook Install a pre-commit git hook which updates the conda
  16. environment file before you commit. This is just
  17. working, if the current environment is the
  18. environment of the project!

List

This command lists all the cobra project with some additional information.

  1. usage: cobra list [-h]
  2. optional arguments:
  3. -h, --help show this help message and exit

Remove

After some time you want to remove a project from your system.
This you can do with the remove command.
The remove command with out additional options will just delete the cobra project from the system but not the files, environment or the repository.
If you want to remove the the files, environment or repository use the below shown parameters.

  1. usage: cobra remove [-h] -n NAME [-r] [-c] [-f] [-a]
  2. optional arguments:
  3. -h, --help show this help message and exit
  4. -n NAME, --name NAME Name of the cobra project to remove
  5. -r, --repo Also removes the remote repository
  6. -c, --conda Also removes the conda environment from the system
  7. -f, --folder Also removes the local folder
  8. -a, --remove-all Remove everything (repo, folder, conda)

Testing

To do testing you have to create the conda environment test_environment.yml and activate it:

  1. conda env create -f test_environment.yml
  2. conda activate cobra_dev

Then you can test the whole program including test coverage (htmlcov/index.html) with:

  1. tox

Cite us

  1. @inproceedings{voegtlin2020cobra,
  2. address = {Online},
  3. author = {Voegtlin, Lars and Pondenkandath, Vinaychandran and Ingold, Rolf},
  4. title = {{Cobra: A CLI Tool To Create And Share Reproducible Projects}},
  5. booktitle = {2020 7th Swiss Conference on Data Science (SDS)},
  6. year = {2020},
  7. month = {jun},
  8. }

TODO

  • Create repo with template
  • Create conda Dockerfile
  • Automatically build docker container and push it to dockerhub