# PyGitWeb: Innovative yet simple project hosting

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 jobs to run on your machine, including server-side hooks for branch protection
- 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 --host 0.0.0.0 --port 8000
```

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 --host 0.0.0.0 --port 8000
```

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

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 run --with pygittools pgt
```

## 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 --host 0.0.0.0 --port 8000
```

Setting up your pre-commit hooks is recommended, but to manually run pre-commit checks, do:

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

There are some open mypy issues, but any pytest regressions are considered blocking.

To run tests and generate a coverage report, do

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