---
# System prepended metadata

title: PyDoc ZH-TW @PyConTW Sprints
tags: [pydoc-zhtw]

---

# PyDoc zh-tw @PyConTW Sprints

## Weblate Survey (Nick)
- Architecture
[Weblate] <----> [GitHub]
- Features surveyed
    1. **Set up Weblate using docker compose**
        Using official [docker-compose](https://docs.weblate.org/en/latest/admin/install/docker.html), set up `docker-compose.override.yaml` locally, and run `$ docker compose up -d`.
    2. **Create project and components**
    2. **Weblate sync with GitHub**
        By using webhook (`http[s]://<weblate-url>/webhook/github/`) privided by Weblate, Weblate can receive all events from GitHub immediately.
    3. **Update GitHub from Weblate**
        - Push commits
        - Make a new PR
            - https://docs.weblate.org/en/latest/admin/config.html#std-setting-GITHUB_CREDENTIALS
        :::warning
        It's recommended to set "repo push url" by **SSH** in component's version control setting.
        Because you need to provide user/password in HTTPS, but in SSH, you just need to copy-paste SSH public key on GitHub.
        :::
- To be done
    - How does Weblate handle git merge conflict?


## powrap auto-formatting (Lulu)
- Roadmap
    1. Prepare pre-commit config file for either pre-commit hook or github action to call. The pre-commit config file should use powrap to format the staged ".po" file(s).
    2. Add a GitHub action workflow to use pre-commit config file in CI pipeline.

- What I've done and problems I've faced
    Be able to trigger pre-commit config file and powrap staged ".po" file(s). However, the current method is to write long shell command in pre-commit file, which isn't good for maintenance. On the other hand, if there's no ".po" file to commit, pre-commit would fail. Needs to figure out another way to tackle this.


## OpenAI API Integration (Becca)
- Language Model
Test openAI CHATGPT API


## Makefile HTML build Improvement (方格子)

### What I knew before started

- build: Makefile of `python-docs-zh-tw` uses Makefile of `cpython`, and then call Sphinx build.
- The original target `all` in Makefile of `python-docs-zh-tw` converts **all** `*.po` files into html files.
- We need a target in Makefile to convert only **one** file a time.

### What have I modified?

- Add a new target `build/%` in Makefile of `python-docs-zh-tw`, the pattern should be changed later, since the pattern `build/%` looks like we want to convert some files in directory `build/`.
- It will check whether the file is exists, if not, it will show error message and then exit.
- In the parameter `SPHINXOPTS` given to Sphinx, I added parameter `SOURCES`, which is the specific file we want to convert.
- When calling Makefile of `cpython`, we use the target `html` instead of the original `autobuild-dev-html`.

### What problem I met？

- If we never run `make all` before, it will raise an exception said FileNotFoundError: No such file or directory: `cpython/Doc/build/html/searchindex.js`.

### TODO

- We should check the usage of these 2 paramters: `-D locale_dirs=locales -D language=$(LANGUAGE)`, whether should we remove them when convert single file?
- We should use `xargs -n1 dirname` to check if the file is in some directory, we should run `mkdir -p $(LC_MESSAGES)/$$dirname`.
- We should link file (run `ln -f $$file $(LC_MESSAGES)/$＊`).
- Then we can create a PR!