Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@ on:

jobs:
build:

env:
TOX_PARALLEL_NO_SPINNER: 1
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
include:
- os: ubuntu-latest
test_script: make test
cache_path: ~/.cache/pip
- os: macos-latest
test_script: make test
cache_path: ~/Library/Caches/pip
- os: windows-latest
test_script: .\test.ps1
cache_path: ~\AppData\Local\pip\Cache

steps:
Expand All @@ -38,6 +36,8 @@ jobs:
path: ${{ matrix.cache_path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Lint with pylint and test with pytest
run: ${{ matrix.test_script }}
${{ runner.os }}-pip-
- name: Install tox
run: pip install -U tox
- name: Lint, Test, Type Check, Bandit, and Safety
run: tox -e lint,test,bandit,type-check,safety
67 changes: 0 additions & 67 deletions Makefile

This file was deleted.

15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,23 @@ for anyone to create new plugins accessible

### **Unix**

#### Dependencies

```shell
# MacOS
$ brew install python3-pip
$ brew install python3-venv
$ brew install git

# Other Linux distros
$ apt-get -y install python3-pip
$ apt-get -y install python3-venv
$ apt-get -y install git
```

#### Install PIPX

```shell
$ python3 -m pip install --user pipx
$ echo 'export PIPX_HOME="$HOME/.forge"' >> ~/.profile
$ echo 'export PIPX_BIN_DIR="$HOME/.forge/bin"' >> ~/.profile
Expand Down Expand Up @@ -52,7 +65,7 @@ python -m pipx ensurepath --force

## Installation

> **NOTE:** Befrore moving on make sure the envirnonment variables are set, open a new terminal and run
> **NOTE:** Before moving on make sure the envirnonment variables are set, open a new terminal and run

> `echo $PIPX_HOME` or `$env:PIPX_HOME`

Expand Down
9 changes: 4 additions & 5 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pylint==2.6.0
pytest==6.1.2
pylint==2.7.1
pytest==6.2.2
pytest-randomly==3.5.0
pytest-repeat==0.9.1
pytest-cov==2.10.1
mock==4.0.2
twine==1.13.0
pytest-cov==2.11.1
mock==4.0.3
11 changes: 6 additions & 5 deletions forge/cli.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
""" Forge CLI """

from typing import List
from subprocess import Popen
import sys
import subprocess
from typing import List

import click
import pkg_resources

from forge import forge

from .pipx_wrapper import install_to_pipx, uninstall_from_pipx, update_pipx
from forge.pipx_wrapper import (install_to_pipx, uninstall_from_pipx,
update_pipx)

CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'],
ignore_unknown_options=True,
Expand Down Expand Up @@ -102,7 +103,7 @@ def list_forge_plugins() -> None:

def run_forge_plugin(command: List[str]) -> None:
""" Forge Plugin """
process = Popen(command)
process = subprocess.Popen(command)

stdout, stderr = process.communicate()
if stdout:
Expand Down
12 changes: 6 additions & 6 deletions forge/forge.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import os
from json import loads
from pathlib import Path
from typing import Dict, List, Any
from typing import Any, Dict, List

from tabulate import tabulate
from halo import Halo
import tabulate
import halo

from .exceptions import PluginManagementFatalException
from forge.exceptions import PluginManagementFatalException

FORGE_PATH = os.path.join(Path.home(), '.forge')
PLUGIN_PATH = os.path.join(FORGE_PATH, 'venvs')
Expand Down Expand Up @@ -76,6 +76,6 @@ def list_plugins() -> None:
for config in get_plugins()]

if len(tabulated_data) == 0:
Halo().warn('No forge plugins installed yet! - Run forge --help for help')
halo.Halo().warn('No forge plugins installed yet! - Run forge --help for help')
else:
print(tabulate(tabulated_data, ['plugin', 'version']), end='\n\n')
print(tabulate.tabulate(tabulated_data, ['plugin', 'version']), end='\n\n')
16 changes: 8 additions & 8 deletions forge/pipx_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@


import re
from subprocess import PIPE, CalledProcessError, Popen
import subprocess
from typing import List, Tuple

from halo import Halo
import halo

from .exceptions import (PluginManagementFatalException,
PluginManagementWarnException)
from forge.exceptions import (PluginManagementFatalException,
PluginManagementWarnException)

DOTS = {
"interval": 80,
"frames": ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
}


def make_spinner(text: str) -> Halo:
def make_spinner(text: str) -> halo.Halo:
""" Creates uniform stylized Halo spinner """
return Halo(
return halo.Halo(
text=text,
spinner=DOTS,
color='blue'
Expand All @@ -42,7 +42,7 @@ def determine_is_fatal_error(current_error_message: str) -> bool:
def run_command(command: List[str]) -> Tuple[str, str]:
""" Wrapper to simplify handling subprocess commands """
try:
process = Popen(command, stdout=PIPE, stderr=PIPE)
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

stdout, stderr = process.communicate()

Expand All @@ -51,7 +51,7 @@ def run_command(command: List[str]) -> Tuple[str, str]:

return stdout.decode(), stderr.decode()

except CalledProcessError as err:
except subprocess.CalledProcessError as err:
raise PluginManagementFatalException(err) from None


Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[mypy]
warn_redundant_casts = True
warn_unused_ignores = True
warn_unreachable = True
disallow_subclassing_any = False
ignore_missing_imports = True

disallow_untyped_calls = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
check_untyped_defs = True
no_implicit_optional = True
strict_optional = True
strict_optional = True
11 changes: 0 additions & 11 deletions test.ps1

This file was deleted.

Loading