Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PACKAGE-1] Package to PIP #84

Merged
merged 32 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
081adac
chore: port changes from test-1
seyLu Oct 22, 2023
60febe8
feat: project rename
seyLu Oct 22, 2023
83a6cce
chore: clean up deps
seyLu Oct 22, 2023
2c8d56d
feat: build with hatchling, build and upload dist using twine
seyLu Oct 22, 2023
744f4d7
Merge branch 'main' into feat/PACKAGE-1
seyLu Oct 22, 2023
9557d53
feat: move deps to src
seyLu Oct 22, 2023
ec348e3
feat: add entry point
seyLu Oct 22, 2023
98dcb8e
feat: add deps to pyproject.toml and resolve path shenanigans
seyLu Oct 22, 2023
a7cfa53
feat: add deps to pyproject.toml and resolve path shenanigans
seyLu Oct 22, 2023
a45dbfa
chore: change color of project name in version callback
seyLu Oct 22, 2023
4773399
docs: update README
seyLu Oct 22, 2023
29e3c30
docs: add basic usage
seyLu Oct 22, 2023
b1c2e77
docs: add advanced usage
seyLu Oct 22, 2023
973413b
feat: rename PERSONAL_ACCESS_TOKEN to just TOKEN
seyLu Oct 22, 2023
d9d550d
docs: add short -h command on setup and dump
seyLu Oct 22, 2023
748e786
docs: update alt text of icon
seyLu Oct 22, 2023
907325d
chore: revert version to 0.0.1
seyLu Oct 22, 2023
38a93a9
feat: add dynamic versioning
seyLu Oct 22, 2023
e15f858
docs: update basic usage
seyLu Oct 22, 2023
05b7544
chore: move build-system up
seyLu Oct 22, 2023
18ec43d
feat: add bandit to ruff config
seyLu Oct 22, 2023
c47e856
chore: reformat
seyLu Oct 22, 2023
2fc4fdc
chore: reformat
seyLu Oct 22, 2023
3f7f492
feat: add pre-commit prettier
seyLu Oct 23, 2023
ceaeae3
feat: add ruff config flake8-builtins
seyLu Oct 23, 2023
284c8bb
feat: add ruff config flake8-builtins
seyLu Oct 23, 2023
f1e8e40
feat: add more ruff rules and add HTTPError request exception handling
seyLu Oct 23, 2023
335c72a
feat (pre-commit): deprecate black in favor of ruff format
seyLu Feb 14, 2024
75ab1ff
chore: remove unecessary main function
seyLu Feb 14, 2024
142f200
Merge branch 'main' into feat/PACKAGE-1
seyLu Feb 14, 2024
ffdeb0e
Merge branch 'main' into feat/PACKAGE-1
seyLu Mar 29, 2024
2d1d5b2
ci (lint): deprecate black in favor of ruff
seyLu Mar 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,19 @@ root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
[*.{py}]
charset = utf-8

# 2 space indentation
[*.json, *.html]
[*.{yaml,yml,toml}]
indent_style = space
indent_size = 2

# 4 space indentation
[*.py]
[*.{py,md}]
indent_style = space
indent_size = 4

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
GITHUB_PERSONAL_ACCESS_TOKEN=<your_github_personal_access_token>
GITHUB_TOKEN=<your_github_personal_access_token>
GITHUB_REPO_OWNER=<target_github_repository_owner>
GITHUB_REPO_NAME=<target_github_repository_name>
2 changes: 0 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,3 @@ jobs:
mypy .
--install-types
--non-interactive
--check-untyped-defs
--ignore-missing-imports
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
types_or: [yaml, toml, markdown]
additional_dependencies:
- prettier@3.0.3
- prettier-plugin-toml@1.0.0

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.1
hooks:
Expand Down
89 changes: 58 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,99 @@
<div align="center">
<img height=100 src="https://github.com/seyLu/setup-issue-label-cli/blob/main/static/icons/labels.png" alt="Setup Github Label CLI Icon">
<h1Github Label CLI</h1>
<img height=100 src="https://github.com/seyLu/ghlabel/blob/main/labels.png" alt="ghlabel icon">
<h1>ghlabel</h1>
<p>CLI tool to help setup Github Labels from a yaml/json config file.</p>
<p>
<a href="https://github.com/seyLu/setup-issue-label-cli/issues/new">Report Bug</a>
<img src="https://github.com/seyLu/ghlabel/actions/workflows/codeql.yaml/badge.svg" alt="Codeql badge">
<img src="https://github.com/seyLu/ghlabel/actions/workflows/lint.yaml/badge.svg" alt="Lint badge">
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.11+-blue" alt="Python 3.11+ badge"></a>
<a href="https://peps.python.org/pep-0008/"><img src="https://img.shields.io/badge/code%20style-pep8-orange.svg" alt="PEP8 badge"></a>
<a href="https://github.com/seyLu/ghlabel/blob/main/LICENSE"><img src="https://img.shields.io/github/license/seyLu/ghlabel.svg" alt="MIT License"></a>
</p>
<p>
<a href="https://github.com/seyLu/ghlabel/issues/new">Report Bug</a>
·
<a href="https://github.com/seyLu/setup-issue-label-cli/issues/new">Request Feature</a>
<a href="https://github.com/seyLu/ghlabel/issues/new">Request Feature</a>
·
<a href="https://github.com/seyLu/setup-issue-label-cli/discussions">Ask Question</a>
<a href="https://github.com/seyLu/ghlabel/discussions">Ask Question</a>
</p>
</div>

<br>

### Supported Python version
### Installation and Setup

It is recommended to not install the CLI tool globally.

#### 1. Create a new directory where you want the configuration to live

```bash
python==3.11
mkdir ghlabel

# this is where the labels config will be located
cd ghlabel
```

<br>
#### 2. Create and activate virtual environment

### Setup
```bash
python -m venv .venv

#### 1. Clone the repo
# Linux/Mac
. .venv/bin/activate

```bash
git clone git@github.com:seyLu/setup-github-label-cli.git
# Windows
.venv\Scripts\activate.bat
```

#### 2. Install dependencies

##### Create a new virtual environment
#### 3. Install package

```bash
python -m venv .venv
pip install ghlabel

# check if installed
ghlabel -v
```

##### Activate the virtual environment
#### 4. Create `.env` and supply github credentials

```bash
# Linux/Mac
. .venv/bin/activate
touch .env

# Windows
.venv\Scripts\activate.bat
type nul > .env
```

```bash
GITHUB_PERSONAL_ACCESS_TOKEN=<your_github_personal_access_token>
GITHUB_REPO_OWNER=<target_github_repository_owner>
GITHUB_REPO_NAME=<target_github_repository_name>
```

##### Install dependencies from requirements.txt
<br>

### Basic Usage

#### 1. Generate labels config

```bash
pip install -r requirements.txt
ghlabel dump
```

#### 3. Create `.env` and supply github credentials
#### 2. Setup labels in GitHub

```bash
cp .env.example .env
ghlabel setup
```

##### `.env.example` preview
<br>

For advanced usage, see:
```bash
GITHUB_PERSONAL_ACCESS_TOKEN=<your_github_personal_access_token>
GITHUB_REPO_OWNER=<target_github_repository_owner>
GITHUB_REPO_NAME=<target_github_repository_name>
ghlabel -h
```

<br>
<br>

## :red_circle: `ghlabel`
Expand All @@ -87,7 +114,7 @@ $ ghlabel [OPTIONS] COMMAND [ARGS]...
Show version and exit.
#### `--debug`, `-D`
Enable debug mode and show logs.
#### `--help`
#### `--help`, `-h`
Show this message and exit.

<br>
Expand Down Expand Up @@ -123,7 +150,7 @@ Specify the dir where to find labels.
Label file extension.
#### `--app`, `-a [app|game|web]` [default: app]
App to determine label template.
#### `--help`
#### `--help`, `-h`
Show this message and exit.

<br>
Expand Down Expand Up @@ -160,7 +187,7 @@ Add more labels.
Remove more labels.
#### `--remove-all`, `-R [disable|enable|silent]` [default: disable]
Remove all Github labels.
#### `--help`
#### `--help`, `-h`
Show this message and exit.

<br>
Expand All @@ -186,7 +213,7 @@ ghlabel setup -r "Type: Feature Request, Type: Bug"
```bash
# -a [valid json string]
# will be parsed as list[dict[str, str]]
ghlabel setup -a "[{'name': 'wontfix', 'color': '##ffffff'}, {'name': 'bug', 'color': '#d73a4a', 'description': 'Something isn't working'}]"
ghlabel setup -a "[{'name': 'wontfix', 'color': '#ffffff'}, {'name': 'bug', 'color': '#d73a4a', 'description': 'Something isn't working'}]"
```

<br>
Expand Down
8 changes: 4 additions & 4 deletions ghlabel.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ ghlabel [OPTIONS] COMMAND [ARGS]...
Show version and exit.
#### `--debug`, `-D`
Enable debug mode and show logs.
#### `--help`
#### `--help`, `-h`
Show this message and exit.

<br>
Expand Down Expand Up @@ -54,7 +54,7 @@ Specify the dir where to find labels.
Label file extension.
#### `--app`, `-a [app|game|web]` [default: app]
App to determine label template.
#### `--help`
#### `--help`, `-h`
Show this message and exit.

<br>
Expand Down Expand Up @@ -91,7 +91,7 @@ Add more labels.
Remove more labels.
#### `--remove-all`, `-R [disable|enable|silent]` [default: disable]
Remove all Github labels.
#### `--help`
#### `--help`, `-h`
Show this message and exit.

<br>
Expand All @@ -117,5 +117,5 @@ ghlabel setup -r "Type: Feature Request, Type: Bug"
```bash
# -a [valid json string]
# will be parsed as list[dict[str, str]]
ghlabel setup -a "[{'name': 'wontfix', 'color': '##ffffff'}, {'name': 'bug', 'color': '#d73a4a', 'description': 'Something isn't working'}]"
ghlabel setup -a "[{'name': 'wontfix', 'color': '#ffffff'}, {'name': 'bug', 'color': '#d73a4a', 'description': 'Something isn't working'}]"
```
File renamed without changes
5 changes: 0 additions & 5 deletions labels/affects_labels.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions labels/close_labels.yaml

This file was deleted.

40 changes: 0 additions & 40 deletions labels/needs_labels.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions labels/priority_labels.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions labels/state_labels.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions labels/type_labels.yaml

This file was deleted.

Loading