Skip to content

Simplify setup with uv #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: CI

on:
pull_request:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set Locale
run: |
sudo apt-get update && sudo apt-get install tzdata locales -y
sudo locale-gen es_ES.UTF-8
sudo localectl set-locale LANG="es_ES.UTF-8"
export LANG="es_ES.UTF-8"
export LANGUAGE="es_ES.UTF-8"
sudo update-locale
locale -a
locale
locale -c -k LC_NUMERIC
localectl status

- name: Install Dependencies
run: |
uv sync

- name: Build Blog
run: |
uv run ablog build
18 changes: 11 additions & 7 deletions .github/workflows/blog.yml → .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Blog to GitHub Pages
name: Deploy Python Perú's Blog to GitHub Pages

on:
push:
Expand All @@ -10,12 +10,13 @@ permissions:

jobs:
deploy:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set Locale
run: |
sudo apt-get update && sudo apt-get install tzdata locales -y && sudo locale-gen es_ES.UTF-8
Expand All @@ -27,12 +28,15 @@ jobs:
locale
locale -c -k LC_NUMERIC
localectl status

- name: Install Dependencies
run: |
pip install -r requirements.txt
uv sync

- name: Build Blog
run: |
ablog build
uv run ablog build

- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
# Python Peru's Blog


To build, make sure you have Python 3.12 installed. Then install `poetry`:
Install `uv`, follow the instructions in their documentation
https://docs.astral.sh/uv/getting-started/installation/, `uv` will handle all
the dependencies and the python installation as well. So we don't need to
install `python` separately.

```sh
pip install -U poetry
```

Then install all the necessary packages (make sure to change to the root directory of the project):
Then install all the necessary packages (make sure to change to the root
directory of the project):

```sh
poetry install
uv sync
```

You can build the html files of the blog by running the following command:

```sh
poetry run ablog build
uv run ablog build
```

Then you can serve the files locally using this command:
```sh
poetry run ablog serve
uv run ablog serve
```

## Notice

Any contribution you make should be placed in the `blog/` directory and you could choose between reStructuredText (.rst) or Markdown (.md).
Any contribution you make should be placed in the `blog/` directory and you
could choose between reStructuredText (.rst) or Markdown (.md).
19 changes: 11 additions & 8 deletions blog/como-redactar-posts.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,32 +164,31 @@ Español los posts.

### Instalación

1. Instalemos poetry:

```sh
pip install -U poetry
```
1. Instalamos `uv`, sigue las instrucciones en su documentación
https://docs.astral.sh/uv/getting-started/installation/, `uv` manejarátodas
las dependencias y también la instalación de python. De forma tal que no
necesitamos instalar `python` de manera separada.

2. Estando en la raíz del repositorio, instalemos las dependencias del Blog:

```sh
poetry install
uv sync
```

### Construcción de las Páginas HTML

Estando en la raíz del repositorio:

```sh
poetry run ablog build
uv run ablog build
```

### Ejecución del Blog

Estando en la raíz del repositorio:

```sh
poetry run ablog serve
uv run ablog serve
```

```{admonition} Nota
Expand Down Expand Up @@ -242,3 +241,7 @@ y luego seleccionando el tab "Pull Requests" como muestra en la imágen.
```{admonition} Nota
Nuevo post que explica como hacer lo mismo pero con forks [aquí](/blog/como-redactar-posts-con-fork.md)
```

```{admonition} Nota
Actualizado al 16/03/2025 para hacer uso de `uv` en lugar de `poetry`
```
1 change: 1 addition & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
"github_submodule/*",
"LICENSE.md",
"README.md",
".venv/*",
]

# The reST default role (used for this markup: `text`) to use for all
Expand Down
1,714 changes: 0 additions & 1,714 deletions poetry.lock

This file was deleted.

47 changes: 22 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
[tool.poetry]
[project]
authors = [
{name = "Ider Delzo", email = "[email protected]"},
{name = "Jean-Pierre Chauvel", email = "[email protected]"},
]
license = {text = "Apache License, Version 2.0"}
requires-python = "<4.0,>=3.13"
dependencies = [
"Sphinx<8.0.0,>=7.2.6",
"ablog<1.0.0,>=0.11.6",
"pydata-sphinx-theme<1.0.0,>=0.15.2",
"myst-parser[linkify]<3.0.0,>=2.0.0",
"sphinxcontrib-youtube<2.0.0,>=1.4.1",
"sphinx-sitemap<3.0.0,>=2.5.1",
"sphinxext-opengraph<1.0.0,>=0.9.1",
"matplotlib<4.0.0,>=3.8.4",
]
name = "pythonpe-blog"
version = "0.1.0"
description = ""
authors = ["Ider Delzo <[email protected]>", "Jean-Pierre Chauvel <[email protected]>"]
license = "Apache License, Version 2.0"
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.13"
Sphinx = "^7.2.6"
ablog = "^0.11.6"
pydata-sphinx-theme = "^0.15.2"
myst-parser = {extras = ["linkify"], version = "^2.0.0"}
sphinxcontrib-youtube = "^1.4.1"
sphinx-sitemap = "^2.5.1"
sphinxext-opengraph = "^0.9.1"
matplotlib = "^3.8.4"


[tool.poetry.group.dev.dependencies]
isort = "^6.0.1"
black = "^25.1.0"

[tool.poetry.requires-plugins]
poetry-plugin-export = ">=1.8"
[dependency-groups]
dev = [
"isort<7.0.0,>=6.0.1",
"black<26.0.0,>=25.1.0",
]

[tool.black]
line-length = 79

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Loading