myrontuttle / pycodegen

Python Code Generator
MIT License
1 stars 1 forks source link

pycodegen

Build status Dependencies Status Code style: black Security: bandit Pre-commit Semantic Versions License

Python Code Generator

Dependencies

Installation

pip install pycodegen

or install with PDM

pdm add pycodegen

or install with pipx1

pipx install git+https://github.com/myrontuttle/pycodegen.git

Usage

from pycodegen.coder import Coder

coder = Coder("repo_owner", "repo_name")
issue_number = 1
open_response_code = coder.open_issue(issue_number)
code_response_code = coder.start_coding()
# Work on issue
finish_response_code = coder.finish_issue("commit_msg")

Command line (install with pipx)

coder start <githubaccount> <project> [-i <issuenumber>]
coder code <githubaccount> <project>
# Work on issue
coder finish <githubaccount> <project> [-m "<commit message>"]

Makefile usage

Makefile contains a lot of functions for faster development.

1. Install all dependencies and pre-commit hooks

Install requirements: ```bash make install ``` Update PDM ```bash make update ``` Update all dev libraries to the latest version using one command ```bash make update-dev-deps ```

2. Codestyle Formatting

Automatic formatting uses `autoflake`, `pyupgrade`, `isort` and `black`. ```bash make format ``` Codestyle checks only, without rewriting files: ```bash make check-codestyle ``` > Note: `check-codestyle` uses `isort`, `black` and `ruff` library

3. Code security

```bash make check-security ``` This command launches `PDM` integrity checks as well as identifies security issues with `Bandit`. ```bash make check-security ```

4. Type checks

Run `mypy` static type checker ```bash make mypy ```

5. Tests with coverage badges

Run `pytest` ```bash make test ```

6. All checks

Run all checks: ```bash make check-all ``` the same as: ```bash make check-style && make mypy && make check-safety && make test ```

7. Deploy

Prepare to deploy ```bash make prepare-deploy ```

8. Cleanup

Delete pycache files ```bash make pycache-remove ``` Remove package build ```bash make build-remove ``` Remove .mypycache ```bash make mypycache-remove ``` Or to remove all above run: ```bash make cleanup ```

Reference

Built using project template here.