You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: episodes/41-code-review.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -571,9 +571,9 @@ This tells the author you are happy for them to merge the pull request.
571
571
572
572
### Merge via command line
573
573
574
-
The `git merge` command provides a way to directly merge branches on your local. In general, when adding changes to the major branches like `develop` or `main`, this is not a good practice since it bypasses the code review process. It is a common practice for an open-source project to set its important branches protected, meaning pushing directly will fail. Therefore, even you can merge to `develop` or `main` locally, you will not be able to push the changes to the remote repository.
574
+
The `git merge` command provides a way to directly merge branches on your local. In general, when adding changes to the major branches like `develop` or `main`, this is not a good practice since it bypasses the code review process. It is a common practice for an open-source project to protect its most important branches, meaning pushing directly to one of these branches will fail. Therefore, even if you can merge to `develop` or `main` locally, you will not be able to push the changes to the remote repository.
575
575
576
-
On the other hand, the `git merge` command can be very useful for keeping your feature branch up to date with the major branched. For example, if you are working on a branch `my-feature` and the `develop` branch has received new commits (e.g. someone else has merged their pull request), you can do the following to include changes from `develop` into your feature branch:
576
+
On the other hand, the `git merge` command can be very useful for keeping your feature branch up to date with the major branches. For example, if you are working on a branch `my-feature` and the `develop` branch has received new commits (e.g. someone else has merged their pull request), you can do the following to include changes from `develop` into your feature branch:
Copy file name to clipboardExpand all lines: episodes/42-software-reuse.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,7 @@ Where 'others', of course, can include a future version of ourselves.
75
75
**Work on a branch**
76
76
77
77
In the previous episode, we updated the `develop` branch with a new feature.
78
-
In this episode we will continuew work on improving the reusability of our code.
78
+
In this episode we will continue working on the reusability of our code.
79
79
To do this, we will create a branch called `improve-reusability` from the `develop` branch:
80
80
81
81
```bash
@@ -271,23 +271,23 @@ which may be held within other Markdown files within the repository or elsewhere
271
271
We will finish these off later.
272
272
See [Matias Singer's curated list of awesome READMEs](https://github.com/matiassingers/awesome-readme) for inspiration.
273
273
274
-
### Generate and Deploy Documentation using MKDocs
274
+
### Generating and deploying documentation using MKDocs
275
275
276
-
[MKDocs](https://www.mkdocs.org/)generate project documentation as a static website from Markdown files. The website can then be hosted on GitHub Pages or other static site hosting services, providing a user-friendly interface for accessing the documentation.
276
+
[MKDocs](https://www.mkdocs.org/)generates project documentation as a static website from Markdown files. The website can then be hosted on GitHub Pages or other static site hosting services, providing a user-friendly interface for accessing the documentation.
277
277
278
278
We can install MKDocs package using `pip`. Here we also install a plugin `mkdocstrings`, which will be used later.
279
279
We advise you to do this within a virtual environment you created before:
By default, `mkdocstrings` does not provide support for a specific language. Therefore, we specify `[python]` to install extra dependencies of `mkdocstrings` for Python language support.
286
286
287
287
After installation, you can intialize a new MKDocs project in our Python project:
288
288
289
289
```bash
290
-
mkdocs new .
290
+
python3 -m mkdocs new .
291
291
```
292
292
293
293
This will create the two files in your project: `mkdocs.yml` and `docs/index.md`. The first file `mkdocs.yml` is the configuration file for your documentation site. It serves as the central configuration hub for your MKDocs documentation. It tells MKDocs how to structure your documentation site, which plugins and themes to use,
@@ -313,14 +313,14 @@ Here we give a name to our documentation site, `Inflam`. We set up the navigatio
313
313
We can try to render the documentation site locally and see how it looks like:
314
314
315
315
```bash
316
-
mkdocs serve
316
+
python3 -m mkdocs serve
317
317
```
318
318
319
319
This will start to build a local static documentation site and serve it at a local web server.
320
320
By default, it will be available at `http://127.0.0.1:8000/`, which will also show in the terminal output.
321
321
You can open this URL in your web browser to view the documentation site.
322
322
323
-
The documentation site now consists some default content about MKDocs. It is rendered from the `docs/index.md` file. Let's edit this file to add some relevant content about our project. For simplicity, we can borrow the content from our `README.md` file.
323
+
The documentation site now consists of some default content about MKDocs. It is rendered from the `docs/index.md` file. Let's edit this file to add some relevant content about our project. For simplicity, we can borrow the content from our `README.md` file.
324
324
325
325
::::::::::::::::::::::::::::::::: challenge
326
326
@@ -348,7 +348,7 @@ Apart from the title, there is only one line `:::inflammation.models` in this fi
348
348
349
349
Now we can call `mkdocs serve` again to render the documentation site locally and check how the API reference page looks like.
350
350
351
-
Now we can see all the functions defined in the `inflammation.models` module are automatically documented with their docstrings.
351
+
Now we can see that all the functions defined in the `inflammation.models` module are automatically documented with their docstrings.
352
352
353
353
One can make the rendered API documentation more informative by improving the docstrings in the code. For example, we can improve the docstring of the `load_csv` function by following the `numpy` style docstring format. Let's update the doctring of `load_csv` as below:
354
354
@@ -420,7 +420,7 @@ that helpfully covers the kinds of documentation to consider
420
420
and other effective ways to convey the same information.
421
421
422
422
423
-
## Configure Your Code with `pyproject.toml`
423
+
## Configuring your code with `pyproject.toml`
424
424
425
425
[`pyproject.toml`](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/) is a standardized configuration file, written in TOML format, used in Python projects to declare build system requirements, metadata, and tool configuration. It serves as a central place to manage various aspects of a Python project, making it easier to build, package, and distribute the project.
426
426
@@ -442,11 +442,11 @@ packages = ["inflammation"]
442
442
443
443
It defines three main sections of a Python project as three tables:
444
444
445
-
- The [build-system] table, It allows you to declare which build backend you use and which other dependencies are needed to build your project.
445
+
- The `[build-system]` table allows you to declare which build backend you use and which other dependencies are needed to build your project.
446
446
447
-
- The [project] table, which specifies your project’s basic metadata, such as the project name, author name(s), dependencies, and more.
447
+
- The `[project]` table, which specifies your project’s basic metadata, such as the project name, author name(s), dependencies, and more.
448
448
449
-
-The [tool] table has tool-specific subtables, e.g., [tool.setuptools], which contents are defined by each tool, allowing you to configure various aspects of the tool's behavior.
449
+
-The `[tool]` table has tool-specific subtables, e.g., `[tool.setuptools]`, the content of which is defined by each tool, allowing you to configure various aspects of the tool's behavior.
450
450
451
451
We can improve the `pyproject.toml` file by adding some metadata about the dependencies of our project. Let's update the `[project]` table as below:
452
452
@@ -470,7 +470,7 @@ git add pyproject.toml
470
470
git commit -m "Update pyproject.toml with dependencies"
471
471
```
472
472
473
-
## Make Your Code Citable by adding a CITATION File
473
+
## Make your code citable by adding a CITATION File
474
474
475
475
It is easy to correctly cite a paper: all the necessary information (metadata) can be found on the title page or the article website.
476
476
@@ -574,7 +574,7 @@ Push your changes to your feature branch and check your repository in GitHub. Wh
574
574
575
575
We may also wish to make data available to either
576
576
be used with the software or as generated results.
577
-
This may be via some other means other than GitHub, such as Zenodo, Figshare, or an institutional repository.
577
+
This may be via some means other than GitHub, such as Zenodo, Figshare, or an institutional repository.
578
578
An important aspect to remember with sharing data on such systems is that
579
579
they may reside in other countries,
580
580
and we must be careful depending on the nature of the data.
@@ -588,7 +588,7 @@ and even international policies and laws.
588
588
Within Europe, for example, there is the need to conform to things like [GDPR][gdpr].
589
589
it is a very good idea to make yourself aware of these aspects.
590
590
591
-
## Merge Your Changes to the Main Branch
591
+
## Merge your changes to the `main` branch
592
592
593
593
After completing all the changes to improve the reusability of your code, you can first merge your feature branch to the `devlop` branch. Then merge the `develop` branch to the `main` branch.
0 commit comments