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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: pip
- package-ecosystem: uv
directory: "/"
schedule:
interval: weekly
Expand Down
45 changes: 20 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.13"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: pip install pre-commit
run: uv sync --group dev --frozen
- name: Run pre-commit
run: pre-commit run --all-files
run: uv run pre-commit run --all-files

test-app:
runs-on: ubuntu-latest
Expand All @@ -32,25 +34,23 @@ jobs:
- name: Setup and run ganache
run: docker run --detach --publish 8545:8545 --network ganache -e DOCKER=true trufflesuite/ganache:latest --defaultBalanceEther 10000 --gasLimit 10000000 -a 30 --chain.chainId 1337 --chain.networkId 1337 -d
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'requirements*.txt'
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: |
pip install -r requirements-test.txt coveralls pre-commit
pip install -e .
env:
PIP_USE_MIRRORS: true
run: uv sync --group dev --all-extras --frozen
- name: Run tests and coverage
run: |
coverage run -m pytest -rxXs
coverage combine
uv run coverage run -m pytest -rxXs
uv run coverage combine
uv run coverage lcov -o coverage.lcov
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
file: coverage.lcov
flag-name: run-${{ matrix.python-version }}
parallel: true

Expand All @@ -70,21 +70,16 @@ jobs:
if: github.event_name == 'release' && github.event.action == 'released'
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: '3.13'
cache: 'pip'
cache-dependency-path: 'requirements*.txt'
- name: Deploy Package
run: |
python -m pip install --upgrade build twine pip
python -m build
twine check dist/*
twine upload dist/*
uv build
uv publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_TOKEN }}

docker-deploy:
runs-on: ubuntu-latest
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,7 +6,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 26.1.0
rev: 26.3.1
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
Expand All @@ -17,6 +17,7 @@ repos:
rev: v6.0.0
hooks:
- id: check-added-large-files
args: ['--maxkb=1024']
- id: check-docstring-first
- id: check-merge-conflict
- id: check-symlinks
Expand All @@ -25,5 +26,4 @@ repos:
- id: detect-private-key
- id: end-of-file-fixer
types: [python]
- id: requirements-txt-fixer
- id: trailing-whitespace
16 changes: 14 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
FROM python:3.13-alpine

WORKDIR /app/

# Install uv — copy binary from official image, no pip bootstrap needed
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

ENV VIRTUAL_ENV=/app/.venv
ENV PATH="/app/.venv/bin:${PATH}"

RUN apk add build-base
COPY setup.* README.md pyproject.toml ./

# Install dependencies first for better layer caching
COPY pyproject.toml uv.lock README.md ./
RUN uv sync --no-dev --frozen --no-install-project

# Copy source and install the project itself (provides safe-cli / safe-creator entry points)
COPY src ./src
RUN pip install -U pip && pip install .
RUN uv sync --no-dev --frozen
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ docker run -it safeglobal/safe-cli safe-cli <checksummed_safe_address> <ethereum

## Using Python PIP

**Prerequisite:** [Python](https://www.python.org/downloads/) >= 3.10 (Python 3.13 is recommended).
**Prerequisite:** [Python](https://www.python.org/downloads/) >= 3.10 (Python 3.13 is recommended) and [uv](https://docs.astral.sh/uv).

Once `Python` and `uv` are installed on your system, install Safe CLI:

Once Python is installed on your system, run the following command to install Safe CLI:
```bash
pip3 install -U safe-cli
uv tool install safe-cli
```

## Usage
Expand Down Expand Up @@ -155,19 +156,21 @@ If you miss something and want to send us a PR:
```bash
git clone https://github.com/safe-global/safe-cli.git
cd safe-cli
stat venv 2>/dev/null || python3 -m venv venv
source venv/bin/activate && pip install -r requirements-dev.txt
uv sync --group dev --frozen
source .venv/bin/activate
pre-commit install -f
```

To run the local version you can install it using:
To run `safe-cli` or `safe-creator`:

```bash
pip install .
uv run safe-cli
uv run safe-creator
```

## Contributors

- [Pedro Arias Ruiz](https://github.com/AsiganTheSunk)
- [Uxío Fuentefría](https://github.com/uxio0)
- [Moisés Fernández](https://github.com/moisses89)
- [Felipe Alvarado](https://github.com/falvaradorodriguez)
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies = [
"typer>=0.14.0",
]


[project.optional-dependencies]
ledger = ["ledgereth==0.10.0"]
trezor = ["trezor==0.13.10"]
Expand All @@ -43,6 +44,19 @@ safe-creator = "safe_cli.safe_creator:main"
Download = "https://github.com/gnosis/safe-cli/releases"
Homepage = "https://github.com/gnosis/safe-cli"

[dependency-groups]
dev = [
"coverage==7.13.4",
"flake8==7.3.0",
"hatch",
"ipdb",
"ipython",
"isort",
"pre-commit",
"pytest==9.0.2",
"pytest-sugar==1.1.1",
]

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

Expand Down Expand Up @@ -98,6 +112,11 @@ sections = [
"LOCALFOLDER",
]

[tool.uv]
# Reject packages published less than 7 days ago to avoid supply-chain attacks
exclude-newer = "7 days"
compile-bytecode = true

[tool.mypy]
python_version = "3.12"
check_untyped_defs = true
Expand Down
8 changes: 0 additions & 8 deletions requirements-dev.txt

This file was deleted.

5 changes: 0 additions & 5 deletions requirements-test.txt

This file was deleted.

12 changes: 0 additions & 12 deletions requirements.txt

This file was deleted.

Loading
Loading