Compare commits
6 Commits
hugo
...
1d1f044d80
Author | SHA1 | Date | |
---|---|---|---|
|
1d1f044d80 | ||
|
6fe36b0d96 | ||
|
746dc01428 | ||
|
2c7eb133a9 | ||
|
50b6c6995e | ||
|
ede9c79ad2 |
1
.gitignore
vendored
@@ -5,3 +5,4 @@ cache
|
|||||||
output
|
output
|
||||||
*.pid
|
*.pid
|
||||||
*.pyc
|
*.pyc
|
||||||
|
_gen
|
||||||
|
71
README.md
@@ -1,69 +1,4 @@
|
|||||||
<img align="right" width="150" alt="logo" src="https://user-images.githubusercontent.com/5889006/190859553-5b229b4f-c476-4cbd-928f-890f5265ca4c.png">
|
My personal website.
|
||||||
|
|
||||||
# Hugo Theme Stack Starter Template
|
As of 2025, it is buitl with Hugo and [Hugo theme Stack](https://github.com/CaiJimmy/hugo-theme-stack).
|
||||||
|
Based on [Hugo Theme Stack Starter](https://github.com/CaiJimmy/hugo-theme-stack-starter/).
|
||||||
This is a quick start template for [Hugo theme Stack](https://github.com/CaiJimmy/hugo-theme-stack). It uses [Hugo modules](https://gohugo.io/hugo-modules/) feature to load the theme.
|
|
||||||
|
|
||||||
It comes with a basic theme structure and configuration. GitHub action has been set up to deploy the theme to a public GitHub page automatically. Also, there's a cron job to update the theme automatically everyday.
|
|
||||||
|
|
||||||
## Get started
|
|
||||||
|
|
||||||
1. Click *Use this template*, and create your repository as `<username>.github.io` on GitHub.
|
|
||||||

|
|
||||||
|
|
||||||
2. Once the repository is created, create a GitHub codespace associated with it.
|
|
||||||

|
|
||||||
|
|
||||||
3. And voila! You're ready to go. The codespace has been configured with the latest version of Hugo extended, just run `hugo server` in the terminal and see your new site in action.
|
|
||||||
|
|
||||||
4. Check `config` folder for the configuration files. You can edit them to suit your needs. Make sure to update the `baseurl` property in `config/_default/config.toml` to your site's URL.
|
|
||||||
|
|
||||||
5. Open Settings -> Pages. Change the build branch from `master` to `gh-pages`.
|
|
||||||

|
|
||||||
|
|
||||||
6. Once you're done editing the site, just commit it and push it. GitHub action will deploy the site automatically to GitHub page asociated with the repository.
|
|
||||||

|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
In case you don't want to use GitHub codespace, you can also run this template in your local machine. **You need to install Git, Go and Hugo extended locally.**
|
|
||||||
|
|
||||||
## Update theme manually
|
|
||||||
|
|
||||||
Run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
hugo mod get -u github.com/CaiJimmy/hugo-theme-stack/v3
|
|
||||||
hugo mod tidy
|
|
||||||
```
|
|
||||||
|
|
||||||
> This starter template has been configured with `v3` version of theme. Due to the limitation of Go module, once the `v4` or up version of theme is released, you need to update the theme manually. (Modifying `config/module.toml` file)
|
|
||||||
|
|
||||||
## Deploy to another static page hostings
|
|
||||||
|
|
||||||
If you want to build this site using another static page hosting, you need to make sure they have Go installed in the machine.
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Vercel</summary>
|
|
||||||
|
|
||||||
You need to overwrite build command to install manually Go:
|
|
||||||
|
|
||||||
```
|
|
||||||
amazon-linux-extras install golang1.11 && hugo --gc --minify
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
If you are using Node.js 20, you need to overwrite the install command to install manually Go:
|
|
||||||
|
|
||||||
```
|
|
||||||
dnf install -y golang
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
Make sure also to specify Hugo version in the environment variable `HUGO_VERSION` (Use the latest version of Hugo extended):
|
|
||||||
|
|
||||||

|
|
||||||
</details>
|
|
||||||
|
Before Width: | Height: | Size: 256 KiB After Width: | Height: | Size: 181 KiB |
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Emacs
|
title: Emacs
|
||||||
description: Configuration files and tricks for emacs
|
description: Configuration files and tricks for emacs
|
||||||
|
image: "img/emacs.png"
|
||||||
tags:
|
tags:
|
||||||
- emacs
|
- emacs
|
||||||
- org
|
- org
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
title: Linux
|
title: Linux
|
||||||
author: "Fernando Sánchez"
|
author: "Fernando Sánchez"
|
||||||
description: Tips and tricks for GNU/Linux and Unix
|
description: Tips and tricks for GNU/Linux and Unix
|
||||||
|
image: "img/linux.png"
|
||||||
categories:
|
categories:
|
||||||
- linux
|
- linux
|
||||||
tags:
|
tags:
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Python
|
title: Python
|
||||||
description: Tips and useful libraries for python developers
|
description: Tips and useful libraries for python developers
|
||||||
|
image: "img/python.png"
|
||||||
categories:
|
categories:
|
||||||
- programming
|
- programming
|
||||||
tags:
|
tags:
|
||||||
@@ -19,3 +20,19 @@ From tqdm's github repository:
|
|||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## Tools
|
||||||
|
|
||||||
|
### [uv](https://github.com/astral-sh/uv)
|
||||||
|
|
||||||
|
🚀 A single tool to replace pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more.
|
||||||
|
⚡️ 10-100x faster than pip.
|
||||||
|
* Provides comprehensive project management, with a universal lockfile.
|
||||||
|
* Runs scripts, with support for inline dependency metadata.
|
||||||
|
* Installs and manages Python versions.
|
||||||
|
* Runs and installs tools published as Python packages.
|
||||||
|
* Includes a pip-compatible interface for a performance boost with a familiar CLI.
|
||||||
|
* Supports Cargo-style workspaces for scalable projects.
|
||||||
|
* Disk-space efficient, with a global cache for dependency deduplication.
|
||||||
|
* Installable without Rust or Python via curl or pip.
|
||||||
|
* Supports macOS, Linux, and Windows.
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Raspberry Pi
|
title: Raspberry Pi
|
||||||
description: Tools, links and configuration for your Raspberry Pi
|
description: Tools, links and configuration for your Raspberry Pi
|
||||||
|
image: img/rpi.png
|
||||||
tags:
|
tags:
|
||||||
- rpi
|
- rpi
|
||||||
---
|
---
|
||||||
|
@@ -54,7 +54,7 @@ Try it with:
|
|||||||
uwsgi --socket 127.0.0.1:8888 -w wsgi:application
|
uwsgi --socket 127.0.0.1:8888 -w wsgi:application
|
||||||
```
|
```
|
||||||
|
|
||||||
### Extra: Supervisor
|
## Extra: Supervisor
|
||||||
|
|
||||||
If everything went as expected, you can wrap your command in a
|
If everything went as expected, you can wrap your command in a
|
||||||
supervisor config file and let it handle the server for you.
|
supervisor config file and let it handle the server for you.
|
||||||
|
115
content/post/2025-uv.md
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
---
|
||||||
|
title: "uv - One rust tool to rule all pythons"
|
||||||
|
description:
|
||||||
|
date: 2025-02-17T23:02:47+01:00
|
||||||
|
image:
|
||||||
|
math:
|
||||||
|
license:
|
||||||
|
hidden: false
|
||||||
|
draft: false
|
||||||
|
image: img/uv.png
|
||||||
|
categories:
|
||||||
|
- Programming
|
||||||
|
tags:
|
||||||
|
- python
|
||||||
|
---
|
||||||
|
|
||||||
|
Long story short: I'm now using [uv](https://github.com/astral-sh/uv), and so should you.
|
||||||
|
It is a great replacement for pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more.
|
||||||
|
|
||||||
|
<!--more-->
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
For years, my strategy to manage python projects has been a mix of a custom `setup.py`, several hand-crafted `requirements.txt` files (through `pip freeze`), a custom virtualenv per project, and multiple tools to upload to PyPI.
|
||||||
|
Although this works, this setup has many drawbacks:
|
||||||
|
|
||||||
|
- It requires user intervention (creating a venv, sourcing it, handling new deps). This isn't ideal if you want new (probably inexperienced) users to use your projects.
|
||||||
|
- On a similar note, the whole process needs to be well documented if you want other users to contribute or maintain the code.
|
||||||
|
- Pinning dependency versions is finicky, and I've run into problems beause of that.
|
||||||
|
- Creating a new project involves a template, or copying files from an older project.
|
||||||
|
|
||||||
|
Of course, this is nothing new.
|
||||||
|
There is a whole site dedicated to [packaging your Python project](https://packaging.python.org/en/latest/).
|
||||||
|
A plethora of different projects have come and go, with varying degrees of success.
|
||||||
|
|
||||||
|
## Alternatives (poetry)
|
||||||
|
|
||||||
|
About a year before trying `uv`, I tried to catch up with the ecosystem and get to know the `blessed new way`.
|
||||||
|
However, the task proved to be a little more difficult, as the landscape is filled with a myriad of alternatives, each with their own set of drawbacks and detractors.
|
||||||
|
Packaging has historically been a weak spot, in ironical contradiction to the Zen of Python's "There should be one-- and preferably only one --obvious way to do it",
|
||||||
|
|
||||||
|
I eventually settled on [poetry](https://python-poetry.org/).
|
||||||
|
Mostly because it seemed like the most popular alternative.
|
||||||
|
|
||||||
|
There are many things I liked about it.
|
||||||
|
First of all, having a convention for dependencies (`pyproject.toml`) and a tool that properly handles them was nice.
|
||||||
|
It also removed the need to remember specific incantations to build and publish my Python projects.
|
||||||
|
Lastly, I mixed it `poetry2nix` to create reproducible python environments using nix.
|
||||||
|
This makes for a very powerful experience.
|
||||||
|
|
||||||
|
However, there were multiple hiccups.
|
||||||
|
First of all, it took me some time to figure out which specific fields to use (each tool can define ad-hoc properties in a the `pyproject.toml` file), and some of them seemed redundant with the more generic ones.
|
||||||
|
Full disclosure, this specific point might be a mistake on my side, and I do not remember the details.
|
||||||
|
The second one is speed.
|
||||||
|
(Re-)creating an environment took a non-negligible amount of time.
|
||||||
|
|
||||||
|
## Enter ~light~ `uv`
|
||||||
|
|
||||||
|
According to its repository, `uv `can replace pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more.
|
||||||
|
Not only that, but it also claims to do that 10-100 times faster than pip.
|
||||||
|
I must admit that it being written in rust was a another selling point for me, as I'm looking for excuses to collaborate in a decently-sized rust projejct.
|
||||||
|
|
||||||
|
Installing it is dead simple: simply download the binary (e.g., with curl) or run `pip install uv`.
|
||||||
|
You won't need much more: `uv` seems to just do the right thing out of the box.
|
||||||
|
And it does it really, really fast.
|
||||||
|
The rest of the time it gets out of the way.
|
||||||
|
|
||||||
|
My only gripe so far is that I don't seem to find a built-in command to drop into a shell, but that is nothing that `uv run $SHELL` cannot fix.
|
||||||
|
|
||||||
|
|
||||||
|
## Common operations
|
||||||
|
### Initialize a repository
|
||||||
|
|
||||||
|
```
|
||||||
|
uv init
|
||||||
|
```
|
||||||
|
### Adding dependencies
|
||||||
|
|
||||||
|
```
|
||||||
|
uv add senpy
|
||||||
|
```
|
||||||
|
|
||||||
|
### Running commands inside the environment
|
||||||
|
|
||||||
|
```
|
||||||
|
uv run <COMMAND>
|
||||||
|
|
||||||
|
# e.g., run a shell using your python version and dependencies
|
||||||
|
uv run $SHELL
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Dependency tree
|
||||||
|
|
||||||
|
```
|
||||||
|
uv shell
|
||||||
|
Resolved 44 packages in 1ms
|
||||||
|
my-project v0.1.0
|
||||||
|
├── fastapi[standard] v0.115.8
|
||||||
|
│ ├── pydantic v2.10.6
|
||||||
|
│ │ ├── annotated-types v0.7.0
|
||||||
|
│ │ ├── pydantic-core v2.27.2
|
||||||
|
│ │ │ └── typing-extensions v4.12.2
|
||||||
|
│ │ └── typing-extensions v4.12.2
|
||||||
|
│ ├── starlette v0.45.3
|
||||||
|
│ │ └── anyio v4.8.0
|
||||||
|
│ │ ├── exceptiongroup v1.2.2
|
||||||
|
│ │ ├── idna v3.10
|
||||||
|
│ │ ├── sniffio v1.3.1
|
||||||
|
│ │ └── typing-extensions v4.12.2
|
||||||
|
│ ├── typing-extensions v4.12.2
|
||||||
|
│ ├── email-validator v2.2.0 (extra: standard)
|
||||||
|
│ │ ├── dnspython v2.7.0
|
||||||
|
...
|
||||||
|
```
|
BIN
static/img/emacs.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
static/img/linux.png
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
static/img/python.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
static/img/rpi.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
static/img/uv.png
Normal file
After Width: | Height: | Size: 59 KiB |