Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 35 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,70 @@ on:
workflow_dispatch: # Start a workflow
push:


jobs:
build:
build:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Check Python
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-path: |
pyproject.toml
uv.lock
- name: Check Python and uv
run: |
python -V
which python
uv run python -V
uv run python -c "import sys,shutil;print(sys.executable);print(shutil.which('python') or '')"
uv --version
echo $PATH
- name: Install dependencies
- name: Install dependencies with uv
run: |
python -m pip install --upgrade pip
pip install -U tox pytest
pip install -e .
uv sync --dev
- name: Python Lint
run: |
tox -e lint
uv run make lint
- name: Integration Tests
run: |
make test
uv run make test
- name: Pack Installer Script
run: |
make pack
uv run make pack
- name: Copy Installer Script to Parent Directory
run: |
cp dist/*.py .
shell: bash
- name: Commit changed `get-platformio.py`
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Github Action: Updated `get-platformio.py`"
- name: Install PlatformIO Core
run: |
python3 get-platformio.py
uv run python get-platformio.py
if [ "$RUNNER_OS" == "Windows" ]; then
~/.platformio/penv/Scripts/pio.exe system info
else
~/.platformio/penv/bin/pio system info
fi
shell: bash
- name: Verify uv is installed in PlatformIO penv
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
~/.platformio/penv/Scripts/uv.exe --version
else
~/.platformio/penv/bin/uv --version
fi
shell: bash
44 changes: 44 additions & 0 deletions .github/workflows/test-get-platformio-no-uv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test get-platformio.py without uv

on:
workflow_dispatch: # Start a workflow
push:

jobs:
test:
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-latest, macos-13, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Ensure uv is not installed
run: |
pip uninstall -y uv || true
if python -m uv --version 2>/dev/null; then exit 1; fi
shell: bash
- name: Run get-platformio.py
run: |
python get-platformio.py
shell: bash
- name: Install PlatformIO Core
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
~/.platformio/penv/Scripts/pio.exe system info
else
~/.platformio/penv/bin/pio system info
fi
shell: bash
- name: Verify uv is installed in PlatformIO penv
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
~/.platformio/penv/Scripts/uv.exe --help
else
~/.platformio/penv/bin/uv --help
fi
shell: bash
11 changes: 11 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "lint",
"type": "shell",
"command": "make lint",
"group": { "kind": "test", "isDefault": true }
}
]
}
29 changes: 20 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
# Use uv for all operations

# Always use phony targets
.PHONY: all lint isort format test install-dev pack before-commit clean publish

# Default target
all: before-commit

lint:
pylint --rcfile=./.pylintrc ./pioinstaller
uv run pylint --rcfile=./.pylintrc ./pioinstaller

isort:
isort ./tests
isort ./pioinstaller
uv run isort ./pioinstaller ./tests

format:
black ./pioinstaller
black ./tests
uv run black ./pioinstaller ./tests

test:
py.test --verbose --capture=no --exitfirst tests
uv run pytest --verbose --capture=no --exitfirst tests

install-dev:
uv sync --dev

pack:
pioinstaller pack
mkdir -p dist
uv run pioinstaller pack dist/

before-commit: isort format lint
before-commit: isort format lint test

clean:
find . -name \*.pyc -delete
find . -name __pycache__ -delete
rm -rf .cache

publish:
python setup.py sdist upload
uv build
uv publish
45 changes: 44 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
pioarduino Core Installer
=========================

A standalone installer for `pioarduino Core`
A standalone installer for `pioarduino Core` using modern Python packaging tools.

**Important:** The installer checks for Python 3.10–3.13 and uses `uv` to install pioarduino core. If no compatible Python is found, it will install Python 3.13.

Features
--------

* Fast installation using `uv` package manager
* Isolated virtual environment creation
* Cross-platform compatibility (Windows, macOS, Linux)
* Python 3.10+ support

Requirements
------------

* Python 3.9 or newer for install
* Internet connection for downloading packages

Development
-----------

This project uses modern Python packaging with `pyproject.toml` and `uv`.

Quick start for development (Linux and macOS)::

# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone and setup development environment
git clone https://github.com/Jason2866/pioarduino-core-installer.git
cd pioarduino-core-installer

# Install dependencies with uv
uv sync --dev

# Run tests
uv run pytest

# Format code
uv run black pioinstaller tests
uv run isort pioinstaller tests

# Run linter
uv run pylint pioinstaller
2 changes: 1 addition & 1 deletion get-platformio.py

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions pioinstaller/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
# Copyright (c) 2024-present pioarduino
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,20 +15,19 @@

import logging.config

VERSION = (1, 2, 3)
__version__ = ".".join([str(s) for s in VERSION])
__version__ = "1.4.0"

__title__ = "pioarduino-installer"
__description__ = "An installer for PlatformIO pioarduino Core"
__description__ = "An installer for pioarduino Core"

__url__ = "https://pioarduino.org"
__url__ = "https://github.com/pioarduino/pioarduino-core-installer"

__author__ = "PlatformIO Labs and pioarduino"
__email__ = "contact@piolabs.com"
__contact__ = "https://discord.gg/Nutz9crnZr"


__license__ = "Apache-2.0"
__copyright__ = "Copyright 2014-present PlatformIO and pioarduino"
__copyright__ = "Copyright 2014-present PlatformIO and 2024-present pioarduino"


logging.basicConfig(format="%(levelname)s: %(message)s")
Expand Down
10 changes: 2 additions & 8 deletions pioinstaller/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,12 @@
multiple=True,
help="A path to Python to be ignored (multiple options and unix wildcards are allowed)",
)
@click.option(
"--pypi-index-url",
help="Custom base URL of the Python Package Index (default `https://pypi.org/simple`)",
)
@click.pass_context
def cli(
ctx, verbose, shutdown_piohome, dev, ignore_python, pypi_index_url
ctx, verbose, shutdown_piohome, dev, ignore_python
): # pylint: disable=too-many-arguments,too-many-positional-arguments
if verbose:
logging.getLogger("pioinstaller").setLevel(logging.DEBUG)
if pypi_index_url:
os.environ["PIP_INDEX_URL"] = pypi_index_url
ctx.obj["dev"] = dev
if ctx.invoked_subcommand:
return
Expand Down Expand Up @@ -90,7 +84,7 @@ def python():
% (platform.python_version(), util.get_pythonexe_path()),
fg="green",
)
except (exception.IncompatiblePythonError, exception.PythonVenvModuleNotFound) as e:
except exception.IncompatiblePythonError as e:
raise click.ClickException(
"The Python %s (%s) interpreter is not compatible.\nReason: %s"
% (platform.python_version(), util.get_pythonexe_path(), str(e))
Expand Down
Loading