picox


Namepicox JSON
Version 1.3.0 PyPI version JSON
download
home_pageNone
SummaryTools for working with a Rasbperry Pi Pico running MicroPython
upload_time2024-05-03 20:15:15
maintainerNone
docs_urlNone
authorHarvey
requires_pythonNone
licenseMIT License Copyright (c) 2024 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords pico serial raspberrypi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # picox
`picox` is a tool that facilitates the interaction with Raspberry Pi Pico running MicroPython boards through the terminal or within a Python script. This uses the USB serial port for communication.

Windows, Linux and macOS are supported.

## Features
- Detect a connected Raspberry Pi Pico device running MicroPython
- REPL session
- File operations: Upload, download, execute, and list files on Pi Pico
- Stop current execution on device

## Known issues
- REPL can timeout on long operations such as sleep. Its in the nature of how it scans for the end
- Line endings of files coming out can get a little strange. watch out if there are som extra spaces etc. Best bet is to ensure you always work in the same line endings
- File operations do not include folder operations __yet__
- Most commands will halt what is running on the pico. Such as a detect will stop execution in order to get a good communication test. For a more manual detection, you can use `picox attach <device>` to try and stream stdout from the pico

## Installation
Install via `pip`:

``` bash 
pip install picox
```


## CLI Usage


### Detecting Pi Pico:
``` bash
# get first found device
picox detect

# get a list of all connected pico devices
pico detect --all

# Output: COM7 or /dev/ttyUSB0
```

### REPL session on Pi Pico
``` bash
picox repl /dev/ttyUSB0
```

### View console output from already running pico
``` bash
picox attach /dev/ttyUSB0
```

### Soft reboot pico
``` bash
picox reboot /dev/ttyUSB0
```

### Listing files on Pi Pico:
``` bash
picox ls /dev/ttyUSB0

# exmaple output:
# demo.py
# home.py
```

### Uploading a file:
``` bash
picox upload /dev/ttyUSB0 local.py remote.py --overwrite

# --overrite to force update the file on the Pi Pico
```

### Downloading a file:
``` bash
picox download /dev/ttyUSB0 remote.py local.py
```

### Executing a file on Pi Pico:
``` bash
picox exec /dev/ttyUSB0 remote.py
```

### Stopping any ongoing operation on Pi Pico:
``` bash
picox stop /dev/ttyUSB0
```


## Python Script Usage
You can also use picox within your Python scripts as follows:

``` python
from picox import Pico
from picox.detect import get_first_pico_serial


# Init device
serial_device = get_first_pico_serial()
pico = Pico(serial_device)

# File listing
for file in pico.get_file_list():
    print(file)

# Download
with open("./local/demo.py", "w") as download_file:
    pico.download_file("remote_demo.py", download_file)

# Upload
with open("./local/demo.py", "rb") as upload_file:
    pico.upload_file(upload_file, "remote_demo.py", overwrite=True)

# Execute
pico.execute_file("remote_demo.py")

# Halt execution on device
pico.stop_exec()

# Soft reboot device
pico.send_soft_reboot()
```

## Local development
1. Create virtual env
``` bash
python -m venv _env
```
2. Activate env
``` bash
# Win
_env/Scripts/activate.ps1
# nix
source _env/bin/activate
```
3. Install requirements
``` bash
pip install -r requirement.txt
```
4. Install module editable
```
pip install -e .
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "picox",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "pico, serial, RaspberryPi",
    "author": "Harvey",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/6d/cb/cd8d4e700e85392ee3f06722500900c47a3522bd30ad3f769b1bdba8ef35/picox-1.3.0.tar.gz",
    "platform": null,
    "description": "# picox\n`picox` is a tool that facilitates the interaction with Raspberry Pi Pico running MicroPython boards through the terminal or within a Python script. This uses the USB serial port for communication.\n\nWindows, Linux and macOS are supported.\n\n## Features\n- Detect a connected Raspberry Pi Pico device running MicroPython\n- REPL session\n- File operations: Upload, download, execute, and list files on Pi Pico\n- Stop current execution on device\n\n## Known issues\n- REPL can timeout on long operations such as sleep. Its in the nature of how it scans for the end\n- Line endings of files coming out can get a little strange. watch out if there are som extra spaces etc. Best bet is to ensure you always work in the same line endings\n- File operations do not include folder operations __yet__\n- Most commands will halt what is running on the pico. Such as a detect will stop execution in order to get a good communication test. For a more manual detection, you can use `picox attach <device>` to try and stream stdout from the pico\n\n## Installation\nInstall via `pip`:\n\n``` bash \npip install picox\n```\n\n\n## CLI Usage\n\n\n### Detecting Pi Pico:\n``` bash\n# get first found device\npicox detect\n\n# get a list of all connected pico devices\npico detect --all\n\n# Output: COM7 or /dev/ttyUSB0\n```\n\n### REPL session on Pi Pico\n``` bash\npicox repl /dev/ttyUSB0\n```\n\n### View console output from already running pico\n``` bash\npicox attach /dev/ttyUSB0\n```\n\n### Soft reboot pico\n``` bash\npicox reboot /dev/ttyUSB0\n```\n\n### Listing files on Pi Pico:\n``` bash\npicox ls /dev/ttyUSB0\n\n# exmaple output:\n# demo.py\n# home.py\n```\n\n### Uploading a file:\n``` bash\npicox upload /dev/ttyUSB0 local.py remote.py --overwrite\n\n# --overrite to force update the file on the Pi Pico\n```\n\n### Downloading a file:\n``` bash\npicox download /dev/ttyUSB0 remote.py local.py\n```\n\n### Executing a file on Pi Pico:\n``` bash\npicox exec /dev/ttyUSB0 remote.py\n```\n\n### Stopping any ongoing operation on Pi Pico:\n``` bash\npicox stop /dev/ttyUSB0\n```\n\n\n## Python Script Usage\nYou can also use picox within your Python scripts as follows:\n\n``` python\nfrom picox import Pico\nfrom picox.detect import get_first_pico_serial\n\n\n# Init device\nserial_device = get_first_pico_serial()\npico = Pico(serial_device)\n\n# File listing\nfor file in pico.get_file_list():\n    print(file)\n\n# Download\nwith open(\"./local/demo.py\", \"w\") as download_file:\n    pico.download_file(\"remote_demo.py\", download_file)\n\n# Upload\nwith open(\"./local/demo.py\", \"rb\") as upload_file:\n    pico.upload_file(upload_file, \"remote_demo.py\", overwrite=True)\n\n# Execute\npico.execute_file(\"remote_demo.py\")\n\n# Halt execution on device\npico.stop_exec()\n\n# Soft reboot device\npico.send_soft_reboot()\n```\n\n## Local development\n1. Create virtual env\n``` bash\npython -m venv _env\n```\n2. Activate env\n``` bash\n# Win\n_env/Scripts/activate.ps1\n# nix\nsource _env/bin/activate\n```\n3. Install requirements\n``` bash\npip install -r requirement.txt\n```\n4. Install module editable\n```\npip install -e .\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Tools for working with a Rasbperry Pi Pico running MicroPython",
    "version": "1.3.0",
    "project_urls": {
        "Documentation": "https://github.com/SparkyTheAlbino/picox",
        "Homepage": "https://github.com/SparkyTheAlbino/picox",
        "Issues": "https://github.com/SparkyTheAlbino/picox/issues",
        "Repository": "https://github.com/SparkyTheAlbino/picox.git"
    },
    "split_keywords": [
        "pico",
        " serial",
        " raspberrypi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7312ed80cc5e125c83b08b4f2348dfee41871585096a37a4b0f14ffe6c96e577",
                "md5": "904ba5374b5b0f53fbc56e3d3e259afe",
                "sha256": "456ed0b5072d0c85a15a9ba2bae9759921c89c07f4c4e61e391a36af32123751"
            },
            "downloads": -1,
            "filename": "picox-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "904ba5374b5b0f53fbc56e3d3e259afe",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11088,
            "upload_time": "2024-05-03T20:14:59",
            "upload_time_iso_8601": "2024-05-03T20:14:59.242123Z",
            "url": "https://files.pythonhosted.org/packages/73/12/ed80cc5e125c83b08b4f2348dfee41871585096a37a4b0f14ffe6c96e577/picox-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6dcbcd8d4e700e85392ee3f06722500900c47a3522bd30ad3f769b1bdba8ef35",
                "md5": "cccec43fc958af08da6cc5acda7738ab",
                "sha256": "49f88679efcb4c2334ae48f8bac0448c94582ba58c0759f455ef959b91084e47"
            },
            "downloads": -1,
            "filename": "picox-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cccec43fc958af08da6cc5acda7738ab",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11484,
            "upload_time": "2024-05-03T20:15:15",
            "upload_time_iso_8601": "2024-05-03T20:15:15.687876Z",
            "url": "https://files.pythonhosted.org/packages/6d/cb/cd8d4e700e85392ee3f06722500900c47a3522bd30ad3f769b1bdba8ef35/picox-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-03 20:15:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SparkyTheAlbino",
    "github_project": "picox",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "picox"
}
        
Elapsed time: 0.24605s