Skip to content

Commit

Permalink
Update docs (#811)
Browse files Browse the repository at this point in the history
  • Loading branch information
clizbe authored Sep 26, 2024
1 parent ef15633 commit 1b88434
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 24 deletions.
51 changes: 32 additions & 19 deletions README.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ To contribute to TulipaEnergyModel.jl, you need the following:
julia
```

> **Note**:
> `julia` must be part of your environment variables to call it from the
> command line.
> **Note:** `julia` must be part of your environment variables to call it from the command line.

Then press <kbd>]</kbd> to enter the package mode.
In the package mode, enter the following:
Expand Down Expand Up @@ -103,6 +101,21 @@ git clone https://github.com/your-name/TulipaEnergyModel.jl #
git remote add upstream https://github.com/TulipaEnergy/TulipaEnergyModel.jl # use the original repository URL
```

Check that your origin and upstream are correct:

```bash
git remote -v
```

You should see something similar to:
![Screenshot of remote names, showing origin and upstream](docs/images/Remotes.png)

If your names are wrong, use this command (with the relevant names) to correct it:

```bash
git remote set-url [name] [url]
```

### Configuring Git

Because operating systems use different line endings for text files, you need to configure Git to ensure code consistency across different platforms. You can do this with the following commands:
Expand Down Expand Up @@ -157,7 +170,7 @@ Do it once now to make sure that everything works as expected.

Now, you can only commit if all the pre-commit tests pass.

> **Note**:
> **Note:**
> On subsequent occasions when you need to run pre-commit in a new shell, you
> will need to activate the Python virtual environment. If so, do the following:
>
Expand Down Expand Up @@ -207,15 +220,15 @@ Fetch from org remote, fast-forward your local main:
```bash
git switch main
git fetch --all --prune
git merge --ff-only origin/main
git merge --ff-only upstream/main
```

> **Warning**:
> If you have a conflict on your main, it will appear now. You can delete
> your old `main` branch using
>
> ```bash
> git reset --hard origin/main
> git reset --hard upstream/main
> ```

### 2. Create a New Branch
Expand All @@ -231,7 +244,7 @@ git switch -c <branch_name>
- If there is no associated issue **and the changes are small**, add a prefix such as "typo", "hotfix", "small-refactor", according to the type of update.
- If the changes are not small and there is no associated issue, then create the issue first, so we can properly discuss the changes.

> **Note**:
> **Note:**
> Always branch from `main`, i.e., the main branch of your own fork.

### 3. Implement the Changes
Expand Down Expand Up @@ -282,7 +295,7 @@ repository. Use:

```bash
git commit -am "A short but descriptive commit message" # Equivalent to: git commit -a -m "commit msg"
git push -u myfork <branch_name>
git push -u origin <branch_name>
```

When writing the commit message:
Expand All @@ -291,7 +304,7 @@ When writing the commit message:
- have informative titles;
- if necessary, add a body with details.

> **Note**:
> **Note:**
> Try to create "atomic git commits". Read
> [_The Utopic Git History_](https://blog.esciencecenter.nl/the-utopic-git-history-d44b81c09593)
> to learn more.
Expand All @@ -308,7 +321,7 @@ Do the following steps:
```bash
git switch main # switch to the main branch
git fetch --all --prune # fetch the updates
git merge --ff-only origin/main # merge as a fast-forward
git merge --ff-only upstream/main # merge as a fast-forward
git switch <branch_name> # switch back to the issue branch
git rebase main <branch_name> # rebase it
```
Expand All @@ -328,7 +341,7 @@ Once the conflicts are resolved, commit and push.
```bash
git status # Another way to show that all conflicts are fixed.
git rebase --continue
git push --force myfork <branch_name>
git push --force origin <branch_name>
```
### 8. Create a Pull Request
Expand All @@ -349,7 +362,7 @@ Fill in the pull request details:
![Screenshot of the pull request information](docs/images/PRInfo.png)
You pull request will apper in the list of pull requests in the
You pull request will appear in the list of pull requests in the
TulipaEnergyModel.jl repository, where you can track the review process.
Sometimes reviewers request changes. After pushing any changes,
Expand All @@ -373,10 +386,10 @@ docs> dev ..
docs> update
```
**Note:**
If you intend to rerun the build step, ensure you have the package `Revise`
installed in your global environment, and run `using Revise` before including
`make.jl`. Alternatively, close `julia` and reopen it.
> **Note**:
> If you intend to rerun the build step, ensure you have the package `Revise`
> installed in your global environment, and run `using Revise` before including
> `make.jl`. Alternatively, close `julia` and reopen it.
Then, to build the documentation, run in Julia:
Expand Down Expand Up @@ -430,9 +443,9 @@ See the file <benchmark/profiling.jl> for an example of profiling code.
When publishing a new version of the model to the Julia Registry, follow this procedure:
**Note**:
To be able to register, you need to be a member of the organisation TulipaEnergy and have your visibility set to public:
![Screenshot of public members of TulipaEnergy on GitHub](docs/images/PublicMember.png)
> **Note:**
> To be able to register, you need to be a member of the organisation TulipaEnergy and have your visibility set to public:
> ![Screenshot of public members of TulipaEnergy on GitHub](docs/images/PublicMember.png)
1. Click on the `Project.toml` file on GitHub.
Expand Down
Binary file added docs/images/Remotes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions docs/src/how-to-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ You can also check the [`test/inputs` folder](https://github.com/TulipaEnergy/Tu
Below, we have a description of the files.
At the end, in [Schemas](@ref schemas), we have the expected columns in these CSVs.

> **Tip:**
> If you modify CSV files and want to see your modifications, the normal `git diff` command will not be informative.
> Instead, you can use
>
> ```bash
> git diff --word-diff-regex="[^[:space:],]+"
> ```
>
> to make `git` treat the `,` as word separators.
> You can also compare two CSV files with
>
> ```bash
> git diff --no-index --word-diff-regex="[^[:space:],]+" file1 file2
> ```
#### [`graph-assets-data.csv`](@id graph-assets-data)
This file contains the list of assets and the static data associated with each of them.
Expand Down
10 changes: 5 additions & 5 deletions src/create-model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@ function add_expression_terms_intra_rp_constraints!(
end

"""
add_expression_is_charging_terms_intra_rp_constraints!(df_cons,
add_expression_is_charging_terms_intra_rp_constraints!(df_cons,
df_is_charging,
workspace
)
Computes the is_charging expressions per row of df_cons for the constraints
Computes the `is_charging` expressions per row of `df_cons` for the constraints
that are within (intra) the representative periods.
This function is only used internally in the model.
Expand Down Expand Up @@ -368,13 +368,13 @@ function add_expression_is_charging_terms_intra_rp_constraints!(df_cons, df_is_c
end

"""
add_expression_is_charging_terms_intra_rp_constraints!(
add_expression_units_on_terms_intra_rp_constraints!(
df_cons,
df_is_charging,
df_units_on,
workspace,
)
Computes the is_charging expressions per row of df_cons for the constraints
Computes the `units_on` expressions per row of `df_cons` for the constraints
that are within (intra) the representative periods.
This function is only used internally in the model.
Expand Down

0 comments on commit 1b88434

Please sign in to comment.