Skip to content

Commit 9399198

Browse files
committed
updating Python template: simplification + auto generate README
1 parent 2877fe6 commit 9399198

File tree

4 files changed

+64
-99
lines changed

4 files changed

+64
-99
lines changed

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
1+
# Template for contribution to Computo
2+
Jane Doe, John Doe
3+
2025-07-30
14

2-
# Computo Template for Python users
5+
*Template for preparing a submission to Computo, using the [quarto
6+
journal
7+
extension](https://github.com/computorg/computo-quarto-extension), the
8+
Jupyter kernel (Python user) and the environment files to set-up the
9+
dependencies.
10+
For a detailed, step-by-step guide on preparing your article, setting up
11+
the continuous integration and submitting it to Computo, please consult
12+
the [guidelines for
13+
authors](https://computo-journal.org/site/guidelines-authors.html).*
314

4-
[![build and deploy](https://github.com/computorg/template-computo-python/actions/workflows/build.yml/badge.svg)](https://github.com/computorg/template-computo-python/actions/workflows/build.yml)
15+
[![build and
16+
publish](https://github.com/computorg/template-computo-r/actions/workflows/build.yml/badge.svg)](https://github.com/computorg/template-computo-r/actions/workflows/build.yml)
17+
[![Creative Commons
18+
License](https://i.creativecommons.org/l/by/4.0/80x15.png)](http://creativecommons.org/licenses/by/4.0/)
519

6-
Documentation and sample of a simple `Python`-based submission for the [Computo journal](https://computo-journal.org), using our Quarto-based template and `micromamba` for handling dependencies (`pip` is also supported).
20+
### Authors
721

8-
It shows how to automatically setup and build the HTML and PDF outputs, ready to submit to our peer-review platform.
22+
- [Jane Doe](https://janedoe.someplace.themoon.org) (Name of Affiliation
23+
one)
24+
- [John Doe](https://johndoe.someplace.themoon.org) (Name of Affiliation
25+
two)
926

10-
:warning: **All important information about writing and preparing an article to be submitted to Computo, and related technicalities** are detailed [in the guidelines for authors](https://computo-journal.org/site/guidelines-authors.html). :warning:
27+
### Abstract
1128

29+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur
30+
posuere vestibulum facilisis. Aenean pretium orci augue, quis lobortis
31+
libero accumsan eu. Nam mollis lorem sit amet pellentesque ullamcorper.
32+
Curabitur lobortis libero eget malesuada vestibulum. Nam nec nibh massa.
33+
Pellentesque porttitor cursus tellus. Mauris urna erat, rhoncus sed
34+
faucibus sit amet, venenatis eu ipsum.

README.qmd

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
format: gfm
3+
---
4+
5+
_{{< meta description >}}_
6+
7+
[![build and publish](https://github.com/{{< meta github-user >}}/{{< meta repo >}}/actions/workflows/build.yml/badge.svg)](https://github.com/{{< meta github-user >}}/{{< meta repo >}}/actions/workflows/build.yml)
8+
[![Creative Commons License](https://i.creativecommons.org/l/by/4.0/80x15.png)](http://creativecommons.org/licenses/by/4.0/)
9+
10+
### Authors
11+
12+
- [{{< meta by-author.1.name.literal >}}]({{< meta by-author.1.url >}}) ({{< meta by-affiliation.1.name >}})
13+
- [{{< meta by-author.2.name.literal >}}]({{< meta by-author.2.url >}}) ({{< meta by-affiliation.2.name >}})
14+
15+
### Abstract
16+
17+
{{< meta abstract >}}
18+

_quarto.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
project:
2-
title: "template-computo-python"
2+
type: default
3+
render:
4+
- template-computo-python.qmd
5+
- README.qmd
36

47
title: "Template for contribution to Computo"
58
subtitle: "Example dedicated to `Python` users"
@@ -18,22 +21,25 @@ author:
1821
url: https://johndoe.someplace.themoon.org
1922
orcid: 0000-0000-0000-0000
2023
affiliations:
21-
- name: Name of Afficiliation two
24+
- name: Name of Affiliation two
2225
department: Computer Science
2326
url: https://someplace.themoon.org
2427
date: last-modified
2528
date-modified: last-modified
2629
description: |
27-
This document provides a template based on the [`quarto`](https://quarto.org/) system for contributions to Computo, using the [`quarto journal extension`](https://github.com/computorg/computo-quarto-extension), the Jupyter kernel (Python user) and `venv+pip` to set-up the dependencies.
30+
Template for preparing a submission to Computo, using the [quarto journal extension](https://github.com/computorg/computo-quarto-extension), the Jupyter kernel (Python user) and the environment files to set-up the dependencies.
31+
32+
For a detailed, step-by-step guide on preparing your article, setting up the continuous integration and submitting it to Computo, please consult the [guidelines for authors](https://computo-journal.org/site/guidelines-authors.html).
2833
abstract: >+
2934
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur posuere vestibulum facilisis. Aenean pretium orci augue, quis lobortis libero accumsan eu. Nam mollis lorem sit amet pellentesque ullamcorper. Curabitur lobortis libero eget malesuada vestibulum. Nam nec nibh massa. Pellentesque porttitor cursus tellus. Mauris urna erat, rhoncus sed faucibus sit amet, venenatis eu ipsum.
3035
keywords: [key1, key2, key3]
3136
bibliography: references.bib
3237
github-user: computorg
33-
repo: "template-computo-python"
38+
repo: "template-computo-r"
3439
draft: true # set to false once the build is running
3540
published: false # will be set to true once accepted
41+
license: CC-BY-4.0
3642
format:
3743
computo-html: default
3844
computo-pdf: default
39-
jupyter: python3
45+
jupyter: python3

template-computo-python.qmd

Lines changed: 7 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,35 @@
22

33
## About this document
44

5-
This document, accompanied by the [customized GitHub repository](https://github.com/computorg/template-computo-python/), provides a template for writing contributions to **Computo** [@computo]. We show how `Python` code can be included and how the repository can be set up for triggering GitHub actions for rendering the document, with dependencies handled by `venv` and `pip`.
5+
This document, accompanied by the [customized GitHub repository](https://github.com/computorg/template-computo-python/), provides a template for writing contributions to **Computo** [@computo].
66

7-
## Setup a GitHub repository for preparing your submission
8-
9-
You can start by clicking on the **"use this template"** button, on the top of the page of the [github repository associated with this document](https://github.com/computorg/template-computo-python/). Of course, you can set your repository private during the preparation of your manuscript.
7+
::: {.callout-tip}
8+
## Note
9+
This document provides only the key formatting principles. For a detailed, step-by-step guide on preparing your article and submitting it to Computo, please consult the [guidelines for authors](https://computo-journal.org/site/guidelines-authors.html).
10+
:::
1011

1112
## Quarto
1213

1314
[Quarto](https://quarto.org/) is a versatile formatting system for authoring documents integrating markdown, LaTeX and code blocks interpreted either via Jupyter or Knitr (thus supporting Python, R and Julia). It relies on the [Pandoc](https://pandoc.org/MANUAL.html) document converter.
1415

1516
## Requirements
1617

17-
You need [quarto](https://quarto.org/docs/get-started/) installed on your system and the [Computo extension](https://github.com/computorg/computo-quarto-extension) to prepare your document. For the latter, once quarto is installed, run the following to install the extension in the current directory (it creates an `_extension` directory which is ignored by git thanks to `.gitignore` by default):
18+
You need [quarto](https://quarto.org/) installed on your system and the [Computo extension](https://github.com/computorg/computo-quarto-extension) to prepare your document. For the latter, once quarto is installed, run the following to install the extension in the current directory (it creates a `_extension` directory which is ignored by git thanks to `.gitignore` by default):
1819

1920
```.bash
2021
quarto add computorg/computo-quarto-extension
2122
```
2223

2324
[`Python`](https://www.python.org/) and [`Jupyter`](https://jupyter.org/install) must be installed on your computer.
2425

25-
## Link with your usual tools
26-
27-
Quarto is expecting a `.qmd` markdown file, but will also works with a standard [Jupyter notebook](https://quarto.org/docs/get-started/hello/jupyter.html) file if you are used to it (it will just require to add the proper YAML metadata^[the same metadata as in the [`template-computo-python.qmd` file](https://github.com/computorg/template-computo-python/blob/main/template-computo-python.qmd) in the first cell, type "Raw", of the notebook]).
28-
29-
**Note**: _More advanced Jupyter-related functionality like Myst/Jupyter book are not supported in this Quarto setup. The markdown syntax inside the Jupyter notebook should follow the Quarto syntax (c.f. [below](#formatting)). If you are more comfortable with using Myst/Jupyter book, we provide a [specific template](https://github.com/computorg/template-computo-myst) but it will requires more formatting work for Computo editorial team, thus highly encourage authors to use the Quarto templates._
30-
3126
# Formatting
3227

3328
This section covers basic formatting guidelines for quarto documents.
3429

3530
To render a document, run `quarto render`. By default, both PDF and HTML documents are generated:
3631

3732
```.bash
38-
quarto render template-computo-python.qmd # renders both HTML and PDF
33+
quarto render # renders both HTML and PDF
3934
```
4035

4136
::: {.callout-tip}
@@ -196,83 +191,6 @@ Advanced formatting features are possible and documented (including interactive
196191

197192
:::
198193

199-
# Finalize your submission
200-
201-
## Handle `Python` dependencies with `venv`
202-
203-
To make your work reproducible, you need to fix the packages and environment used to run your analysis. For `Python`, `venv` is one of the possible reliable method, supported by the community. You basically need a couple of commands to setup your environment on your local machine. First, to create a new virtual environment in the directory `my_env`
204-
205-
``` .bash
206-
python3 -m venv my_env
207-
```
208-
209-
and activate it
210-
211-
``` .bash
212-
source my_env/bin/activate
213-
```
214-
215-
Then installed the packages required to perform your analysis. Here,
216-
217-
``` .bash
218-
python3 -m pip install jupyter matplotlib numpy
219-
```
220-
221-
Once you are all set up, you need to save your working environment into a file so that anyone can reproduce your analysis on their side:
222-
223-
``` .bash
224-
python3 -m pip freeze > requirements.txt
225-
```
226-
227-
The corresponding `requirements.txt` file [found in this repository](https://github.com/computorg/template-computo-python/blob/main/requirements.txt) is then
228-
229-
```{.bash filename="requirements.txt"}
230-
jupyter
231-
matplotlib
232-
numpy
233-
```
234-
235-
::: {.callout-important}
236-
`requirements.txt` is the only file that needs to be versioned by git.
237-
:::
238-
239-
More details for using `venv` and `pip` can be found on the [quarto page dedicated to environments](https://quarto.org/docs/projects/virtual-environments.html#using-venv).
240-
241-
### What about `conda`?
242-
243-
For `conda` users, it is also possible to follow the same path with your favorite version of `conda`. There is a [quarto page dedicated to the conda environments](https://quarto.org/docs/projects/virtual-environments.html#using-conda).
244-
245-
## Continuous integration
246-
247-
The repository associated with this template is pre-configured to trigger an action on push that performs the following:
248-
249-
1. Check out the repository on an `ubuntu-latest` machine
250-
2. Install quarto and dependencies, including the Computo extension
251-
3. Install Python (3.10) and dependencies with `venv`, using your `requirements.txt` file
252-
4. Render your .qmd file and Publish the results on a gh-page (both HTML and PDF)
253-
254-
The file [.github/workflows/build_n_publish.yml](https://github.com/computorg/template-computo-python/blob/main/.github/workflows/build_n_publish.yml) is largely inspired from [this file](https://quarto.org/docs/publishing/github-pages.html#example-jupyter-with-venv).
255-
256-
Once this is successful, you are ready to submit your manuscript to the [Computo submission platform](https://computo.scholasticahq.com/).
257-
258-
::: {.callout-warning}
259-
The first time, you possibly need to create the branch for the action to work. This can be done by running the following command from your computer, in your git repository:
260-
261-
```.bash
262-
quarto publish gh-pages
263-
```
264-
265-
Then, set the branch `gh-page` as the source of your github page, and trigger the action to check that everything works fine.
266-
:::
267-
268-
### What about CI and `conda`?
269-
270-
[The build and deploy process of our Computo quarto extension](https://github.com/computorg/computo-quarto-extension/blob/main/.github/workflows/build.yml) shows how `miniconda` can be set used in place of `venv`. The main striking difference is the use of a `environment.yml` file in place of `requirements.txt`.
271-
272-
## Data and large files
273-
274-
If your submission materials contain files larger than 50MB, **especially data files**, they won’t fit on a git repository as is. For this reason, we encourage you to put your data or any materials you deem necessary on an external “open data” centered repository hub such a [Zenodo](https://zenodo.org/) or [OSF](https://osf.io/).
275-
276194
# References {.unnumbered}
277195

278196
::: {#refs}

0 commit comments

Comments
 (0)