Skip to content

Instantly share code, notes, and snippets.

@sammlapp
Last active December 15, 2020 22:21
Show Gist options
  • Save sammlapp/6ad8b091febe71afb84a41e0ad959d78 to your computer and use it in GitHub Desktop.
Save sammlapp/6ad8b091febe71afb84a41e0ad959d78 to your computer and use it in GitHub Desktop.
Notes on git workflow for opensoundscape

Cloning a repository and setting up virtualenv

things formatted like this are terminal commands

0. If you don't have virtualenv and poetry, install them:

Check if you have poetry:

which poetry

If nothing is printed, you don't have it.

#install poetry:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python

Check if you have virtualenv:

which virtualenv

If nothing is printed, you don't have it.

#install virtualenv
pip install virtualenv
pip install virtualenvwrapper

You'll need to log out and log back in (or add these to your path) to use virtualenv.

Virtualenv setup also requires some extra work. First, find out where the virtualenvwrapper.sh file is:

which virtualenvwrapper.sh

You'll use that path below, so copy it.

Add these lines at the bottom of the file ~/.bashrc (you can create the file if it doesn't exist yet).

#using virtualenvwrapper workon command
export WORKON_HOME=~/Library/Caches/pypoetry/virtualenvs
source /INSERT/PATH/TO/virtualenvwrapper.sh

Then, to put these changes into effect immediately (instead of next time you log in) run

source ~/.bashrc

1. clone repository from github.com

git clone [copy url from website]

This will copy the contents of the repository from the web to whatever directory you are currently in.

2. Navigate to the package directory, and switch branches:

cd opensoundscape

git checkout develop

3. Use Poetry to set up the package's environment and install all dependencies:

poetry install

(this will take a while as it sets up the environment with all packages)

4. get name of virtual environment created by Poetry:

lsvirtualenv -b

Copy the name of the poetry environment, which is the one with a bunch of random characters. This is the name of the environment that accompanies the package development.

5. Install the pre-commit hook settings

first activate the environment (it has a pre-commit package installed):

workon [poetry environment name]

then run this command to set up pre-commit black hooks

pre-commit install

If necessary, you can use the -f flag to clear any customized hooks you may have added

6. Add Jupyterlab integration for the environment:

poetry add ipykernel

workon [name of poetry environment]
python -m ipykernel install --user --name=[name of poetry environment]

Creating a feature branch

git checkout -b feature_branch_name

Saving changes from a feature branch to remote

git push -u origin feature_branch_name

Merging a feature branch into development branch

Use the github web-ui to create a Merge Request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment