Skip to content

Commit

Permalink
Merge 2645a3c into fa002da
Browse files Browse the repository at this point in the history
  • Loading branch information
Uxio0 committed Jun 7, 2024
2 parents fa002da + 2645a3c commit e5ad370
Show file tree
Hide file tree
Showing 36 changed files with 126 additions and 72 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ jobs:
cache-dependency-path: 'requirements*.txt'
- name: Install dependencies
run: |
pip install wheel
pip install -r requirements-test.txt coveralls pre-commit
pip install -e .
env:
PIP_USE_MIRRORS: true
- name: Run tests and coverage
run: |
pytest -rxXs
coverage run --source=$SOURCE_FOLDER -m pytest -rxXs
env:
SOURCE_FOLDER: safe_cli
coverage run -m pytest -rxXs
coverage combine
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
Expand All @@ -73,13 +71,13 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
cache: 'pip'
cache-dependency-path: 'requirements*.txt'
- name: Deploy Package
run: |
python -m pip install --upgrade setuptools wheel twine
python setup.py sdist bdist_wheel
python -m pip install --upgrade build twine
python -m build
twine check dist/*
twine upload dist/*
env:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-docstring-first
- id: check-merge-conflict
Expand Down
106 changes: 106 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "safe-cli"
dynamic = ["version"]
description = "Command Line Interface for Safe"
readme = "README.md"
license = "MIT"
requires-python = ">=3.8"
authors = [{ name = "Uxío Fuentefría", email = "uxio@safe.global" }]
classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"art>=6",
"colorama>=0.4",
"prompt_toolkit>=3",
"pygments>=2",
"requests>=2",
"safe-eth-py==6.0.0b17",
"tabulate>=0.8",
]

[project.optional-dependencies]
ledger = ["ledgereth==0.9.1"]
trezor = ["trezor==0.13.8"]

[project.scripts]
safe-cli = "safe_cli.main:main"
safe-creator = "safe_cli.safe_creator:main"

[project.urls]
Download = "https://github.com/gnosis/safe-cli/releases"
Homepage = "https://github.com/gnosis/safe-cli"

[tool.hatch.version]
path = "src/safe_cli/__init__.py"

[tool.hatch.envs.types]
extra-dependencies = ["mypy>=1.0.0"]

[tool.hatch.envs.types.scripts]
check = "mypy --install-types --non-interactive {args:src/safe_cli tests}"

[tool.hatch.build.targets.sdist]
include = ["/src/safe_cli"]

[tool.hatch.build.targets.wheel]
packages = ["/src/safe_cli"]

[tool.coverage.run]
source_pkgs = ["safe_cli", "tests"]
branch = true
parallel = true
omit = [
"*__init__.py*",
"*tests*",
"*/migrations/*"
]

[tool.coverage.paths]
safe_cli = ["src/safe_cli", "*/safe-cli/src/safe_cli"]
tests = ["tests", "*/safe-cli/tests"]

[tool.coverage.report]
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"if settings.DEBUG",
"raise NotImplementedError",
"pass",
]

[tool.isort]
profile = "black"
default_section = "THIRDPARTY"
known_first_party = "safe_cli"
known_safe_foundation = ["py_eth_sig_utils", "gnosis"]
known_django = "django"
sections = [
"FUTURE",
"STDLIB",
"DJANGO",
"THIRDPARTY",
"SAFE_FOUNDATION",
"FIRSTPARTY",
"LOCALFOLDER",
]

[tool.mypy]
python_version = "3.12"
check_untyped_defs = true
ignore_missing_imports = true
warn_unused_ignores = true
warn_redundant_casts = true
warn_unused_configs = true
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-r requirements.txt
-r requirements-test.txt
flake8
hatch
ipdb
ipython
isort
Expand Down
3 changes: 3 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#/usr/bin/env sh
pip install -e .
pytest
Empty file.
1 change: 0 additions & 1 deletion safe_cli/version.py

This file was deleted.

10 changes: 1 addition & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,4 @@ exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv

[pycodestyle]
max-line-length = 120
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv

[isort]
profile = black
default_section = THIRDPARTY
known_first_party = safe_cli
known_gnosis = py_eth_sig_utils,gnosis
known_django = django
sections = FUTURE,STDLIB,DJANGO,THIRDPARTY,GNOSIS,FIRSTPARTY,LOCALFOLDER
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv
48 changes: 0 additions & 48 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions src/safe_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION = "1.0.0"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions safe_cli/main.py → src/safe_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from safe_cli.safe_lexer import SafeLexer
from safe_cli.utils import get_safe_from_owner

from .version import version
from . import VERSION


class SafeCli:
Expand All @@ -45,7 +45,7 @@ def __init__(self, safe_address: ChecksumAddress, node_url: str, history: bool):

def print_startup_info(self):
print_formatted_text(text2art("Safe CLI")) # Print fancy text
print_formatted_text(HTML(f"<b><ansigreen>Version {version}</ansigreen></b>"))
print_formatted_text(HTML(f"<b><ansigreen>Version {VERSION}</ansigreen></b>"))
print_formatted_text(
HTML("<b><ansigreen>Loading Safe information...</ansigreen></b>")
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions safe_cli/utils.py → src/safe_cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def choose_option_from_list(
number_options = len(options)
for number_option, option in enumerate(options):
print_formatted_text(HTML(f"{number_option} - <b>{option}</b> "))
choices = f" [0-{number_options-1}] default {default_option}: "
choices = f" [0-{number_options - 1}] default {default_option}: "
reply = str(get_input(question + choices)).lower().strip() or str(default_option)
try:
option = int(reply)
Expand All @@ -73,7 +73,9 @@ def choose_option_from_list(

if option not in range(0, number_options):
print_formatted_text(
HTML(f"<ansired> {option} is not between [0-{number_options-1}] </ansired>")
HTML(
f"<ansired> {option} is not between [0-{number_options - 1}] </ansired>"
)
)
return None

Expand Down

0 comments on commit e5ad370

Please sign in to comment.