Skip to content

Commit aeeefbc

Browse files
docs: rewrite README and CONTRIBUTING with full usage guide
README.md: - Add uvx usage instructions - Document required GitHub token scopes (user + repo) - Add contributors section - Add Apache 2.0 license notice - Use emojis on all level-2 headers CONTRIBUTING.md: - Integrate TRANSLATIONS.md content (now deleted) - Document all poe dev commands (lint, lint:format, lint:types, test) - Add Conventional Commits reference table and examples - Add release cycle section (poe release, git push --tags) - Add pre-commit install instructions including commit-msg hook
1 parent aac0096 commit aeeefbc

2 files changed

Lines changed: 139 additions & 43 deletions

File tree

CONTRIBUTING.md

Lines changed: 115 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,138 @@
1-
# Developer Guide
1+
# 🛠️ Developer Guide
22

3-
This document will explain how to contribute to the edit-python.pe project.
3+
This document explains how to contribute to the edit-python.pe project, the commands needed for development, and the translation workflow.
44

5-
## How to Contribute
5+
## 🤝 How to Contribute
66

7-
1. Make sure to find an open issue on [GitHub](https://github.com/python.pe/edit-python.pe/issues).
8-
1. Fork the [edit-python.pe](https://github.com/python.pe/edit-python.pe) repository.
9-
1. Clone the forked repository to your local machine.
10-
1. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/).
11-
1. Install dependencies:
7+
1. Make sure to find an open issue on [GitHub](https://github.com/pythonpe/edit-python.pe/issues).
8+
2. Fork the [edit-python.pe](https://github.com/pythonpe/edit-python.pe) repository.
9+
3. Clone the forked repository to your local machine.
10+
4. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/).
11+
5. Install dependencies:
12+
```bash
13+
uv sync
14+
```
15+
6. Install the pre-commit hooks (enforces conventional commits and quality checks):
16+
```bash
17+
uv run pre-commit install --hook-type commit-msg
18+
uv run pre-commit install
19+
```
20+
7. Make your changes and cover them with tests.
21+
8. Push your changes to the forked repository.
22+
9. Open a pull request on [GitHub](https://github.com/pythonpe/edit-python.pe/pulls).
23+
24+
## 🚀 Development Commands
25+
26+
We use `poethepoet` (poe) as our task runner. Run the following commands as needed during development:
27+
28+
- `uv run poe lint`: Runs the `ruff` linter (and checks types using `ty`).
29+
- `uv run poe lint:format`: Formats the code using `ruff format`.
30+
- `uv run poe lint:types`: Checks types using `ty check`.
31+
- `uv run poe test`: Runs the test coverage with `pytest`.
32+
33+
## 📝 Commit Style (Conventional Commits)
34+
35+
This project enforces [Conventional Commits](https://www.conventionalcommits.org/) via a pre-commit hook powered by [Commitizen](https://commitizen-tools.github.io/commitizen/). Every commit message **must** follow this format:
36+
37+
```
38+
<type>(<optional scope>): <short description>
39+
```
40+
41+
Allowed types:
42+
43+
| Type | When to use |
44+
|------|-------------|
45+
| `feat` | A new feature |
46+
| `fix` | A bug fix |
47+
| `docs` | Documentation only changes |
48+
| `style` | Code style changes (formatting, missing semicolons, etc.) |
49+
| `refactor` | Code change that is neither a fix nor a feature |
50+
| `perf` | A code change that improves performance |
51+
| `test` | Adding or fixing tests |
52+
| `build` | Changes to build system or dependencies |
53+
| `ci` | Changes to CI configuration files and scripts |
54+
| `chore` | Other changes that don't modify source or test files |
55+
56+
**Examples:**
57+
```
58+
feat(auth): add GitHub OAuth login
59+
fix(markdown): handle missing homepage field gracefully
60+
docs: update README with uvx usage
61+
```
62+
63+
You can use `uv run cz commit` as an interactive guided commit helper instead of `git commit`.
64+
65+
## 🏷️ Release Cycle
66+
67+
Releases are managed by [Commitizen](https://commitizen-tools.github.io/commitizen/), which automatically:
68+
69+
- Determines the next semantic version from the commit history (`feat` → minor bump, `fix` → patch bump, `feat!` or `BREAKING CHANGE` → major bump).
70+
- Updates the version in `pyproject.toml` and `src/edit_python_pe/__version__.py`.
71+
- Generates or appends to `CHANGELOG.md`.
72+
- Creates a git tag `v<version>`.
73+
74+
### Performing a Release
75+
76+
> **Only maintainers** should run this command on the `main` branch.
1277
1378
```bash
14-
uv sync
79+
uv run poe release
1580
```
1681

17-
1. Install pre-commit hook:
82+
This runs `cz bump --changelog` under the hood. After the tag is created, push both the commit and the tag:
1883

1984
```bash
20-
uv run pre-commit install
85+
git push && git push --tags
2186
```
2287

23-
1. Make your changes.
24-
1. Cover your changes with tests.
25-
1. Run the test coverage:
88+
### Previewing the Changelog
89+
90+
To regenerate or preview the full changelog without bumping the version:
91+
92+
```bash
93+
uv run poe release:changelog
94+
```
95+
96+
## 🌐 Translation Workflow
97+
98+
This project uses `pybabel` for translations, completely managed through `poe` tasks. The translation files are packaged internally within `src/edit_python_pe/locale/` so they are automatically included in PyPI wheel distributions.
99+
100+
### 1. Generating or Updating `.po` files
101+
102+
When you add new `_("...")` strings in the source code, run:
103+
104+
```bash
105+
uv run poe messages:update
106+
```
107+
108+
This automatically extracts all translation strings from `src/edit_python_pe/` into `messages.pot` and **updates all existing locales** (e.g. `es`, `fr`, etc.) with the new strings, keeping existing translations intact.
109+
110+
If you only want to extract strings to `messages.pot` without updating the language files, run:
26111

27112
```bash
28-
uv run poe test
113+
uv run poe messages:extract
29114
```
30115

31-
1. Run the auto-translations:
116+
> **Note:** We have removed automated machine translation scripts. Automatic tools often miss context-specific terminology (for example, translating "Save" as "Ahorro" instead of "Guardar"). You **must** review the `.po` files one by one and translate them manually, ensuring the correct context for the application.
117+
118+
### 2. Compiling `.mo` files
119+
120+
After you finish manually translating the `.po` files, you must compile them into the binary `.mo` format so the application can read them.
32121

33122
```bash
34-
uv run poe makemessages
123+
uv run poe messages:compile
35124
```
36125

37-
1. Commit your changes, if the pre-commit hook fails, run `uv run poe test` to
38-
know which test failed.
39-
1. If the last step was your last commit on this issue, run this command:
126+
This command compiles all languages in the `locale` directory simultaneously.
127+
128+
---
129+
130+
### Adding a New Language
131+
132+
If you want to add an entirely new language (for example, German `de`), use the `messages:init` command:
40133

41134
```bash
42-
uv run poe version:update NEW_VERSION
135+
uv run poe messages:init --lang de
43136
```
44137

45-
1. Push your changes to the forked repository.
46-
1. Open a pull request on [GitHub](https://github.com/python.pe/edit-python.pe/pulls).
138+
This extracts the strings and initializes the completely new directory `src/edit_python_pe/locale/de/LC_MESSAGES/messages.po`.

README.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,44 @@
11
# edit-python.pe
22

3-
## *Textual Tool for Creating Member Profiles for python.pe*
3+
## 🚀 Textual Tool for Creating Member Profiles for python.pe
44

5-
This tutorial will guide you step-by-step to create your profile on python.pe
6-
quickly and securely.
5+
This tool will guide you step-by-step to create your profile on python.pe quickly and securely directly from your terminal!
76

8-
## Prerequisites
7+
## 📋 Prerequisites
8+
9+
To use `edit-python.pe`, ensure you have [`uv`](https://docs.astral.sh/uv/) installed:
910

1011
```bash
1112
# Check required versions
1213
uv --version # >= 0.8.11
1314
```
1415

15-
## Installing edit-python.pe
16+
## 💻 Usage
1617

17-
### Installing dependencies
18+
For users seeking maximum speed and ease, you can run the tool directly using `uvx` without explicitly installing or cloning the repository:
1819

1920
```bash
20-
uv sync
21+
uvx edit-python-pe
2122
```
2223

23-
### **Creating the access token**
24+
Next, you'll be prompted for your access token and then you can seamlessly edit your member profile.
2425

25-
1. Generate a [Personal access token
26-
(classic)](https://github.com/settings/tokens).
27-
1. Grant the scope: `public_repo`.
28-
1. Copy the token and keep it handy for the command below
26+
## 🔑 Creating the GitHub Access Token
2927

30-
### **For users seeking maximum speed**
28+
To interact with the repository and submit your profile, you will need a GitHub Personal Access Token.
3129

32-
```bash
33-
uvx edit-python-pe
34-
# Next you'll be prompted for your access token
35-
```
30+
1. Generate a [Personal access token (classic)](https://github.com/settings/tokens).
31+
2. **Required Scopes**: Grant the `user` and `repo` scopes.
32+
3. Copy the token and keep it handy.
33+
34+
## 🤝 Contribute
35+
36+
Read the [Developer Guide](https://github.com/pythonpe/edit-python.pe/blob/main/CONTRIBUTING.md) to learn how to set up the development environment, run tests, and contribute translations.
37+
38+
## ✨ Contributors
39+
40+
A huge thanks to all the [individuals who have contributed](https://github.com/pythonpe/edit-python.pe/graphs/contributors?all=1) to this project.
3641

37-
## Contribute
42+
## 📜 License
3843

39-
Read the [Developer
40-
Guide](https://github.com/pythonpe/edit-python.pe/blob/main/CONTRIBUTING.md)
44+
This project is open-sourced software licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). Copyright 2024 Python Perú. See the [LICENSE](LICENSE) file for more details.

0 commit comments

Comments
 (0)