When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
If you just want to make minor edits to the text in the documentation, you don't need to go to the trouble of setting up your environment. You can just edit the files in the docs/ folder and commit+push your changes.
You will just need to have Quarto installed. To install Quarto, follow the instructions on the Quarto website. Ideally, use VSCode with the Quarto extension for a better experience.
After cloning the repository, cd to docs/ and run quarto preview . --render all --no-browser to render the documentation locally.
💡 If you want to change something in the structure of the documentation (say, the location of a menu or how the pages are laid out) take a look at the YAML file docs/_quarto.yml.
If you want to propose changes to the documentation if you were tasked to do something, you should follow the steps below:
- Set up your environment by following the instructions in the Dev Setup section.
- Create a new branch from
developand give it a meaningful name. Best practices involve using the following format:<your-username>/<issue-number>-<short-description>. For example, if you are working on issue #3, you could name your branchjonjoncardoso/3-fix-numpy-bug.- Remember the GitFlow workflow!
- Make your changes and commit them to your branch. Remember to commit often and to write meaningful commit messages. If you are working on a specific issue, you can use the following format:
#<issue-number> <commit-message>. For example, if you are working on issue #3, you could write#3 Fix numpy bug. - When you are done, push all your commits and then open a pull request to merge your branch into
develop. You can do this by clicking on the "Compare & pull request" button on GitHub. Make sure to add a meaningful title and description to your pull request. If you are working on a specific issue, you can use the following format:#<issue-number> <pull-request-title>. For example, if you are working on issue #3, you could write#3 Fix Numpy Bug.
This repository has the following main branches:
main: This is the "production" branch. It contains the latest version of the website. This branch is protected and only administrators can push to it. Whatever is in here, will be rendered and published on the website.develop: This is the "development" branch. It contains the latest version of the website under development.- This branch is not protected and anyone with access to this repository can push to it.
- This is the branch you should be referring to when you want to make changes to the website. We might have updates to the website that are not yet ready to be published. In that case, we will push to
developand then an administrator will merge tomainwhen we are ready to publish.
gh-pages: This is the branch that contains the rendered version of the website. This branch is automatically updated by the GitHub workflow. Do not push to this branch.
However, you should not be working directly on develop. Instead, you should create a new branch from develop and work on that branch. When you are done, you should open a pull request to merge your branch into develop. This way, we can review your changes before merging them into develop. This is a good practice, often called GitFlow that will help us avoid mistakes and also make it easier to revert changes if needed.
💡 Not familiar with Git branches? Check out this tutorial, or this one, and keep a bookmark for this cheat sheet, or, perhaps the Pro Git book.
Read on if you want a fuller setup to work on the documentation. This will allow you to run the documentation locally and also to make changes to the website structure.
- Clone this repository to your computer.
- Open a terminal and navigate to the root of this repository.
- Although we recommend you have R version 4.2.2 or higher, this should work with R>=3.6.0. You can check your R version by running
R --versionin your terminal. - Open the R console in this same directory and install
renvpackage:
install.packages("renv")- Run
renv::restore()to install all the packages needed for this project. (No need to install packages manually.) - Run
renv::activate()to activate the project environment. (No need to run this every time you open the project, just once is enough.)
- Install Quarto on your computer.
- On the terminal, run the following command to start the website locally:
This will read the instructions from
quarto preview docs/ --render all --no-browser
_quarto.ymland render the website locally. - Open your browser and navigate to
http://localhost:<port>/. That's it!
-
Install Python 3.8 or higher on your computer.
-
Create a new conda environment:
conda create -y -n=venv-vimure python=3.10.8
-
Activate the environment and make sure you have
pipinstalled inside that environment:conda activate venv-vimure
Note: the activate command might vary depending on your OS.
💡 Remember to activate this particular conda environment whenever you reopen VSCode/the terminal.
-
Install required libraries
pip install -r src/python/requirements_dev.txt
-
Install the
vimurepackage in editable mode:pip install -e src/python/
Now, whenever you open a Jupyter Notebook, you should see the venv-vimure kernel available.
-
Create a new branch from
developand name itfeature/<feature_name>. For example, if you are adding a new function to thevimurepackage, you could name your branchfeature/add_new_function. -
Make your changes to the Python package.
-
Run the tests to make sure everything is working as expected. See the next section for more details.
-
Open a pull request to merge your branch into
develop. This will allow us to review your changes before merging them intodevelop.
-
Ensure you have conda's
venv-vimureenvironment activated. -
Run the following command:
python -m pytest -s -vv --pyargs src/python/vimure
-
If not all tests pass, you can run a specific test by running the following command:
python -m pytest -s -vv --pyargs src/python/vimure -k <test_name>
where
<test_name>is the name of the test you want to run.For example:
python -m pytest -s -vv --pyargs src/python/vimure -k test_mapping_ego_and_alter`
⚒️ (Advanced) Jon's full setup
I, @jonjoncardoso, like to use R on VSCode (WSL Ubuntu) instead of RStudio. It is a weird setup if you come from R, but it's a good setup for when you need to switch between R and Python all the time (the reality of this project). Feel free to just ignore this stuff but if you want to replicate my setup, just follow the steps below:
- Install VSCode
- Install WSL on Windows (or on your Mac)
- Install the WSL extension on VSCode (if you are on Windows)
- Open VSCode and open a new WSL window (Type
Ctrl+Shift+Pand typeWSL: New Window). If on Mac, just open a new window. - Open the terminal on VSCode and install R
When doing R
- Install the R extension on VSCode
- Install Quarto
- Install the Quarto extension on VSCode
- When running R notebooks (either
.Rmdor.qmd) manually, you will see that some plots do not render with the adequate size. To fix this, follow these instructions.
When doing Python
- Install the Python extension on VSCode
- Install the Jupyter extension on VSCode
I also use the following VSCode Extensions: