Skip to content

Commit

Permalink
📝 update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Wytamma committed Mar 15, 2024
1 parent 76c14b6 commit b9d4f59
Show file tree
Hide file tree
Showing 2 changed files with 257 additions and 13 deletions.
134 changes: 128 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Write-the offers the following AI-driven features:
- Write-the Docs: Automatically generate documentation for your codebase, including class and function descriptions, parameter explanations, and examples.
- Write-the Tests: Create test cases for your code, ensuring thorough test coverage and better code quality.
- Write-the Convert: Convert code and data from any format into another.
- Write-the Refactor: Receive refactoring suggestions, reduce code complexity, optimize performance, and fix bugs (TBD).

## Requirements
- Python 3.9 or higher
Expand All @@ -44,35 +43,158 @@ Write-the offers the following AI-driven features:
To use `write-the` you must set an OPENAI_API_KEY environment variable (e.g. `export OPENAI_API_KEY=...`).

### Docs:

Add google style docstrings to you Python code with AI.

```bash
write-the docs [OPTIONS] [PATH_TO_SOURCE_CODE]
```

![](https://raw.githubusercontent.com/Wytamma/write-the/master/images/docs-help.png)
By default the `write-the docs` command will add docstrings to all the `nodes` in the source code that are not already documented.

```bash
write-the docs write_the
```

#### Save
By default the docstrings will be printed to the console, you can use the `--save` flag to write the docstrings to the source code.

```bash
write-the docs --save write_the
```

#### Generate docs for specific nodes

A node is a function, class or class.method block. You can use the `--node` (`-n`) flag to specify which nodes to document (this will overwrite existing docstrings).

```bash
write-the docs -n function_name -n class_name -n class.method_name write_the
```

#### Force and Update

You can also use the `--force` flag to overwrite all existing docstrings in the specified folder or file.

```bash
write-the docs --force write_the/some_file.py
```

You can use the `--update` flag to update existing docstrings. For example the command that was used to update the docstrings in the `write-the` codebase in [this commit](https://github.com/Wytamma/write-the/commit/862928a4467b9afd30443fc2332384c88c780d24) was:

```bash
write-the docs --update --save write_the
```

### Model

View and set the default model that `write-the` uses to generate documentation and tests.

```bash
write-the model [OPTIONS] [DESIRED_MODEL]
```

The default model that `write-the` uses to generate documentation and tests is `gpt-3.5-turbo-instruct`.

You can also use the `write-the model <desired_model>` command to set the default model that `write-the` uses to generate documentation and tests.

```bash
write-the model gpt-4
```

Use the `--list` flag to view all available models.

```bash
write-the model --list
```

### MkDocs:

Generate a Markdown based [MkDocs website with material theme](https://squidfunk.github.io/mkdocs-material/) for a project including an API reference page.

### Mkdocs:
```bash
write-the mkdocs [OPTIONS] [PATH_TO_SOURCE_CODE]
```

![](https://raw.githubusercontent.com/Wytamma/write-the/master/images/mkdocs-help.png)
The `write-the mkdocs` command will generate a `mkdocs.yml` file and a `docs` folder in the specified directory. In addition a github action workflow file will be generated to automatically build and deploy the documentation to github pages. The `--readme` flag can be used to specify the path to the readme file that will be used as the homepage for the documentation site.

```bash
write-the mkdocs write_the --readme README.md
```
The above command will generate the following file structure:

```bash
.
├── mkdocs.yml
├── docs
│ ├── index.md
│ └── reference
│ ├── cli.md
│ ├── commands.md
│ ├── cst.md
│ ├── errors.md
│ ├── llm.md
│ ├── models.md
│ └── utils.md
└── .github
└── workflows
└── mkdocs.yml
```

You can see the documentation site that was generated for the `write-the` codebase [here](https://write-the.wytamma.com/).

### Tests:

Automatically generate test cases for your codebase using AI.

```bash
write-the tests [OPTIONS] [PATH_TO_SOURCE_CODE]
```

![](https://raw.githubusercontent.com/Wytamma/write-the/master/images/tests-help.png)
The write-the tests command will generate test cases for all the functions in the specified directory that are not already tested. By default the tests will be printed to the console, you can use the `--save` flag to write the tests to the `--out` directory (default is `tests`).

```bash
write-the tests --save write_the
```

### Convert:

Convert code and data from any format into another using AI.

```bash
write-the convert [OPTIONS] IN_FILE [OUT_FILE]
```

![](https://raw.githubusercontent.com/Wytamma/write-the/master/images/convert-help.png)
By default the `write-the convert` command will convert the input file to the output file format using the file extension to determine the input and output format. You can use the `--force` flag to overwrite the output file if it already exists.

```bash
write-the convert tests/data/multiply.py multiply.rs
```
```console
$ cat multiply.rs
fn multiply(a: i32, b: i32) -> i32 {
a * b
}
```

To give the llm model a hint about the input and output format you can use the `--input-format` and `--output-format` flags.

```bash
write-the convert tests/data/multiply.py multiply.rs -o "Verbose Rust with lots of comments"
```
```console
$ cat multiply.rs
// This is a function named 'multiply' that takes two parameters, 'a' and 'b'.
// Both 'a' and 'b' are of type i32, which is a 32-bit integer.
// The function returns a value of type i32.
fn multiply(a: i32, b: i32) -> i32 {
// The function body consists of a single expression, 'a * b'.
// This expression multiplies 'a' by 'b' and returns the result.
// In Rust, the last expression in a function is automatically returned.
a * b
}
```

## Documentation

For detailed information on available options and parameters, refer to the official (`write-the` generated) [documentation](https://write-the.wytamma.com/).

Expand Down
136 changes: 129 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Home
---
![](https://raw.githubusercontent.com/Wytamma/write-the/master/images/logo.png)

AI-powered Documentation and Test Generation Tool
AI-powered python code documentation and test generation tool

[![PyPI - Version](https://img.shields.io/pypi/v/write-the.svg)](https://pypi.org/project/write-the)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/write-the.svg)](https://pypi.org/project/write-the)
Expand Down Expand Up @@ -36,7 +36,6 @@ Write-the offers the following AI-driven features:
- Write-the Docs: Automatically generate documentation for your codebase, including class and function descriptions, parameter explanations, and examples.
- Write-the Tests: Create test cases for your code, ensuring thorough test coverage and better code quality.
- Write-the Convert: Convert code and data from any format into another.
- Write-the Refactor: Receive refactoring suggestions, reduce code complexity, optimize performance, and fix bugs (TBD).

## Requirements
- Python 3.9 or higher
Expand All @@ -47,35 +46,158 @@ Write-the offers the following AI-driven features:
To use `write-the` you must set an OPENAI_API_KEY environment variable (e.g. `export OPENAI_API_KEY=...`).

### Docs:

Add google style docstrings to you Python code with AI.

```bash
write-the docs [OPTIONS] [PATH_TO_SOURCE_CODE]
```

![](https://raw.githubusercontent.com/Wytamma/write-the/master/images/docs-help.png)
By default the `write-the docs` command will add docstrings to all the `nodes` in the source code that are not already documented.

```bash
write-the docs write_the
```

#### Save
By default the docstrings will be printed to the console, you can use the `--save` flag to write the docstrings to the source code.

```bash
write-the docs --save write_the
```

#### Generate docs for specific nodes

A node is a function, class or class.method block. You can use the `--node` (`-n`) flag to specify which nodes to document (this will overwrite existing docstrings).

```bash
write-the docs -n function_name -n class_name -n class.method_name write_the
```

#### Force and Update

You can also use the `--force` flag to overwrite all existing docstrings in the specified folder or file.

```bash
write-the docs --force write_the/some_file.py
```

You can use the `--update` flag to update existing docstrings. For example the command that was used to update the docstrings in the `write-the` codebase in [this commit](https://github.com/Wytamma/write-the/commit/862928a4467b9afd30443fc2332384c88c780d24) was:

```bash
write-the docs --update --save write_the
```

### Model

View and set the default model that `write-the` uses to generate documentation and tests.

```bash
write-the model [OPTIONS] [DESIRED_MODEL]
```

The default model that `write-the` uses to generate documentation and tests is `gpt-3.5-turbo-instruct`.

You can also use the `write-the model <desired_model>` command to set the default model that `write-the` uses to generate documentation and tests.

```bash
write-the model gpt-4
```

Use the `--list` flag to view all available models.

```bash
write-the model --list
```

### MkDocs:

Generate a Markdown based [MkDocs website with material theme](https://squidfunk.github.io/mkdocs-material/) for a project including an API reference page.

### Mkdocs:
```bash
write-the mkdocs [OPTIONS] [PATH_TO_SOURCE_CODE]
```

![](https://raw.githubusercontent.com/Wytamma/write-the/master/images/mkdocs-help.png)
The `write-the mkdocs` command will generate a `mkdocs.yml` file and a `docs` folder in the specified directory. In addition a github action workflow file will be generated to automatically build and deploy the documentation to github pages. The `--readme` flag can be used to specify the path to the readme file that will be used as the homepage for the documentation site.

```bash
write-the mkdocs write_the --readme README.md
```
The above command will generate the following file structure:

```bash
.
├── mkdocs.yml
├── docs
│ ├── index.md
│ └── reference
│ ├── cli.md
│ ├── commands.md
│ ├── cst.md
│ ├── errors.md
│ ├── llm.md
│ ├── models.md
│ └── utils.md
└── .github
└── workflows
└── mkdocs.yml
```

You can see the documentation site that was generated for the `write-the` codebase [here](https://write-the.wytamma.com/).

### Tests:

Automatically generate test cases for your codebase using AI.

```bash
write-the tests [OPTIONS] [PATH_TO_SOURCE_CODE]
```

![](https://raw.githubusercontent.com/Wytamma/write-the/master/images/tests-help.png)
The write-the tests command will generate test cases for all the functions in the specified directory that are not already tested. By default the tests will be printed to the console, you can use the `--save` flag to write the tests to the `--out` directory (default is `tests`).

```bash
write-the tests --save write_the
```

### Convert:

Convert code and data from any format into another using AI.

```bash
write-the convert [OPTIONS] IN_FILE [OUT_FILE]
```

![](https://raw.githubusercontent.com/Wytamma/write-the/master/images/convert-help.png)
By default the `write-the convert` command will convert the input file to the output file format using the file extension to determine the input and output format. You can use the `--force` flag to overwrite the output file if it already exists.

```bash
write-the convert tests/data/multiply.py multiply.rs
```
```console
$ cat multiply.rs
fn multiply(a: i32, b: i32) -> i32 {
a * b
}
```

To give the llm model a hint about the input and output format you can use the `--input-format` and `--output-format` flags.

```bash
write-the convert tests/data/multiply.py multiply.rs -o "Verbose Rust with lots of comments"
```
```console
$ cat multiply.rs
// This is a function named 'multiply' that takes two parameters, 'a' and 'b'.
// Both 'a' and 'b' are of type i32, which is a 32-bit integer.
// The function returns a value of type i32.
fn multiply(a: i32, b: i32) -> i32 {
// The function body consists of a single expression, 'a * b'.
// This expression multiplies 'a' by 'b' and returns the result.
// In Rust, the last expression in a function is automatically returned.
a * b
}
```

## Documentation

For detailed information on available options and parameters, refer to the official (`write-the` generated) [documentation](https://write-the.wytamma.com/).

Expand Down

0 comments on commit b9d4f59

Please sign in to comment.