80 lines
2.9 KiB
Markdown
80 lines
2.9 KiB
Markdown
# Repo context for agents
|
|
|
|
## Remotes
|
|
|
|
| Name | URL | Purpose |
|
|
|---|---|---|
|
|
| `gitea` | `https://gitea.cap.nlogn.ir/fazel/spacy-fa-pipeline.git` | Primary self-hosted Gitea |
|
|
|
|
## Pushing to Gitea
|
|
|
|
Credentials come from `pass` — no token in git config or any tracked file.
|
|
|
|
**Pass path:** `gitea/token_AllExceptAdmin`
|
|
|
|
The credential helper is set locally in `.git/config` (never committed):
|
|
|
|
```
|
|
credential.https://gitea.cap.nlogn.ir.helper=
|
|
!f() { echo username=fazel; echo password=$(pass gitea/token_AllExceptAdmin); }; f
|
|
```
|
|
|
|
**Push command** (bypass proxy — Gitea is on the local network):
|
|
|
|
```bash
|
|
NO_PROXY="*" no_proxy="*" http_proxy="" https_proxy="" HTTP_PROXY="" HTTPS_PROXY="" \
|
|
git push gitea main
|
|
```
|
|
|
|
### If `pass` returns an empty string
|
|
|
|
The store is encrypted to `caci96@gmail.com`, whose secret key lives on an **OpenPGP
|
|
smartcard** (`gpg --list-secret-keys --with-colons` shows serial `D276000124010304…`). When
|
|
gpg-agent has no cached session and no pinentry can reach a terminal, `pass` blocks for ~60s
|
|
and exits with empty stdout — it does *not* error. A credential helper wired to it then fails
|
|
auth for no visible reason.
|
|
|
|
Diagnose, do not guess:
|
|
|
|
```bash
|
|
export GPG_TTY=$(tty)
|
|
gpg --batch --pinentry-mode error --decrypt ~/.password-store/gitea/token_AllExceptAdmin.gpg
|
|
```
|
|
|
|
Success means the agent is unlocked and `pass` will work. `Bad passphrase`/`No secret key`
|
|
means insert the smartcard, or `export GPG_TTY=$(tty)` and re-run `pass` once interactively to
|
|
satisfy pinentry.
|
|
|
|
The same token is mirrored in `rbw` at `api/gitea_token_AllExceptAdmin` (verified
|
|
byte-identical). It needs no smartcard, so it is the fallback when the card is unavailable:
|
|
|
|
```
|
|
!f() { echo username=fazel; echo password=$(rbw get "api/gitea_token_AllExceptAdmin" | head -1); }; f
|
|
```
|
|
|
|
To rotate: update in the Gitea UI, then `pass edit gitea/token_AllExceptAdmin` **and**
|
|
`rbw edit "api/gitea_token_AllExceptAdmin"` so the two stay in sync. No git config change.
|
|
|
|
## What is NOT committed
|
|
|
|
`.gitignore` excludes `assets/ corpus/ training/ metrics/ packages/ .venv/`. The repo holds
|
|
only source: configs, scripts, `project.yml`, docs. Everything else is regenerated:
|
|
|
|
```bash
|
|
python -m venv .venv && .venv/bin/python -m pip install -r requirements.txt
|
|
.venv/bin/python -m spacy project assets # checksummed downloads
|
|
.venv/bin/python -m spacy project run all # ~2h on 4 CPU cores
|
|
```
|
|
|
|
The trained wheel (13 MB) is a build artifact, not source. Publish it to the HF Hub instead —
|
|
see `docs/CONTRIBUTING-GUIDE.md` §2.
|
|
|
|
## Environment
|
|
|
|
The venv is Python 3.12.2, created from the conda env at `/home/fazel/anaconda3/envs/p12`
|
|
(the anaconda base python is 3.7 and cannot run spaCy 3.8). The IPython kernel available to
|
|
agents is bound to that 3.7 base and will fail on this project — shell out to `.venv/bin/python`.
|
|
|
|
GPU (GTX 940MX, 2 GB) is unused: too small for a transformer, not worth the transfer overhead
|
|
for an `sm` pipeline. All training is CPU, `--gpu-id -1`.
|