Skip to content

Commit 3a5c312

Browse files
committed
imporve wording
1 parent 6d7a091 commit 3a5c312

1 file changed

Lines changed: 60 additions & 16 deletions

File tree

episodes/42-software-reuse.md

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ In this episode we will work on improving the reusability of our code.
7878
It would be a good idea to create a new branch for this work,
7979
and merge it back into `main` once we are done.
8080

81-
For example, you could create a branch called `improve-reusability`:
81+
For example, you could create a branch called `improve-reusability` from the `develop` branch:
8282

8383
```bash
84+
$ git switch develop
8485
$ git switch -c improve-reusability
8586
```
8687

@@ -324,6 +325,8 @@ For simplicity, we can borrow the content from our `README.md` file.
324325

325326
::::::::::::::::::::::::::::::::: challenge
326327

328+
### Exercise: Update Documentation Content
329+
327330
Modify `docs/index.md` with the same content as your `README.md` file.
328331
Render the documentation site locally again with `mkdocs serve`.
329332
Check how it looks like in your web browser.
@@ -391,6 +394,7 @@ Once you are happy with the documentation site, you can deploy it to GitHub Page
391394

392395
```bash
393396
git add inflammation/models.py mkdocs.yml docs/
397+
git commit -m "Add documentation with MKDocs"
394398
```
395399

396400
To deploy the documentation to GitHub Pages, you can use the following command:
@@ -458,6 +462,47 @@ dependencies = [
458462

459463
This is an alternative way to specify the dependencies than the `requirements.txt` file we created before. The advantage of specifying dependencies in `pyproject.toml`, is that it centralizes this information in one place, and better integrates with modern Python packaging tools like [`uv`](https://docs.astral.sh/uv/), which we will see in the next section about releasing our Python project.
460464

465+
Do not forget to commit the changes we made to `pyproject.toml` file.
466+
467+
```bash
468+
git add pyproject.toml
469+
git commit -m "Update pyproject.toml with dependencies"
470+
```
471+
472+
## Make Your Code Citable by adding a CITATION File
473+
474+
It is easy to correctly cite a paper: all the necessary information (metadata) can be found on the title page or the article website.
475+
476+
Software and datasets have no title page, the relevant information is often less obvious. To get credit for your work, you should provide citation information for your software.
477+
478+
A good way to add citation information is by including a [CITATION.cff](https://citation-file-format.github.io/) file (Citation File Format) in the root of your repository. This plain text file, written in YAML format, contains all the necessary citation details in a structured manner.
479+
480+
Platforms like GitHub, Zenodo, and Zotero reuse the citation metadata you provide. GitHub, for example, automatically renders the file on the repository landing page and provides a BibTeX snippet which users can simply copy!
481+
482+
#### Minimal example for a CITATION.cff file
483+
484+
```yaml
485+
authors:
486+
- family-names: Doe
487+
given-names: John
488+
cff-version: 1.2.0
489+
message: "If you use this software, please cite it using the metadata from this file."
490+
title: "Inflam"
491+
```
492+
We can also include other important information of software such as version, release date, DOI, license, keywords.
493+
494+
#### How to create a CITATION.cff file?
495+
496+
You can use the [cffinit](https://citation-file-format.github.io/cff-initializer-javascript/) tool to create a citation file.
497+
498+
:::challenge
499+
### Exercise: Create a CITATION.cff using cffinit
500+
1. Follow [these steps to create a CITATION file with cffinit](https://book.the-turing-way.org/communication/citable/citable-cffinit).
501+
1. Rename the created file to `CITATION.cff` and add it to the root folder of your repository.
502+
1. Push your changes to feature branch and check your repository in GitHub. What has happened?
503+
:::
504+
505+
461506
## Choosing an Open Source Licence
462507

463508
Software licensing is a whole topic in itself, so we'll just summarise here.
@@ -512,27 +557,18 @@ If you want more information, or help choosing a licence,
512557
the [Choose An Open-Source Licence](https://choosealicense.com/)
513558
or [tl;dr Legal](https://tldrlegal.com/) sites can help.
514559

515-
::::::::::::::::::::::::::::::::::::::: challenge
516-
517-
## Exercise: Preparing for Release
518560

519-
In a (hopefully) highly unlikely and thoroughly unrecommended scenario,
520-
your project leader has informed you of the need to release your software
521-
within the next half hour,
522-
so it can be assessed for use by another team.
523-
You'll need to consider finishing the README,
524-
choosing a licence,
525-
and fixing any remaining problems you are aware of in your codebase.
526-
Ensure you prioritise and work on the most pressing issues first!
527-
528-
::::::::::::::::::::::::::::::::::::::::::::::::::
561+
:::challenge
562+
Select a licence for your code using the tool above, save it as a file called `LICENSE` in the root of your repository.
563+
Push your changes to your feature branch and check your repository in GitHub. What has happened?
564+
:::
529565

530566

531567
## Conforming to Data Policy and Regulation
532568

533569
We may also wish to make data available to either
534570
be used with the software or as generated results.
535-
This may be via GitHub or some other means.
571+
This may be via some other means other than GitHub, such as Zenodo, Figshare, or an institutional repository.
536572
An important aspect to remember with sharing data on such systems is that
537573
they may reside in other countries,
538574
and we must be careful depending on the nature of the data.
@@ -546,11 +582,19 @@ and even international policies and laws.
546582
Within Europe, for example, there is the need to conform to things like [GDPR][gdpr].
547583
it is a very good idea to make yourself aware of these aspects.
548584

585+
## Merge Your Changes to the Main Branch
586+
587+
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.
549588

589+
In the next Section, we will look at how to release your Python project from the `main` branch
550590

551591
:::::::::::::::::::::::::::::::::::::::: keypoints
552592

553-
- The reuse battle is won before it is fought. Select and use good practices consistently throughout development and not just at the end.
593+
- Add README file for general documentation about your software
594+
- Use MKDocs to generate and deploy documentation site
595+
- Use `pyproject.toml` to centralize configuration of your Python project
596+
- Add `CITATION.cff` file to make your code citable
597+
- Choose an `LICENSE` file to specify the open source licence of your code
554598

555599
::::::::::::::::::::::::::::::::::::::::::::::::::
556600

0 commit comments

Comments
 (0)