Repository: IMMM-SFA/msd_uncertainty_ebook (language: python)

Issue:
set up a development employment environment
This will work by deploying dev builds into a subfolder of the production deployment, such that deploying to either environment will preserve the state of the other environment. The root dev site will live at uc-ebook.org/dev


Discussion / hints:

Fix patch:
diff --git a/.github/ISSUE_TEMPLATE/contribution_proposal.yml b/.github/ISSUE_TEMPLATE/contribution_proposal.yml
new file mode 100644
index 0000000..dc6691e
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/contribution_proposal.yml
@@ -0,0 +1,73 @@
+name: Contribution Proposal
+description: 
+  Want to contribute to our eBook?  Fill the following proposal form and we will review your contribution idea shortly.
+labels: ["needs triage"]
+
+body:
+  - type: markdown
+    attributes:
+      value: |
+        ## Please fill out the form completly
+        See our `contribution documentation <https://uc-ebook.org/docs/html/contributing.html>`_ for additional information.
+        **NOTE**: We require that all contributions including any code, data, or other content provided with them be fully open source.
+
+  - type: textarea
+    id: issue-name
+    attributes:
+      label: Name
+      description: Please provide your name
+    validations:
+      required: true
+
+  - type: textarea
+    id: issue-email
+    attributes:
+      label: Email
+      description: Please provide your email address
+    validations:
+      required: true
+        
+  - type: textarea
+    id: issue-institution
+    attributes:
+      label: Institution
+      description: Please provide your institution
+    validations:
+      required: true
+
+  - type: textarea
+    id: issue-source
+    attributes:
+      label: Referral 
+      description: How did you hear about the eBook?
+    validations:
+      required: true
+    
+  - type: dropdown
+    id: issue-category
+    attributes:
+      label: Topic Area
+      description: Select the part of the eBook you are hoping to contribute to.
+      options:
+        - General
+        - Sensitivity Analysis
+        - Uncertainty Quantification
+        - Jupyter Notebook
+    validations:
+      required: true
+
+  - type: textarea
+    id: issue-description
+    attributes:
+      label: Description
+      description: Please provide a detailed description of the content you wish to contribute.
+    validations:
+      required: true
+
+  - type: textarea
+    id: reproduction-info
+    attributes:
+      label: Additional Information
+      description: Please provide any additional information you want to share.
+    validations:
+      required: true
\ No newline at end of file
diff --git a/.github/PULL_REQUEST_TEMPLATE/contribution_checklist.md b/.github/PULL_REQUEST_TEMPLATE/contribution_checklist.md
new file mode 100644
index 0000000..16147e7
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE/contribution_checklist.md
@@ -0,0 +1,19 @@
+## Tutorial Contribution
+The following upon submission starts the review process for your draft Jupyter notebook contribution to the eBook.  Please see our [contribution documentation](https://uc-ebook.org/docs/html/contributing.html) for additional guidance.
+
+## Contribution Issue Link
+Please reference the link to your approved contribution issue here: # (issue)
+
+## Checklist
+Please ensure that you are able to check all of the following boxes before submission
+- [ ] My contribution proposal has been approved
+- [ ] I have performed a self-review of my own code
+- [ ] All elements of my contribution are fully open-source and can be distributed with an [Open Source Initiative approved license](https://opensource.org/licenses/) with an understanding that they may be used in community demonstrations and other activities.  Author citations will be present in the notebook for any contributed work to ensure the author(s) receive full credit for their contribution.
+- [ ] Any data or code reused in your submission are correctly cited giving credit to the original authors. 
+- [ ] The notebook provided is written in English and able to be a stand-alone product that needs no further explanation past what is written in the notebook to make use of it.
+- [ ] The provided work is not merely a regurgitation of an existing tutorial or demonstration but represents a novel contribution.
+- [ ] All contributions and communication thereof must abide by our [code of conduct](https://uc-ebook.org/docs/html/code_of_conduct.html).
+
+## Additional information
+
+## Please upload your draft notebook as an attachment to this pull request
diff --git a/.github/workflows/02_deploy.yml b/.github/workflows/02_deploy.yml
index 306be26..c0015fc 100644
--- a/.github/workflows/02_deploy.yml
+++ b/.github/workflows/02_deploy.yml
@@ -76,7 +76,10 @@ jobs:
         run: npm run build
       - name: Commit documentation changes
         run: |
-          cd landing/build
+          git clone --depth=1 --branch=gh-pages https://github.com/IMMM-SFA/msd_uncertainty_ebook.git previous_deploy
+          mkdir ./landing/build/dev
+          cp -r ./previous_deploy/dev/* ./landing/build/dev/
+          cd ./landing/build
           git init
           git add -A
           git config --local user.email "action@github.com"
diff --git a/.github/workflows/03_dev_deploy.yml b/.github/workflows/03_dev_deploy.yml
new file mode 100644
index 0000000..98b283d
--- /dev/null
+++ b/.github/workflows/03_dev_deploy.yml
@@ -0,0 +1,89 @@
+name: Deploy Dev
+
+on:
+  push:
+    branches: [ dev ]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: '3.9'
+      - name: Install latex dependencies
+        run: sudo apt-get update -y && sudo apt-get install -y texlive latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended ghostscript
+      - name: Update pip and install python dependencies
+        working-directory: 'docs/'
+        run: |
+          python -m pip install --upgrade pip
+          pip install -r requirements.txt
+      - name: Build html and pdf ebook
+        working-directory: 'docs/'
+        env:
+          NODE_ENV: development
+        run: |
+          make html latexpdf --keep-going LATEXMKOPTS="-interaction=nonstopmode" || true
+          make latexpdf --keep-going LATEXMKOPTS="-interaction=nonstopmode" || true
+          make latexpdf --keep-going LATEXMKOPTS="-interaction=nonstopmode" || true
+        continue-on-error: true
+      - name: Concatenate eBook cover with eBook
+        run: |
+          mv docs/build/latex/addressinguncertaintyinmultisectordynamicsresearch.pdf docs/build/latex/ebook_content.pdf
+          gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=docs/build/latex/addressinguncertaintyinmultisectordynamicsresearch.pdf -dBATCH docs/ebook_cover.pdf docs/build/latex/ebook_content.pdf
+      - uses: actions/setup-node@v2
+        with:
+          node-version: '16'
+          cache: 'npm'
+          cache-dependency-path: landing/package-lock.json
+      - uses: jakejarvis/s3-sync-action@master
+        with:
+          args: --delete
+        env:
+          SOURCE_DIR: 'notebooks'
+          DEST_DIR: 'notebooks'
+          AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_DEV }}
+          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
+          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
+          AWS_REGION: ${{ secrets.AWS_REGION_DEV }}
+      - name: Log in to Docker Hub
+        uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
+        with:
+          username: ${{ secrets.DOCKER_USERNAME }}
+          password: ${{ secrets.DOCKER_PASSWORD }}
+      - name: Build and push Docker image
+        uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
+        with:
+          context: .
+          file: Dockerfile_dev
+          push: true
+          tags: thurber/uc-ebook.org:dev
+      - name: Install landing page dependencies
+        working-directory: 'landing/'
+        run: npm install
+      - name: Build landing page
+        working-directory: 'landing/'
+        env:
+          NODE_ENV: development
+        run: npm run build
+      - name: Commit documentation changes
+        run: |
+          git clone --depth=1 --branch=gh-pages https://github.com/IMMM-SFA/msd_uncertainty_ebook.git deploy
+          rm -rf ./deploy/.git
+          rm -rf ./deploy/dev
+          mkdir ./deploy/dev
+          cp -r ./landing/build/* ./deploy/dev/
+          cd ./deploy
+          git init
+          git add -A
+          git config --local user.email "action@github.com"
+          git config --local user.name "GitHub Action"
+          git commit -m 'deploy' -a || true
+      - name: Push changes to gh-pages
+        uses: ad-m/github-push-action@master
+        with:
+          branch: gh-pages
+          directory: deploy
+          force: true
+          github_token: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..7db4d3b
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,58 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the overall
+community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or
+advances of any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email
+address, without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+professional setting
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies
+when an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.0,
+available at https://www.contributor-covenant.org/version/2/0/
+code_of_conduct.html.
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see the FAQ at
+https://www.contributor-covenant.org/faq. Translations are available at https://
+www.contributor-covenant.org/translations.
diff --git a/Dockerfile_dev b/Dockerfile_dev
new file mode 100644
index 0000000..70fe836
--- /dev/null
+++ b/Dockerfile_dev
@@ -0,0 +1,13 @@
+FROM jupyter/minimal-notebook:2022-05-03
+
+USER root
+
+RUN git clone --depth=1 --branch=dev https://github.com/IMMM-SFA/msd_uncertainty_ebook.git msd_uncertainty_ebook
+RUN cd msd_uncertainty_ebook && pip install .
+
+# Now create a symlinked data folder inside the msdbook package that links to /home/demo/data folder
+RUN mkdir -p /home/demo/data
+RUN rm -rf /opt/conda/lib/python3.9/site-packages/msdbook/data
+RUN ln -s /home/demo/data /opt/conda/lib/python3.9/site-packages/msdbook/data
+
+
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 0a45ef1..9f3d70d 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1,7 +1,7 @@
-autodoc~=0.5.0
-ipython~=8.0.1
-mathjax~=0.1.2
-nbsphinx~=0.8.6
-sphinx~=4.0.2
-sphinx-book-theme~=0.2.0
-sphinxcontrib-bibtex~=2.4.1
\ No newline at end of file
+autodoc>=0.5.0
+ipython>=8.0.1
+mathjax>=0.1.2
+nbsphinx>=0.8.6
+sphinx>=4.0.2
+sphinx-book-theme>=0.2.0
+sphinxcontrib-bibtex>=2.4.1
\ No newline at end of file
diff --git a/docs/source/code_of_conduct.rst b/docs/source/code_of_conduct.rst
new file mode 100644
index 0000000..56672b8
--- /dev/null
+++ b/docs/source/code_of_conduct.rst
@@ -0,0 +1,58 @@
+Code of Conduct
+===============
+
+Our Pledge
+----------
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+Our Standards
+-------------
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+- Demonstrating empathy and kindness toward other people
+- Being respectful of differing opinions, viewpoints, and experiences
+- Giving and gracefully accepting constructive feedback
+- Accepting responsibility and apologizing to those affected by our mistakes,
+  and learning from the experience
+- Focusing on what is best not just for us as individuals, but for the overall
+  community
+
+Examples of unacceptable behavior include:
+
+- The use of sexualized language or imagery, and sexual attention or
+  advances of any kind
+- Trolling, insulting or derogatory comments, and personal or political attacks
+- Public or private harassment
+- Publishing others' private information, such as a physical or email
+  address, without their explicit permission
+- Other conduct which could reasonably be considered inappropriate in a
+  professional setting
+
+Scope
+-----
+
+This Code of Conduct applies within all community spaces, and also applies
+when an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+Attribution
+-----------
+
+This Code of Conduct is adapted from the Contributor Covenant, version 2.0,
+available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
+
+For answers to common questions about this code of conduct, see the FAQ at
+https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 11f227f..8429aac 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -17,19 +17,23 @@
 sys.path.insert(0, os.path.abspath('../../'))
 sys.path.append(os.path.abspath("../../extensions"))
 
+# if this is a dev build, the paths need to be adjusted
+dev_web = '/dev' if ('NODE_ENV' in os.environ and os.environ['NODE_ENV'] == 'development') else ''
+dev_nb = '.dev' if ('NODE_ENV' in os.environ and os.environ['NODE_ENV'] == 'development') else ''
+
 # current datetime to use as the version
 today = f"Last updated: {datetime.utcnow().strftime('%b %d, %Y')}"
 
 
 # -- Notebook URLs -----------------------------------------------------------
 
-rst_prolog = """
-.. _nb_logistic_regression: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/basin_users_logistic_regression.ipynb
-.. _nb_saltelli_sobol: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/sa_saltelli_sobol_ishigami.ipynb
-.. _nb_hymod: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/hymod.ipynb
-.. _nb_fishery_dynamics: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/fishery_dynamics.ipynb
-.. _nb_discovery: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/Bedford_Greene_SD_tutorial.ipynb
-.. _nb_hmm: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/Hidden-Markov_Modeling_Approaches_to_Creating_Synthetic_Streamflow_Scenarios.ipynb
+rst_prolog = f"""
+.. _nb_logistic_regression: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/basin_users_logistic_regression.ipynb
+.. _nb_saltelli_sobol: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/sa_saltelli_sobol_ishigami.ipynb
+.. _nb_hymod: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/hymod.ipynb
+.. _nb_fishery_dynamics: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/fishery_dynamics.ipynb
+.. _nb_discovery: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/Bedford_Greene_SD_tutorial.ipynb
+.. _nb_hmm: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/Hidden-Markov_Modeling_Approaches_to_Creating_Synthetic_Streamflow_Scenarios.ipynb
 """
 
 
@@ -88,7 +92,7 @@
 
 # theme options
 html_theme_options = {
-    'path_to_docs': '/docs',
+    'path_to_docs': f'{dev_web}/docs',
     'repository_url': 'https://github.com/IMMM-SFA/msd_uncertainty_ebook',
     'use_issues_button': True,
     'use_download_button': True,
diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst
new file mode 100644
index 0000000..c89f0e9
--- /dev/null
+++ b/docs/source/contributing.rst
@@ -0,0 +1,18 @@
+******************
+Contribution Guide
+******************
+
+Our eBook is a living product that we hope continues to grow over time to stay relevant with methodological and technological advancements in the field of uncertainty quantificaiton and MultiSector Dynamics at large.  We extend an invitation to you the reader to contribute to one of our interactive Jupyter notebook tutorials.  If you feel you have a contribution that would be relevant and generalizable to the MSD community, please submit a proposal idea `here <https://github.com/IMMM-SFA/msd_uncertainty_ebook/issues/new?assignees=thurber%2C+crvernon&labels=triage&projects=&template=contribution_proposal.md&title=Contribution+Proposal>`_.  Your proposal will be reviewing by our team and feedback and/or a decision will be provided shortly.  Any contribution accepted will receive it's own DOI and citation so that you may provide an independent reference to your work as you see fit.
+
+Please consider the following requirements for contribution:
+
+- All elements of your contribution MUST be fully open-source and can be distributed with an `Open Source Initiative approved license <https://opensource.org/licenses/>`_ with an understanding that they may be used in community demonstrations and other activities.  Author citations will be present in the notebook for any contributed work to ensure the author(s) receive full credit for their contribution.
+- Any data or code reused in your submission must be correctly cited giving credit to the original authors. 
+- The notebook provided must be written in English and able to be a stand-alone product that needs no further explanation past what is written in the notebook to make use of it.
+- The provided work is not merely a regurgitation of an existing tutorial or demonstration but represents a novel contribution.
+- All contributions and communication thereof must abide by our `code of conduct <https://uc-ebook.org/docs/html/code_of_conduct.html>`_.
+
+
+If you feel your work meets the criteria above, please submit a proposal issue `here <https://github.com/IMMM-SFA/msd_uncertainty_ebook/issues/new?assignees=thurber%2C+crvernon&labels=triage&projects=&template=contribution_proposal.md&title=Contribution+Proposal>`_.  If your proposal is approved, please submit your draft notebook for review as an attachment using our submission `template <https://github.com/IMMM-SFA/msd_uncertainty_ebook/blob/main/.github/PULL_REQUEST_TEMPLATE/contribution_checklist.md>`_.  We will then review your submission and provide feedback.  Once your contribution has been deemed ready to deploy, we will generate a DOI for your work, launch it to our MSD-LIVE set of interactive notebooks, and feature the contribution in the index of our eBook.
+
+Please feel free to reach out with any further questions.
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 26611de..170c127 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -67,6 +67,8 @@ Addressing Uncertainty in MultiSector Dynamics Research
     preface
     citation
     acknowledgements
+    code_of_conduct
+    contributing
 
 .. raw:: latex
 
diff --git a/landing/svelte.config.js b/landing/svelte.config.js
index e937ee9..b3cf6af 100644
--- a/landing/svelte.config.js
+++ b/landing/svelte.config.js
@@ -13,7 +13,7 @@ const config = {
 			assets: 'build'
 		}),
 		paths: {
-			base: ''
+			base: process.env.NODE_ENV === 'development' ? '/dev' : ''
 		}
 	}
 };
diff --git a/setup.py b/setup.py
index 4ff9acd..a0fc80d 100644
--- a/setup.py
+++ b/setup.py
@@ -44,16 +44,16 @@ def get_requirements():
     ],
     extras_require={
         'dev': [
-            'autodoc~=0.5.0',
-            'build~=0.5.1',
-            'ipython~=8.0.1',
-            'mathjax~=0.1.2',
-            'nbsphinx~=0.8.6',
-            'setuptools~=57.0.0',
-            'sphinx~=4.0.2',
-            'sphinx-book-theme~=0.2.0',
-            'sphinxcontrib-bibtex~=2.4.1',
-            'twine~=3.4.1'
+            'autodoc>=0.5.0',
+            'build>=0.5.1',
+            'ipython>=8.0.1',
+            'mathjax>=0.1.2',
+            'nbsphinx>=0.8.6',
+            'setuptools>=57.0.0',
+            'sphinx>=4.0.2',
+            'sphinx-book-theme>=0.2.0',
+            'sphinxcontrib-bibtex>=2.4.1',
+            'twine>=3.4.1'
         ]
     }
 )
\ No newline at end of file


Test patch:
diff --git a/.github/workflows/01_test.yml b/.github/workflows/01_test.yml
index 8ad03d6..294ebbf 100644
--- a/.github/workflows/01_test.yml
+++ b/.github/workflows/01_test.yml
@@ -2,7 +2,7 @@ name: Build
 
 on:
   push:
-    branches: [ main ]
+    branches: [ main, dev ]
 
 jobs:
   build: