Skip to content

Commit

Permalink
‣ Package codebase as click CLI, publish to PyPI.
Browse files Browse the repository at this point in the history
  • Loading branch information
eli64s committed Jul 30, 2023
1 parent cdc0f94 commit 5b0d88d
Show file tree
Hide file tree
Showing 32 changed files with 827 additions and 905 deletions.
24 changes: 18 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,28 @@ All notable changes to this project will be documented in this file.

---

## [v0.0.4] - *2023-07-29*
## [v0.0.5] - *2023-07-30*

### Added

- ⚙️ Add script to handle custom exceptions [exceptions.py](./src/exceptions.py).
- 📖 Update [README.md](./README.md) file contents.
- Modify docker commands to use the tag `readme-ai:0.0.4`.

- 📦 Publish *readme-ai* CLI to PyPI under the module name [readmeai](https://pypi.org/project/readmeai/).
- Refactored the codebase to use [Click](https://click.palletsprojects.com/en/8.1.x/), migrating from argparse.
- Update directory name from *src* to *readmeai* to match PyPI module name.
- Update [readmeai](./readmeai/) modules to use relative imports.
- Update metadata and dependency details in the [pyproject.toml](./pyproject.toml) file.
- 📖 Update [README.md](./README.md) documentation.
- Add *PyPI* package badges at the top of the README.
- Include instructions for downloading and running the *readme-ai* CLI from PyPI.
- ⚙️ Add helper script [update_image.sh](./scripts/update_image.sh) to push the latest image to Docker Hub.
### Fixed

- 🐳 Update Dockerfile with the latest dependencies + *tree* command installation.
- 🐳 Update Dockerfile commands
- Add line to install the *tree* command in order to generate the repository tree structure in the README.
- Update installtion to use the latest *readmeai* distribution from PyPI.

### Removed

- 🗑 Removed *setup.py* script from the project root directory.
- Poetry is used for package management via [pyproject.toml](./pyproject.toml). Thus, *setup.py* is no longer needed.

---
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ WORKDIR /app
# Set environment variable for Git Python
ENV GIT_PYTHON_REFRESH=quiet

# Copy the project files to the container
COPY . .

# Install project dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Install the readmeai package from PyPI
RUN pip install --no-cache-dir readmeai

# Set the command to run your project
CMD ["python", "src/main.py"]
CMD ["readmeai"]
114 changes: 66 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
<body>
<div align="center">
<h1 align="center">
<img src="https://img.icons8.com/?size=512&id=55494&format=png" width="80" />
<img src="https://img.icons8.com/?size=512&id=kTuxVYRKeKEY&format=png" width="80" />
<br>README-AI
</h1>
<h3>◦ Generate beautiful and informative README.md documents.</h3>
<h3>◦ Developed with OpenAI's GPT language model APIs.</h3>
<br>
<p align="center">
<img src="https://img.shields.io/badge/Markdown-000000.svg?stylee&logo=Markdown&logoColor=white" alt="Markdown" />
<img src="https://img.shields.io/badge/OpenAI-412991.svg?stylee&logo=OpenAI&logoColor=white" alt="OpenAI" />
<img src="https://img.shields.io/badge/Python-3776AB.svg?stylee&logo=Python&logoColor=white" alt="Python" />
<img src="https://img.shields.io/badge/Pytest-0A9EDC.svg?stylee&logo=Pytest&logoColor=white" alt="pytest" />
<img src="https://img.shields.io/badge/GNU%20Bash-4EAA25.svg?stylee&logo=GNU-Bash&logoColor=white" alt="Bash" />
<img src="https://img.shields.io/badge/Anaconda-44A833.svg?&logo=Anaconda&logoColor=white" alt="Anaconda" />
</p>
<img src="https://img.shields.io/github/languages/top/eli64s/README-AI?color=5D6D7E" alt="GitHub top language" />
<img src="https://img.shields.io/github/commit-activity/m/eli64s/README-AI?color=5D6D7E" alt="GitHub commit activity" />
<img src="https://img.shields.io/github/last-commit/eli64s/readme-ai?color=5D6D7E" alt="GitHub last commit" />
<img src="https://img.shields.io/github/license/eli64s/README-AI?color=5D6D7E" alt="GitHub license" />
</div>
</body>
<div align="center">
<h1 align="center">
<img src="https://img.icons8.com/?size=512&id=55494&format=png" width="80" />
<img src="https://img.icons8.com/?size=512&id=kTuxVYRKeKEY&format=png" width="80" />
<br>README-AI
</h1>
<h3>◦ Generate beautiful and informative README.md documents.</h3>
<h3>◦ Developed with OpenAI's GPT language model APIs.</h3>
<br>
<p align="center">
<img src="https://img.shields.io/badge/Markdown-000000.svg?stylee&logo=Markdown&logoColor=white" alt="Markdown" />
<img src="https://img.shields.io/badge/OpenAI-412991.svg?stylee&logo=OpenAI&logoColor=white" alt="OpenAI" />
<img src="https://img.shields.io/badge/Python-3776AB.svg?stylee&logo=Python&logoColor=white" alt="Python" />
<img src="https://img.shields.io/badge/Pytest-0A9EDC.svg?stylee&logo=Pytest&logoColor=white" alt="pytest" />
<img src="https://img.shields.io/badge/GNU%20Bash-4EAA25.svg?stylee&logo=GNU-Bash&logoColor=white" alt="Bash" />
<img src="https://img.shields.io/badge/Anaconda-44A833.svg?&logo=Anaconda&logoColor=white" alt="Anaconda" />
</p>
<img src="https://img.shields.io/pypi/v/readmeai?color=5D6D7E&logo=python" alt="PyPI - License" />
<img src="https://img.shields.io/pypi/pyversions/readmeai?color=5D6D7E&logo=python" alt="PyPI - Python Version" />
<img src="https://img.shields.io/github/license/eli64s/README-AI?color=5D6D7E" alt="GitHub license" />
<img src="https://img.shields.io/github/last-commit/eli64s/readme-ai?color=5D6D7E" alt="GitHub last commit" />
</div>


---

Expand All @@ -38,7 +37,16 @@
- [📂 Repository](#-repository)
- [🔐 OpenAI API](#-openai-api)
- [📦 Installation](#-installation)
- [*Pip (PyPi Package)*](#pip-pypi-package)
- [*Bash*](#bash)
- [*Conda*](#conda)
- [*Poetry*](#poetry)
- [*Docker*](#docker)
- [🎮 Using *README-AI*](#-using-readme-ai)
- [*Pip (PyPi Package)*](#pip-pypi-package-1)
- [*Conda*](#conda-1)
- [*Poetry*](#poetry-1)
- [*Docker*](#docker-1)
- [🧪 Running Tests](#-running-tests)
- [🛠 Future Development](#-future-development)
- [📒 Changelog](#-changelog)
Expand All @@ -59,13 +67,15 @@ Simplifies the process of writing and maintaining high-quality project documenta

*README-AI* is currently under development and has an opinionated configuration and setup. While this tool provides an excellent starting point for documentation, its important to review all text generated by the OpenAI API to ensure it accurately represents your codebase. Ensure all content in your repository is free of sensitive information before executing.

Additionally, regularly monitor your API usage and costs by visiting the [OpenAI API Usage](https://platform.openai.com/account/usage).
Additionally, frequently monitor your API usage and costs by visiting the [OpenAI API Usage Dashboard](https://platform.openai.com/account/usage).

---

## 👾 Demo

[![demo video](examples/imgs/demo.png)](https://youtu.be/pl-VcVfGbbk)
<a href="https://youtu.be/pl-VcVfGbbk">
<img src="examples/imgs/demo.png" alt="readme-ai demo video">
</a>

---

Expand Down Expand Up @@ -281,15 +291,14 @@ Additionally, regularly monitor your API usage and costs by visiting the [OpenAI
Before you begin, ensure that you have the following prerequisites installed:

- Python 3.9 or higher
- Conda package manager (recommended)
- Conda or Poetry package manager (recommended)
- Access to the OpenAI API (see the setup guide below)

#### 📂 Repository

Most user's will run README-AI using the command-line interface, specifying their repository on run-time. However, if you would like to use the default configuration, you will need to update the [configuration file](./conf/conf.toml) with your repository's remote URL (GitHub, GitLab) or local directory pat on your machine.
Most user's will run *README-AI* using the command-line, specifying their repository on run-time. However, if you would like to use the default configuration, you will need to update the [configuration file](./conf/conf.toml) with your repository's remote URL (GitHub, GitLab) or local directory path on your machine.

```toml
# Repository Configuration
[git]
repository = "Insert your repository URL or local path here!"
```
Expand Down Expand Up @@ -335,26 +344,31 @@ cd readme-ai

3. Use one of the following methods to install the required dependencies:

##### *Pip (PyPi Package)*
```sh
pip install readmeai
```

##### *Bash*
```sh
# With Bash
bash setup/setup.sh
```

##### *Conda*
```sh
# With Conda
conda create -n readmeai python=3.9 -y && \
conda activate readmeai && \
poetry install
```

##### *Poetry*
```sh
# With Poetry
poetry install
```

##### *Docker*
```sh
# With Docker
docker pull zeroxeli/readme-ai:0.0.4
docker pull zeroxeli/readme-ai:0.0.5
```

### 🎮 Using *README-AI*
Expand All @@ -369,42 +383,45 @@ Command-Line Arguments:
- `-t` or `--template`: The README template format to use. (coming soon!)
- `l` or `--language`: The language of text written in the README file (coming soon!)

##### *Pip (PyPi Package)*
```sh
python src/main.py --api-key "YOUR_API_KEY" --output readme-ai.md --repository https://github.com/eli64s/readme-ai
readmeai --api-key "YOUR_API_KEY" --output readme-ai.md --repository https://github.com/eli64s/readme-ai

# Or export your OpenAI API key as an environment variable
export OPENAI_API_KEY="YOUR_API_KEY"
readmeai -k $OPENAI_API_KEY -o readme-ai.md -r https://github.com/eli64s/readme-ai
```
Alternatively, export your OpenAI API key as an environment variable and run the following command:

##### *Conda*
```sh
conda activate readmeai
python readmeai/main.py --api-key "YOUR_API_KEY" --output readme-ai.md --repository https://github.com/eli64s/readme-ai

# Or export your OpenAI API key as an environment variable
conda activate readmeai
export OPENAI_API_KEY="YOUR_API_KEY"

python src/main.py -o readme-ai.md -r https://github.com/eli64s/readme-ai
python readmeai/main.py -o readme-ai.md -r https://github.com/eli64s/readme-ai
```

##### *Poetry*
```sh
# With Poetry
poetry shell

export OPENAI_API_KEY="YOUR_API_KEY"

poetry run python src/main.py -o readme-ai.md -r https://github.com/eli64s/readme-ai
poetry run python readmeai/main.py -o readme-ai.md -r https://github.com/eli64s/readme-ai
```

##### *Docker*
```sh
# Run with Docker
docker run -it \
-e OPENAI_API_KEY="YOUR_API_KEY" \
-v "$(pwd)":/app \
-w /app zeroxeli/readme-ai:0.0.4 \
python src/main.py -o readme-ai.md -r https://github.com/eli64s/readme-ai
-v "$(pwd)":/app zeroxeli/readme-ai:0.0.5 \
readmeai -o readme-ai.md -r https://github.com/eli64s/readme-ai
```

### 🧪 Running Tests

To run the unit-tests for README-AI, use the following command.

```bash
```sh
bash scripts/test.sh
```

Expand All @@ -417,6 +434,7 @@ bash scripts/test.sh
## 🛠 Future Development

- [X] Add additional language support for populating the *installation*, *usage*, and *test* README sections.
- [X] Upload the *readme-ai* cli tool to PyPi under the module name [readmeai](https://pypi.org/project/readmeai/).
- [ ] Design and implement a variety of README template formats for different use-cases.
- [ ] Add support for writing the README in any language (i.e. CN, ES, FR, JA, KO, RU).
- [ ] Create UI with [Textual](https://github.com/Textualize/textual) or another framework to improve user experience.
Expand Down
Loading

0 comments on commit 5b0d88d

Please sign in to comment.