jaepeto 0.5.0
API interface for generating documentation for Python projects

# Automated Documentation

This project is in a private beta.
for more information on using the tool,
to provide feedback,
or request access for a friend or colleague,
contact the beta runners.
**N.b.** this project calls an AWS API
with snippets of code
in order to generate documentation.
No code is stored.
Only your API key and a hash of your project name,
for the purposes of identifying usage,
are logged.

## Get started

### Requirements

* `python 3.8` or greater
* `pip install jaepeto`
* In the base directory of your project, create a `.jaepeto.ini` config file
* Run `jaepeto-init` in a terminal in your project's base directory to generate a template config
* Jaepeto API key

#### Config file

##### pyproject.toml (preferred)

Configure `jaepeto`
in your pyproject.toml file
under a `[tool.jaepeto]` section.
It can have the following fields

| Field | Purpose | Required | Default |
:------|:--------|:---------|:--------|
| name | Project name | Y | - |
| description | Short description of the project | N | "SHORT PROJECT DESCRIPTION" |
| srcdir | Path to source code directory from the project root | Y | - |
| package | Name of the project codebase as imported in files (if not using local imports) | N | `srcdir` |
| local | For development purposes only. If `true`, uses local server for testing | N | `false` |
| docdir | Path to the folder in which generated docs should be saved. `.` is project root | Y | - |
| docname | Name of the document to be generated. ".md" file suffix will be added if not present | N | technical_doc.md |

**Note: strings in toml files must be wrapped in quotes.**
E.g.:

```
[tool.jaepeto]
name = "jaepeto"
srcdir = "jaepeto"
docdir = "docs/"
docname = "README.md"
```

##### .jaepeto.ini

Instead of a pyproject.toml, you can use a `.jaepeto.ini` file.

`.jaepeto.ini` can have the following fields:

| Header | Field | Purpose | Required | Default |
|:-------|:------|:--------|:---------|:--------|
| project | name | Project name | Y | - |
| project | description | Short description of the project | N | "SHORT PROJECT DESCRIPTION" |
| project | srcdir | Path to source code directory from the project root | Y | - |
| project | package | Name of the project codebase as imported in files (if not using local imports) | N | `srcdir` |
| project | local | For development purposes only. If `true`, uses local server for testing | N | `false` |
| project | language | The predominant codebase language | N | python |
| docs | docdir | Path to the folder in which generated docs should be saved. `.` is project root | Y | - |

An example `.jaepeto.ini` is:

```
[project]
name = MyCoolProject
language = python
srcdir = src/cool
package = cool

[docs]
docdir = .
```

#### API Key

To get full functionality of `jaepeto`,
a (free) API key is needed.
If you have been invited to join
the private beta,
your coordinator will provide
an API key for
and your team members
to use.
To setup your API key,
create a `.env` file in your project root
and give it the following fields.

```
JAEPETO_API_KEY = <YOUR-API-KEY>
```

**IMPORTANT: DO NOT ADD `.env` TO SOURCE CONTROL. YOUR API KEY MUST REMAIN PRIVATE.**
When `jaepeto` reads your config file,
it uses `python-dotenv` to read environment variables
from the `.env` file.

### Generate documentation

**Via CLI:**

In a terminal/command prompt,
navigate to the root directory of your project
and run `jaepeto`.

| Command | Purpose |
|:--------|:--------|
| `jeapeto` | Generates/updates technical documentation |
| `jaepeto code` | Updates code snippets in technical documentation |

**VSCode:**

There is a VSCode extension for this tool.
Search for `jaepeto` in the marketplace.
The extension comes with additional features
for streamlining your entire documentation generation process.

## Concepts

### Doc comments

Jaepeto adds markdown comments to technical documentation
to signal the start
and end
of different sections,
to help you curate automated technical documentation.
For example
```
<!---Jaepeto-section-code: e22c5ecb-myproj/folder/file.py-20-25--->
```
tells Jaepeto that the following bit of documentation
is a code snippet
and gives some information on when it was generated.
If that snippet of code is updated over time,
Jaepeto will automatically track that code
and update the snippet.

### Fixed document sections

Have a bit of documentation
which isn't autogenerated by Jaepeto?
Wrap the section in comments:

```
<!---Jaepeto-section-fixed: <position><number>-start--->
Bit of documentation to fix in place.
Maybe add your logo here,
or a markdown badge?
<!---Jaepeto-section-fixed: <position><number>-end--->
```

Where `<position>` is `top` to fix the section to the top
of the document
and `bottom` to fix it to the bottom,
and `<number>` is the order within the fixed sections.
E.g. `<!---Jaepeto-section-fixed: top1-start--->`
would fix some documentation to the very top
of the document.

## License

You may download this package via pip
and use as intended,
**but you may not copy,
share
or edit the code**.
This is signified by the lack of specific license in the code.

## Development - Get started

### Requirements

- Developed with `python 3.9`
- `pip install -r requirements.txt`
- `pip install -r requirements-dev.txt`
- `pip install -e .`


In `.jaepeto.ini` add the following tags:

```
[project]
...
local = true
...
```

This will call `localhost` instead of the hosted server.
In a separate terminal,
run the web app locally in order to connect.

## Style Guide

- Use `black` to format code
- Other than `black` niches, adhere to PEP
- Use `isort` to sort imports
- Use numpy-style docstrings
- Use type hints and verify with `mypy`

### Testing

| CI | Purpose |
|:--:|:--------|
| `.github/workflows/test.yml` | Run linting and unit tests. Executes on all pull request branches |

Testing performed with `pytest`.
Run `pytest tests/unit`
to run unit tests.
There are integration tests
which should be run with a local API app running.