Skip to content

[update] Docs #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e15b434
added container_setup doc files
StarTrooper08 May 28, 2024
f2900c9
updated mkdocs.yml for container setup section
StarTrooper08 May 28, 2024
4cb5db6
moved these files to container setup docs dir
StarTrooper08 May 28, 2024
5e0c311
updated tutorial: running r docs
StarTrooper08 May 28, 2024
d2a4832
updated tutorial: building r from source code
StarTrooper08 May 28, 2024
2143a34
changed docs title: r devel env to r devel container
StarTrooper08 May 28, 2024
045a9c5
docs update: local setup (hypothesis)
StarTrooper08 May 29, 2024
0f277ad
local setup example image added
StarTrooper08 May 30, 2024
fbeb22d
update: simplified patch file docs
StarTrooper08 May 31, 2024
00a7b45
docs: update in codespacestartandstop file
StarTrooper08 Jun 2, 2024
5f6f55b
docs: updated running R file
StarTrooper08 Jun 4, 2024
feb63ab
docs: updating source file
StarTrooper08 Jun 4, 2024
99c1b68
building R and contribution workflow
StarTrooper08 Jun 7, 2024
f404592
docs: contribution workflow
StarTrooper08 Jun 7, 2024
4e3c78f
docs: build R
StarTrooper08 Jun 7, 2024
ea88a90
docs: update source code
StarTrooper08 Jun 7, 2024
07b93c4
docs: review followup
StarTrooper08 Jun 10, 2024
1050133
docs: r-dev-container to r-dev-env (typo)
StarTrooper08 Jun 10, 2024
558acbe
docs: creating codespace and contribution workflow docs update
StarTrooper08 Jun 10, 2024
11cd774
docs: resources docs
StarTrooper08 Jun 10, 2024
49b848c
docs: building r docs for recommended r packages
StarTrooper08 Jun 14, 2024
68e2041
docs: contribution workflow docs update
StarTrooper08 Jun 14, 2024
052832c
docs: follow up on review for creating codespaces
StarTrooper08 Jun 14, 2024
59e28b9
docs: follow up on review for running r
StarTrooper08 Jun 14, 2024
14088ad
docs: updated localsetup docs
StarTrooper08 Jun 14, 2024
57bf4c9
docs: updated contribution workflow with latest example images
StarTrooper08 Jun 14, 2024
4bab672
edits resolving comments from previous reviews
hturner Jun 18, 2024
0dfd4f7
remove unnecessary headers
hturner Jun 19, 2024
9eab07e
update instructions for multiple R
hturner Jun 19, 2024
cdefd00
use "R Dev Container" in GitHub docs and welcome_msg
hturner Jun 19, 2024
5618567
minor edits
hturner Jun 19, 2024
b9757e7
merge in devel branch
hturner Jun 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ You can refer to the remaining sections as needed!
## Other Docs

- [Restarting And Stopping Codespace](docs/tutorials/codespacestartstop.md)
- [Using R Dev Environment Locally](docs/tutorials/localsetup.md)
- [Using R Dev Container Locally](docs/tutorials/localsetup.md)
- [Useful Resources](docs/resources.md)
Binary file added docs/assets/rdev13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/rdev14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/rdev15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/rdev16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/rdev17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/rdev18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/rdev19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/rdev20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/rdev21.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/rdev22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/rdev23.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/rdev4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions docs/container_setup/codespacestartstop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@


#### How to Stop Codespaces?
- To stop codespaces we just need to navigate to the Codespaces option in the bottom left of the Codespace panel.

![stop codespace](../assets/rdev14.png)

- After clicking on codespaces option we will get a drop down above something like this👇

![stop codespace](../assets/rdev15.png)

- Click on "Stop Current Codespace". It will stop the codespaces you are currently using or running.

- You will be redirected to a Restart Codespaces page. The page shows a link to restart the codespace you just stopped.

![stop codespace](../assets/rdev16.png)


#### Idle timeout:
If you do not interact with the codespace, it will close automatically when it reaches the idle timeout limit. By default, this is 30 minutes, but you can [set a personal timeout](https://docs.github.com/en/codespaces/setting-your-user-preferences/setting-your-timeout-period-for-github-codespaces#setting-your-default-timeout-period) limit in your GitHub settings.

#### How to Restart Codespaces again?

- Go to [github.com/codespaces](https://github.com/codespaces)
- Here we can see a list of the codespaces we have created
![stop codespace](../assets/rdev17.png)
- To restart it, we can just click on the codespaces we wanted to use and it will start the codespaces again for us.
- You can also see an active label added to the codespaces we just started
![stop codespace](../assets/rdev18.png)
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

## Codespaces

> You will see the message "Codespace usage for this repository is paid for by ...", with your username. Don't panic!

Expand All @@ -8,17 +7,12 @@

> For more details about codespaces billing, see the [Codespaces Billing Docs](https://github.com/features/codespaces). You can calculate your GitHub services usage with the [GitHub Services Pricing Calculator](https://github.com/pricing/calculator) and check your usage allowance under "Codespaces" [here](https://github.com/settings/billing).

1) Click on the 'Open in GitHub Codespaces' button and then click the green 'Create Codespace' button.
<figure markdown="span">
![rdev1](./docs/assets/rdev1.png){ width="300" }
<figcaption>Image caption</figcaption>
</figure>
1. Click on the 'Open in GitHub Codespaces' button and then click the green 'Create Codespace' button.
![create codespace](../assets/rdev1.png)

2. The codespace setup screen will then be shown. Starting the container may take a minute or so.

2) The codespace setup screen will then be shown. Starting the container may take a minute or so.
![image](https://github.com/StarTrooper08/SlimtoolkitActions/assets/72031540/57d88505-3939-402e-8b49-54d083d00afc)

3) You will be taken to a VSCode editor within your browser.
![image](https://github.com/r-devel/r-dev-env/assets/72031540/0597c261-a110-496c-86a4-9fb08f5dc34d)
3. You will be taken to a VSCode editor within your browser.
![codespace](../assets/rdev3.png)


43 changes: 43 additions & 0 deletions docs/container_setup/localsetup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

We can also use this codespace locally. For that we need to have some prerequisites installed.

#### > Prerequisites :

1. Docker Engine or Docker Desktop. You can find the docker desktop install instructions on [Docker Desktop Docs](https://www.docker.com/products/docker-desktop/).
2. VSCode Editor. You can download and install from [VSCode website](https://code.visualstudio.com/download).
3. A local copy of the [R Dev Container Repo](https://github.com/r-devel/r-dev-env/).

#### > Steps to run R Development Container locally :

1. Clone the [R Dev Container repo](https://github.com/r-devel/r-dev-env/)
2. Change directory to r-dev-container
```
cd r-dev-container
```
3. Restart VSCode in the r-dev-env directory with the command:
```bash
code .
```
4. Checkout the main branch and pull the latest changes
```
git checkout main
git pull
```
The main branch provides the stable release. If you require an in-development feature, use the devel branch instead.


5. After this step please be sure that your docker engine is started. If you have installed Docker Desktop just open the Docker Desktop app the engine starts automatically and if you are using just docker engine make sure to start it with the following command
```bash
systemctl start docker
```

6. We can see pop-up at the bottom right of the VSCode editor which says reopen in Dev Container.
Click on `Reopen in DevContainer` button.
![create codespace](../assets/rdev13.png)

7. After clicking on that button we will see our container is getting ready. It will take some time. So till that time you can have coffee :)
![image](https://github.com/r-devel/r-dev-env/assets/72031540/044d1e27-22a6-45df-82ec-8fb65abd75e8)
8. We can just print the environment variables mentioned in the welcome message on the terminal. And there we go!!! We have setup our R Dev Container locally.
![image](https://github.com/r-devel/r-dev-env/assets/72031540/026668de-a9bb-49bc-a515-c16a218b685d)

9. The container will be closed when you close VSCode. To reopen the container, open the r-dev-env directory in VSCode.
54 changes: 26 additions & 28 deletions docs/tutorials/building_r.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,87 +4,86 @@
### Build Setup (Without Recommended Packages)
**1) Environment Variables**

- We have environment variables for setting the paths for building R and storing the source code.
- The path ENV variable for R Build and R Source code are BUILDDIR and TOP_SRCDIR respectively.
- We have environment variables defining paths to directories for building R and storing the source code.
- `BUILDDIR` defines the build directory: /workspaces/r-dev-env/build/r-devel
`TOP_SRCDIR` defines the source directory: /workspaces/r-dev-env/svn/r-devel
- The environment variables are set in the codespace image and are available when the codespace starts.

![image](https://github.com/r-devel/r-dev-env/assets/72031540/6b6cb661-cde3-4c69-845a-a6a281c18ec2)

![alt text](../assets/rdev6.png) //newss
**2) svn checkout**

- The svn checkout cmd lets us create working of a repository with specific tag/branch.
- Command:
- The svn checkout command lets us create a local copy of a specific tag/branch of a repository.
- We can check out the latest version of the trunk (the main branch) of the R sources to $TOP_SRCDIR as follows:
```bash
svn checkout https://svn.r-project.org/R/trunk/ "$TOP_SRCDIR"
svn checkout https://svn.r-project.org/R/trunk/ $TOP_SRCDIR
```
- Output : We get file structure something like this after checking out R source code from R svn repository.

![image](https://github.com/r-devel/r-dev-env/assets/72031540/2bce81e5-5ac7-45ec-b925-9222b0919cd8)
![alt text](../assets/rdev7.png)//newss

**3) Change Directory to BUILDDIR**
**3) Change to the build directory**

- We need to change our directory to R build directory(BUILDDIR) to build and configure our R source code.
- To keep the source directory clean, we change to a build directory to configure and build R.

- First we will create a directory using env var BUILDDIR.
- Command:
- First create the directory specified by the BUILDDIR environment variable.
```bash
mkdir -p $BUILDDIR
```

- Then we can change directory from root to $BUILDDIR one.
- Command:
- Then we can change directory from root to the build directory.
```bash
cd $BUILDDIR
```

**4) configure source code**
**4) configure the build**

- After we change directory to BUILDDIR we can configure and build R.
- Commands :
- After we change directory, we must run the configure script from the source directory.
This step takes ~1 minute on the codespace.
```bash
"$TOP_SRCDIR/configure" --enable-R-shlib --without-recommended-packages
"$TOP_SRCDIR/configure"
make
sudo make install
make check
```


- The configure cmd prepares for building R, creating files and folders inside the BUILDDIR directory.
- Output : We get file structure something like this after using configure command.

![image](https://github.com/r-devel/r-dev-env/assets/72031540/0d4878fa-c1a8-462b-8365-76cc5dadf734)
![alt text](../assets/rdev8.png) //newss

**5) Make Contributions**

- After having built the current development version of R, we can now make changes to the source code and contribute to the project.
- Follow the [R Contribution Workflow](./contribution_workflow.md)tutorial to learn how to do this.

### Build Setup (With Recommended Packages)
This build setup differs from the above because the recommended packages for R are included.

**1) Checkout the R source using svn.**

- Command:
```bash
svn checkout https://svn.r-project.org/R/trunk/ "$TOP_SRCDIR"
```


**2) Create a directory using the environment variable called BUILDDIR.**

- Command:
```bash
mkdir -p $BUILDDIR
```


**3) Then we will install recommended packages using cmd**
**3) Download the source code for the recommended packages**

To build R with the recommended packages, we need to run the tools/rsync-recommended script from the source directory to download the source code for these packages:


- Command:
```bash
"$TOP_SRCDIR/tools/rsync-recommended"
```


![Screenshot from 2023-07-28 15-18-22](https://github.com/r-devel/r-dev-env/assets/72031540/532a3f40-ab17-43b4-b729-ab57b2e3ffe9)
![alt text](../assets/rdev9.png)

**4) We can now change directory to $BUILDDIR using cmd**

Expand All @@ -107,5 +106,4 @@ mkdir -p $BUILDDIR

- The configure script sets options and settings for building R, creating files and folders inside the BUILDDIR directory.
- After running the configure script the file structure of the build directory is something like the below.

![image](https://github.com/r-devel/r-dev-env/assets/72031540/0d4878fa-c1a8-462b-8365-76cc5dadf734)
![alt text](../assets/rdev10.png)
31 changes: 0 additions & 31 deletions docs/tutorials/codespacestartstop.md

This file was deleted.

23 changes: 13 additions & 10 deletions docs/tutorials/contribution_workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#### 1. Example Contribution Workflow using DevContainer:
- To start working in R we will click on `R:(not attach)` option which is in the bottom right of our R-dev codespace. It will open R terminal for us.

![image](https://github.com/r-devel/r-dev-env/assets/72031540/4ad3ed18-108a-4f29-ab6c-7f32d81721a7)
![alt text](../assets/rdev11.png)

![image](https://github.com/r-devel/r-dev-env/assets/72031540/b3bdd3da-903d-4330-81c3-e41147d5dcd4)
![alt text](../assets/rdev12.png)

- We can now run R commands. We will use the `utils::askYesNo()` function as an example

![image](https://github.com/r-devel/r-dev-env/assets/72031540/00ffb5cf-250b-49d9-ab37-4028ad708164)
![alt text](../assets/rdev19.png)

```R
> askYesNo("Is this a good example?")
Expand All @@ -22,7 +22,7 @@
- Edit the source code of `utils::askYesNo()` to change the default options. The source code can be found in `$TOP_SRCDIR/src/library/utils/R/askYesNo.R`.

**> Before edit:**
![image](https://github.com/r-devel/r-dev-env/assets/72031540/6e7f368a-7a71-457c-a08e-de0d1b3c476f)
![alt text](../assets/rdev20.png)


```R title="askYesNo.R" linenums="20"
Expand All @@ -31,7 +31,7 @@

**> With edit (for example - change to whatever you like!):**

![image](https://github.com/r-devel/r-dev-env/assets/72031540/b7476540-1030-4f88-ae3c-1c2f9dd90deb)
![alt text](../assets/rdev21.png)

```R title="askYesNo.R" linenums="20"
prompts = getOption("askYesNo", gettext(c("Oh yeah!", "Don't think so", "Cancel"))),
Expand All @@ -41,16 +41,19 @@
- Re-build the utils package (we only need to re-build the part we have modified).
We can rebuild the package by following simple steps.
- First we need to be inside $BUILDDIR, for that we can change directory to `cd $BUILDDIR`.
- After that we can run cmd `make` and `sudo make install` in a series.
![image](https://github.com/r-devel/r-dev-env/assets/72031540/e32f8b8f-c573-41e6-b4cc-31fb3494891a)

![image](https://github.com/r-devel/r-dev-env/assets/72031540/709dd607-5d22-4b17-90ad-8f642ecad6b6)
- After that we can run cmd `make` and `make check` in a series.
```bash
make
make check
```

![alt text](../assets/rdev22.png)

- This will re-build any parts of R that have changed, in this case only re-building the utils package, then re-install R. If we open a new R terminal we will see our changes getting reflected.

#### 4. Cross check and Re-running Code
- Check the edit has worked as expected by re-running the example code:
![image](https://github.com/r-devel/r-dev-env/assets/72031540/97fcfee8-dae5-402c-8bf4-0df62a63c3b0)
![alt text](../assets/rdev23.png)

```R
> askYesNo("Is this a good example?")
Expand Down
37 changes: 0 additions & 37 deletions docs/tutorials/localsetup.md

This file was deleted.

Loading