Skip to content

Commit

Permalink
moving to pdm from poetry and updating token stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniouaa committed Apr 10, 2024
1 parent 9aa7598 commit be4af9d
Show file tree
Hide file tree
Showing 12 changed files with 796 additions and 800 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/krypto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
dir: "."
env:
TOKEN_GITHUB: ${{secrets.GITHUB_TOKEN}}
KRYPTO_TOKEN: ${{secrets.KRYPTO_TOKEN}}

- name: Output quantity
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ jobs:
poetry run task test
poetry run coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }}
KRYPTO_TOKEN: ${{ secrets.KRYPTO_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
# Compilation artifacts
**/__pycache__
**/.pytest_cache
**/.mypy_cache
**/.pdm-build
**/.pdm-python

# Virtual environments
**/venv
**/.venv

# Distribution artifacts
**/*.egg-info
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.7

ENV TOKEN_GITHUB = $TOKEN_GITHUB
ENV KRYPTO_TOKEN = $KRYPTO_TOKEN
ENV REPOINFO $GITHUB_REPOSITORY

WORKDIR /krypto
Expand Down
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ To acquire a token navigate to [Developer Settings](https://github.com/settings/
With the token in hand, simply,

```sh
export TOKEN_GITHUB = token_here
export KRYPTO_TOKEN = <token_here>
```

or

```ps
$env:TOKEN_GITHUB = token_here
$env:KRYPTO_TOKEN = token_here
```

If you want the token to persist across sessions you need to add it to your `.bashrc` or `$PROFILE`.
Expand All @@ -63,30 +63,30 @@ The TODO must contain a title. Body and labels are optional.

Examples:

- Title only, no body or labels
- Title only, no body or labels

```py
# TODO: This is a title
```
```py
# TODO: This is a title
```

- Title, body, no labels
- Title, body, no labels

```py
# TODO: This is a title
# This is in the TODO body
```
```py
# TODO: This is a title
# This is in the TODO body
```

- Title, body and labels
- Title, body and labels

```py
# TODO[Enhancement]: This is a title
# This is in the TODO body
```
```py
# TODO[Enhancement]: This is a title
# This is in the TODO body
```

- Multiple labels
```py
# TODO[Enhancement, Bug, Documentation]: This is a title
```
- Multiple labels
```py
# TODO[Enhancement, Bug, Documentation]: This is a title
```

Valid separators include `,` `/` `#` `~` `\`

Expand Down Expand Up @@ -120,7 +120,7 @@ This action runs Krypto on your code and creates issues on the repo on your beha

### Env

### `TOKEN_GITHUB`
### `KRYPTO_TOKEN`

**Required** A personal access token for github to use to authenticate the creation of issues on your repository.

Expand All @@ -129,9 +129,9 @@ This action runs Krypto on your code and creates issues on the repo on your beha
```yaml
uses: antoniouaa/krypto@v2
with:
dir: "."
dir: "."
env:
TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }}
KRYPTO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

_Run krypto on the root of the project_
Expand Down
2 changes: 1 addition & 1 deletion krypto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__version__ = "0.1.0"

token = os.getenv("TOKEN_GITHUB")
token = os.getenv("KRYPTO_TOKEN")
assert token is not None


Expand Down
3 changes: 1 addition & 2 deletions krypto/config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import tomli


class PyProjectNotFound(Exception):
...
class PyProjectNotFound(Exception): ...


DEFAULTS = {"prefix": "TODO", "attach-issue": False}
Expand Down
1 change: 1 addition & 0 deletions krypto/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def filter_issues(
issue_state: dict = ALL_ISSUES,
) -> List[Todo]:
response = requests.get(url, headers=headers, params=issue_state)
response.raise_for_status()
existing = {issue["title"].lower(): issue for issue in response.json()}
filtered = []
for todo in todos:
Expand Down
6 changes: 3 additions & 3 deletions krypto/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
# Will need to change the parser to deal with the new tokens


class TODOError(Exception):
...
class TODOError(Exception): ...


@dataclass
Expand All @@ -35,8 +34,9 @@ def __str__(self) -> str:

def gather_todos(path: str, config: dict) -> List[Todo]:
todos = []
src = config["src"]
for extension in SYMBOLS.keys():
for file in pathlib.Path(path).glob(f"**/*.{extension}"):
for file in pathlib.Path(path).glob(f"{src}/**/*.{extension}"):
if "test" not in str(file):
with open(file) as f:
lst = parse(
Expand Down
726 changes: 726 additions & 0 deletions pdm.lock

Large diffs are not rendered by default.

Loading

0 comments on commit be4af9d

Please sign in to comment.