# PyGitWeb: Project hosting with FastAPI and PyGit2

PyGitWeb and its bundled tools allow users to:
- Self-host git repositories (+ associated settings, permissions, and metadata)
- Manage projects and teams; built-in issues and kanban boards
- Assist with info security including code signing and secret scanning, plus much more with custom hooks.
- Use OAuth2 flows to allow secure authentication without forcing account creation.

PyGitTools, the core package of PyGitWeb, allows users to (without involving the web server):
- Script Python workflows with Tasks, Merge Requests, and Hooks within a repositories
- Setup hooks and actions; Actions are defined in configuration and can be used to 
- Use the bundled git terminal app (pgt) to quickly perform git actions and even manage tasks from the cli.

## Installation and Usage

To run with UV in bash _or_ powershell:
```bash
uv run --with pygitweb uvicorn pygitweb.main:app
```

By default, this will set up local authenication and generate an `admin` account with a randomly generated password.

If you are running locally with a firewall and NO reverse proxy or other risk of external traffic, you can run with auth disabled by setting `PYGITWEB_AUTH` falsy:

```bash
PYGITWEB_AUTH=0 uv run --with pygitweb uvicorn pygitweb.main:app
```

```powershell
$env:PYGITWEB_AUTH=0; uv run --with pygitweb uvicorn pygitweb.main:app
```

Furthermore, if you just want to evalute `pgt` (the terminal app for using git) without involving the web server, use the following command in a project folder:

```bash
uv tool install pygittools
pgt # run this from within a git repo dir
```

## Installation with Docker

(todo)

## Installation for Development

Clone the repo over smart-http:
```bash
git clone https://app.pygitweb.com/http/pygitweb;
cd pygitweb; uv sync --all-packages --all-groups;
uv run uvicorn pygitweb.main:app --reload
```

The pre-commit actions are defined in pyproject.toml, but effectively boil down to:

```bash
uv run ruff check --fix;
uv run ruff format --preview;
uv run mypy .;
uv run pytest .;
```

There are optional playwright tests triggerable with `uv run pytest . --playwright --js-tests`

To generate a coverage report, do

```bash
uv run coverage run -m pytest .;
uv run coverage html;
```