Skip to content

Commit

Permalink
Merge pull request #7 from acceleratescience/6-update-setting-up
Browse files Browse the repository at this point in the history
6 update setting up
  • Loading branch information
rkdan authored Nov 13, 2024
2 parents 555fb99 + a41d5e7 commit fb0093e
Show file tree
Hide file tree
Showing 16 changed files with 395 additions and 304 deletions.
40 changes: 37 additions & 3 deletions docs/1_setting_up.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
## Setting up Codespaces
The first step is to create a new repository in your GitHub called `cancer-prediction`. Now head over to the `accelerate/packaging-publishing` repo, switch to the basic branch, and download a zip of the code.
The first step is to fork this repository to your own GitHub account. This will allow you to make changes to the code without affecting the original repository.

Now head back over to your newly created repo and open Codespaces:
Now head back over to your newly created repo. Everything in the `main` repo is not needed, so we do a few things:

**Change the default branch**

- Head to the Repo Settings
- There is a heading called "Default Branch"
- Click on the pencil icon and change the default branch to `basic`

**Delete the `main` branch**

- Head back to the Code tab
- Locate the branch dropdown and click on the thing to the right of it
- Find the `main` branch and delete it

**Rename the `basic` branch to `main`**

- In the same page, next to the trash can, click on the three dots
- Click on "Rename branch"
- Change the name to `main`

**Rename the repo**

- Head back over to the Settings tab
- At the top, you can change the name of the repo to whatever you want
- Rename it to `cancer-prediction-<your-crsid>`

Now open Codespaces on `main`:

![](imgs/createcodespace.png)

Expand All @@ -18,7 +44,7 @@ It is good practice to do development work on a new branch, but first we should

Set up the new virtual environment with,
```bash
python3.10 -m venv venv
python -m venv venv
. venv/bin/activate
```

Expand Down Expand Up @@ -53,6 +79,14 @@ This will automatically create and move over to a new branch called `dev`. The e

In the source control tab, hit "Publish Branch".

When you see this symbol:

<br>
![Dark Souls Bonfire](../imgs/dark-souls-bonfire.gif "Commit your changes and rest, weary traveller"){ width="50" .center }
<br>

it means that you should commit and push your changes to the repository. They indicate key checkpoints in the workshop.

## Further reading
<div class="grid cards" markdown>

Expand Down
5 changes: 1 addition & 4 deletions docs/2_project_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,19 +299,16 @@ if app_mode == "Load model and predict" or app_mode == "Manual data entry for pr
elif app_mode == "Manual data entry for prediction":
st.header("Manual data entry for prediction")

# Define your features names here based on the model's training dataset
feature_names = model.feature_names # Replace these with actual feature names
feature_names = model.feature_names

# Create a dictionary to store user inputs
input_data = {}

# Dynamically generate input fields for each feature
for feature in feature_names:
# You might want to customize the `step` parameter based on the feature's data type and expected range
input_data[feature] = st.number_input(f"Enter {feature}:", step=0.01)

if st.button('Predict'):
# Prepare the data for prediction (ensure it matches the model's expected input format)
input_df = pd.DataFrame([input_data])

# Perform the prediction
Expand Down
12 changes: 7 additions & 5 deletions docs/4_Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ OK

You can try changing part of the test code to force them to fail, and check the output. Now that the tests have run succesfully, it's time to commit and push the changes.

<br>
![Dark Souls Bonfire](../imgs/dark-souls-bonfire.gif "Commit your changes and rest, weary traveller"){ width="50" .center }
<br>

!!! note

For some reason Codespaces is not discovering the tests. Just run them in the terminal for now. But VSCode run locally should work fine.

## Further reading
<div class="grid cards" markdown>
Expand All @@ -105,8 +112,3 @@ You can try changing part of the test code to force them to fail, and check the
Information on `unittest`, Pytest, and testing in VSCode

</div>


!!! note

For some reason Codespaces is not discovering the tests. Just run them in the terminal for now. But VSCode run locally should work fine.
52 changes: 41 additions & 11 deletions docs/CICD/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,61 @@ Here is the workflow for this:
name: documentation
on:
push:
branches:
- main
tags:
- 'v*'

jobs:
build-docs:
needs: tests
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest

steps:
# Set up dependencies
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Verify tag is on main
run: |
# Get the branch containing this tag
BRANCH=$(git branch -r --contains ${{ github.ref }} | grep 'main' || true)
# Check if the tag is on main
if [ -z "$BRANCH" ]; then
echo "Error: Tag must be created on main branch"
exit 1
fi
- name: Install Poetry
run: pipx install poetry

- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- run: python3 -m pip install mkdocs==1.4.2 mkdocstrings==0.21.2 "mkdocstrings[python]>=0.18"
python-version: '3.12'
cache: 'poetry'

- name: Install dependencies with dev group
run: poetry install --with dev

# Deploy docs
- name: Deploy documentation
run: mkdocs gh-deploy --force
run: |
poetry run mkdocs gh-deploy --force
```
This simply says: when a push is made to main, publish the documentation.
Most of this is the same as for publishing the package to PyPi. The main difference is that we are running `mkdocs gh-deploy --force` to deploy the documentation to GitHub Pages. This will create a new branch called `gh-pages` which will contain the documentation.

You should now be able to navigate to `https://<username>.github.io/<repo-name>` and see your documentation!

!!! tip

This is a great tool to make personal websites for your work. You can add images, links, and even videos to your documentation. It is a great way to showcase your research.

This website was made using MkDocs and the Material theme! Check out the Material website [here](https://squidfunk.github.io/mkdocs-material/).

For more details on how our websites are made, then you can browse through the folders in the github repo by clicking the GitHub icon at the top left of the page.

In addition, since we are using some tools, we should let everyone know! So we can add the following to our `README.md` file:
In addition, since we are using some tools, we should let everyone know! So we can add the following to our `README.md` file (just be sure to replace the links with the correct ones):
```html
<div align="center">
Expand Down
4 changes: 4 additions & 0 deletions docs/CICD/precommit.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ Found 4 errors in 1 file (checked 7 source files)
isort....................................................................Passed
```

<br>
![Dark Souls Bonfire](../imgs/dark-souls-bonfire.gif "Commit your changes and rest, weary traveller"){ width="50" .center }
<br>

## Further reading
<div class="grid cards" markdown>

Expand Down
Loading

0 comments on commit fb0093e

Please sign in to comment.