Skip to content

Commit 10d2c43

Browse files
committed
feat: migrate blog posts from ipynb/md to qmd format
- Update conda/dev.yaml for quarto support - Update .makim.yaml to render qmd to md in pipeline - Add scripts/convert-blog-posts-to-qmd.py - Update CONTRIBUTING.md with qmd-first workflow Fixes #255
1 parent 0ade98c commit 10d2c43

32 files changed

Lines changed: 5961 additions & 13 deletions

File tree

.makim.yaml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,27 @@ groups:
66
backend: bash
77
run: |
88
mkdir -p build
9-
# Directory to search for .ipynb files
9+
# Directory to search for blog sources
1010
export SEARCH_DIR="pages/blog"
1111
12-
# Find all .ipynb files, excluding .ipynb_checkpoints,
13-
# and convert them to Markdown named 'index.md'
12+
# 1) Convert legacy .ipynb posts to Markdown (for now)
13+
# This keeps existing notebook-based posts working while we
14+
# migrate everything to Quarto.
1415
find "$SEARCH_DIR" -path "*/.ipynb_checkpoints/*" -prune -o -name \
1516
"*.ipynb" -exec sh -c \
1617
'jupyter nbconvert --to markdown --template=theme/custom-markdown.tpl --output-dir "$(dirname "$0")" --output "index" "$0"' {} \;
1718
18-
# remove console colors from md files
19+
# 2) Convert .qmd blog posts to Markdown using Quarto
20+
# This allows us to use .qmd as the single canonical format
21+
# while still feeding Markdown into MkDocs.
22+
if command -v quarto >/dev/null 2>&1; then
23+
find "$SEARCH_DIR" -name "*.qmd" -exec sh -c \
24+
'quarto render "$0" --to gfm --output "$(dirname "$0")/$(basename "$0" .qmd).md"' {} \;
25+
else
26+
echo "[WW] Quarto is not available on PATH; .qmd files will not be rendered."
27+
fi
28+
29+
# 3) Remove console colors from generated md files
1930
find "$SEARCH_DIR" -name \
2031
"index.md" -exec sh -c \
2132
'cat "$(dirname "$0")/index.md" | python scripts/clean-output.py > "$(dirname "$0")/temp_index.md" && mv "$(dirname "$0")/temp_index.md" "$(dirname "$0")/index.md"' {} \;

CONTRIBUTING.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,22 @@ dependencies and activate it.
4242

4343
### Creating a New Blog Post
4444

45-
1. **Prepare the Blog Post:**
45+
1. **Prepare the Blog Post (Quarto-first workflow):**
4646

4747
- Navigate to `pages/blog` and create a new folder with a slugified version
4848
of your blog post's title. Use
4949
[https://slugify.online/](https://slugify.online/) to generate a slug.
50-
- Inside this folder, create your blog post file:
51-
- For Markdown: `index.md`
52-
- For Jupyter Notebooks: `index.ipynb` (use Jupyter Lab to create this
53-
directly)
50+
- Inside this folder, create your blog post as a **Quarto document**:
51+
- `index.qmd`
5452

5553
2. **Include a Header Image:**
5654
- Place a header image (either `header.png` or `header.jpg`) in your blog
5755
post folder. Make sure the image is under a free license.
5856

5957
### Metadata and Formatting
6058

61-
- **Markdown Posts:** Add a metadata block at the beginning of your `index.md`
62-
file:
59+
- **Quarto (`.qmd`) Posts:** Add a metadata block at the beginning of your
60+
`index.qmd` file:
6361

6462
```markdown
6563
---
@@ -75,8 +73,21 @@ dependencies and activate it.
7573
---
7674
```
7775

78-
- **Jupyter Notebook Posts:** The first cell of your `index.ipynb` should be in
79-
`raw` mode containing the same metadata as above.
76+
The body of the file uses standard Markdown plus any Quarto features you
77+
need (code chunks, figures, etc.). During the build, `makim pages.build`
78+
will render `index.qmd` to `index.md` using Quarto so that MkDocs can
79+
consume the generated Markdown.
80+
81+
- **Legacy Jupyter Notebook Posts (optional / for migration only):**
82+
Existing posts may still be stored as `index.ipynb`. To migrate them to
83+
Quarto, run:
84+
85+
```bash
86+
python scripts/convert-blog-posts-to-qmd.py
87+
```
88+
89+
This will generate corresponding `index.qmd` files, which you can then edit
90+
directly. New posts should **not** be authored as notebooks; prefer `.qmd`.
8091

8192
3. **Building and Viewing:**
8293
- If using a Jupyter Notebook, run `makim pages.build` to convert the
@@ -89,6 +100,8 @@ dependencies and activate it.
89100
Before submitting your blog post:
90101

91102
- Ensure all files are added to your repository.
103+
- For new or migrated posts, confirm that `index.qmd` exists and that
104+
`makim pages.build` successfully generates the corresponding `index.md`.
92105
- Submit a pull request to the main `opensciencelabs.github.io` repository for
93106
review.
94107

conda/dev.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ dependencies:
77
- pip
88
- poetry
99
- nodejs
10+
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
---
2+
title: "ArtBox: What is it and how to collaborate?"
3+
slug: artbox-what-is-it-how-to-collaborete
4+
date: 2024-04-02
5+
authors: ["Daniela Iglesias Rocabado"]
6+
tags: [open-source, art, python, multimedia processing]
7+
categories: [python]
8+
description: |
9+
ArtBox is a tool set for handling multimedia files with a bunch of useful functions.
10+
thumbnail: "/header.jpg"
11+
template: "blog-post.html"
12+
---
13+
# How to use it?
14+
15+
## What is ArtBox?
16+
17+
ArtBox is a versatile tool set designed for efficient multimedia file handling, offering a range of valuable functions to enhance your multimedia processing experience.
18+
19+
20+
Key features of ArtBox include capabilities for text-to-audio conversion, YouTube video downloading, musical composition from notes, audio removal from video clips, audio extraction, and merging audio with video files. These functionalities position ArtBox as a pivotal tool for multimedia enthusiasts, content creators, and anyone in need of efficient multimedia processing solutions.
21+
22+
23+
### Installation
24+
25+
ArtBox relies on certain dependencies that may not function optimally on your machine. To ensure a smooth installation process, it is recommended to create a conda/mamba environment and install ArtBox within that environment.
26+
27+
```bash
28+
$ mamba create --name artbox "python>=3.8.1,<3.12" pygobject pip
29+
```
30+
31+
The command is creating a conda environment named "artbox" with Python version 3.8.1 or later, and includes the pygobject and pip packages in the environment. This is useful for setting up an isolated environment for a specific project or application, ensuring compatibility and reproducibility of the software stack.
32+
33+
```bash
34+
$ conda activate artbox
35+
```
36+
37+
To prevent dependency conflicts, please install the numpy library using the following command:
38+
39+
```bash
40+
$ pip install "numpy>=1.20"
41+
```
42+
43+
The `conda activate artbox` command is used to activate the "artbox" conda environment, ensuring that subsequent commands or scripts run within this isolated environment. Activation modifies the system's `PATH` to prioritize the "artbox" environment, allowing for the use of specific Python versions and packages associated with the project, thus maintaining a clean and reproducible development or execution environment.
44+
45+
46+
```python
47+
$ !mamba install -q -y -c conda-forge pygobject pip
48+
```
49+
50+
51+
```python
52+
$ !pip install -q artbox
53+
```
54+
55+
The `pip install artbox` command is used to install the Python package named "artbox" using the pip package manager. This command fetches the "artbox" package from the Python Package Index (PyPI) and installs it into the currently active Python environment. The `pip install` command is commonly used to add external packages or libraries to a Python environment, expanding its functionality for a particular project or application.
56+
57+
## Examples of Artbox usage.
58+
For the following examples, create the a temporary folder for artbox:
59+
60+
61+
```python
62+
$ mkdir /tmp/artbox
63+
```
64+
65+
### Convert text to audio
66+
67+
By default, the `artbox voice` uses
68+
[`edge-tts`](https://pypi.org/project/edge-tts/) engine, but you can also
69+
specify [`gtts`](https://github.com/pndurette/gTTS) with the flag
70+
`--engine gtts`.
71+
72+
73+
```python
74+
$ echo "Are you ready to join Link and Zelda in fighting off this unprecedented threat to Hyrule?" > /tmp/artbox/text.md
75+
$ artbox speech from-text \
76+
--title artbox \
77+
--input-path /tmp/artbox/text.md \
78+
--output-path /tmp/artbox/speech.mp3 \
79+
--engine edge-tts
80+
```
81+
82+
If you need to generate the audio for different language, you can use the flag
83+
`--lang`:
84+
85+
86+
```python
87+
$ echo "Bom dia, mundo!" > /tmp/artbox/text.md
88+
$ artbox speech from-text \
89+
--title artbox \
90+
--input-path /tmp/artbox/text.md \
91+
--output-path /tmp/artbox/speech.mp3 \
92+
--lang pt
93+
```
94+
95+
If you are using `edge-tts` engine (the default one), you can also specify the
96+
locale for the language, for example:
97+
98+
99+
```python
100+
$ echo "Are you ready to join Link and Zelda in fighting off this unprecedented threat to Hyrule?" > /tmp/artbox/text.md
101+
$ artbox speech from-text \
102+
--title artbox \
103+
--input-path /tmp/artbox/text.md \
104+
--output-path /tmp/artbox/speech.mp3 \
105+
--engine edge-tts \
106+
--lang en-IN
107+
```
108+
109+
Additionally, if you are using edge-tts, you can specify `--rate`, `--volume`, and `--pitch`, for example:
110+
111+
112+
```python
113+
$ echo "Do you want some coffee?" > /tmp/artbox/text.md
114+
$ artbox speech from-text \
115+
--title artbox \
116+
--input-path /tmp/artbox/text.md \
117+
--output-path /tmp/artbox/speech.mp3 \
118+
--engine edge-tts \
119+
--lang en \
120+
--rate +10% \
121+
--volume -10% \
122+
--pitch -5Hz
123+
```
124+
125+
### Convert audio to text
126+
ArtBox uses `speechrecognition` to convert from audio to text. Currently, ArtBox just support the google engine.
127+
128+
For this example, let's first create our audio:
129+
130+
131+
```python
132+
$ echo "Are you ready to join Link and Zelda in fighting off this unprecedented threat to Hyrule?" > /tmp/artbox/text.md
133+
$ artbox speech from-text \
134+
--title artbox \
135+
--input-path /tmp/artbox/text.md \
136+
--output-path /tmp/artbox/speech.mp3 \
137+
--engine edge-tts
138+
```
139+
140+
Now we can convert it back to text:
141+
142+
143+
```python
144+
$ artbox speech to-text \
145+
--input-path /tmp/artbox/speech.mp3 \
146+
--output-path /tmp/artbox/text-from-speech.md \
147+
--lang en
148+
```
149+
150+
### Download a youtube video
151+
152+
If you want to download videos from the youtube, you can use the following
153+
command:
154+
155+
156+
```python
157+
$ artbox youtube download \
158+
--url https://www.youtube.com/watch?v=zw47_q9wbBE \
159+
--output-path /tmp/artbox/
160+
```
161+
162+
The command above downloads the video using a random resolution. If you want a specific resolution, use the flat `--resolution`:
163+
164+
165+
```python
166+
$ artbox youtube download \
167+
--url https://www.youtube.com/watch?v=zw47_q9wbBE \
168+
--output-path /tmp/artbox/ \
169+
--resolution 360p
170+
```
171+
172+
### Remove the audio from a video
173+
174+
First, download the youtube video `https://www.youtube.com/watch?v=zw47_q9wbBE`, as explained before.
175+
176+
Next, run the following command:
177+
178+
179+
```python
180+
$ artbox video remove-audio \
181+
--input-path "/tmp/artbox/The Legend of Zelda Breath of the Wild - Nintendo Switch Presentation 2017 Trailer.mp4" \
182+
--output-path /tmp/artbox/botw.mp4
183+
```
184+
185+
### Extract the audio from a video
186+
187+
First, download the youtube video `https://www.youtube.com/watch?v=zw47_q9wbBE`,
188+
as explained before.
189+
190+
Next, run the following command:
191+
192+
193+
```python
194+
$ artbox video extract-audio \
195+
--input-path "/tmp/artbox/The Legend of Zelda Breath of the Wild - Nintendo Switch Presentation 2017 Trailer.mp4" \
196+
--output-path /tmp/artbox/botw-audio.mp3
197+
```
198+
199+
### Combine audio and video files
200+
201+
First, execute the previous steps:
202+
203+
- Download a youtube video
204+
- Remove the audio from a video
205+
- Extract the audio from a video
206+
207+
Next, run the following command:
208+
209+
210+
```python
211+
$ artbox video combine-video-and-audio \
212+
--video-path /tmp/artbox/botw.mp4 \
213+
--audio-path /tmp/artbox/botw-audio.mp3 \
214+
--output-path /tmp/artbox/botw-combined.mp4
215+
```
216+
217+
## Additional dependencies
218+
219+
If you want to use Python to play your audio files, you can install `playsound`:
220+
221+
222+
```python
223+
$ pip wheel --use-pep517 "playsound (==1.3.0)"
224+
```
225+
226+
### Demo Video
227+
228+
For a better explanation of the facilities and usage, please watch to the following video.
229+
230+
<iframe width="560" height="315" src="https://www.youtube.com/embed/sITnMuZTNAw?si=goPrd2BhPxy7Fqku" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: "Implementaciones recientes en SciCookie gracias a la subvención de la PSF"
3+
slug: avances-scicookie-grant-2024
4+
date: 2024-06-21
5+
authors: ["Yurely Camacho"]
6+
tags: [psf, osl, scicookie, subvención, grant, comunidad, colaboración, desarrollo]
7+
categories: [código abierto, desarrollo de software, python]
8+
description: |
9+
Descripción de las mejoras y tareas realizadas en SciCookie gracias a la subvención de la PSF.
10+
thumbnail: "/header.png"
11+
template: "blog-post.html"
12+
---
13+
14+
Como mencionamos en el post anterior [SciCookie recibe nueva subvención de PSF para mejoras y crecimiento](https://opensciencelabs.org/blog/scicookie-recibe-nueva-subvencion-de-psf-para-mejoras-crecimiento/), en enero de 2024 la PSF aprobó nuestra solicitud de subvención. Esto nos ha permitido implementar una serie de mejoras significativas en SciCookie. A continuación, presentamos los avances y tareas realizadas.
15+
16+
<!-- TEASER_END -->
17+
18+
Se han incorporado nuevas opciones de herramientas a la plantilla, incluyendo los códigos de conducta (CoC) de Python (adaptado) y de NumFOCUS. También se ha añadido soporte para prettier como una opción de linter, proporcionando más flexibilidad a los usuarios.
19+
20+
![Nuevas opciones de CoC](scr1.png)
21+
22+
En cuanto a la estructura de la herramienta, se han realizado varias optimizaciones. Se implementó una opción condicional para las preguntas de uso de herramientas en el proyecto (`depends_on`) y se corrigió la indentación en algunos archivos de configuración para mejorar la legibilidad. Además, se unificaron estos archivos según las distintas opciones de sistemas de construcción (*build systems*) para evitar la repetición innecesaria de código y texto. También se creó un ejemplo para la opción de Interfaz de línea de comandos (CLI) como base del contenido de ese archivo.
23+
24+
En el ámbito de la documentación, se ha automatizado el proceso de mover archivos de configuración a la raíz del proyecto, manteniendo una estructura ordenada. La selección del motor de documentación sphinx se ha dividido en `sphinx-rst` y `sphinx-md(myst)` para ofrecer opciones específicas. Se ha generado la documentación de la API para estas opciones, añadido `quarto` como un motor de documentación adicional, y se han incorporado distintos temas para cada motor de documentación disponible en la plantilla.
25+
26+
![Nuevas opciones de documentación](scr2.png)
27+
28+
Se ha iniciado comunicación con Leah Wasser, directora ejecutiva de pyOpenSci, quien ha revisado directamente el uso de SciCookie para las necesidades de pyOpenSci como plantilla de proyectos para recomendar a su comunidad. A partir de sus revisiones y sugerencias, se ha mejorado SciCookie para cumplir con sus principales expectativas. Leah también ha comenzado la creación de un perfil (conjunto de configuraciones por defecto) específico para pyOpenSci en [SciCookie](https://github.com/osl-incubator/scicookie/pull/273). Debido a sus prioridades y cronograma, este trabajo aún está en progreso.
29+
30+
Con estos avances, SciCookie se presenta como una herramienta más completa y adaptable a diversas necesidades. Continuaremos trabajando para ofrecer mejoras a la comunidad de código abierto.
31+
32+
Puedes consultar nuestro post [Collaborating and learning from SciCookie](https://opensciencelabs.org/blog/scicookie-collaborating-and-learning/) para más información sobre la herramienta.
33+
34+
Mantente atento a futuras actualizaciones sobre SciCookie en próximos posts.
35+
36+
Elementos gráficos de la portada fueron extraídos de [Job illustrations by Storyset](https://storyset.com/job)

0 commit comments

Comments
 (0)