Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Commit

Permalink
Version 0.1b2
Browse files Browse the repository at this point in the history
  • Loading branch information
aivarannamaa committed May 18, 2021
1 parent 0241fa8 commit c49d734
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 3 deletions.
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

50 changes: 50 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
minipip
=======
Tool for installing distribution packages for MicroPython and CircuitPython.

Supports both `upip-compatible packages <https://docs.micropython.org/en/latest/reference/packages.html>`_.
and regular pip-compatible
packages (by using `pip install --target ... <https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-t>`_).

By default it prefers packages at micropython.org-s index. If the package or required version is not
found there, then it turns to PyPI.

If ``--port`` is given and `rshell <https://pypi.org/project/rshell/>`_ is available then uploads
extracted to the target device, otherwise just extracts to local filesystem.
``--target`` directory must be explicitly given in both cases. If target is local filesystem, then
makes sure data gets synced (useful, if target is a USB volume representing MicroPython or
CircuitPython filesystem)

Usage examples
--------------

* ``minipip install --port /dev/ttyACM0 --target /lib micropython-logging``
* ``minipip install --target G:\lib adafruit-circuitpython-ssd1306``

minipip -h
----------

::

minipip [-h] [-r [REQUIREMENT_FILE [REQUIREMENT_FILE ...]]] [-p [PORT]] -t TARGET_DIR [-i INDEX_URL] [-v] [-q] [--version] {install} [package_spec [package_spec ...]]

Meant for installing both upip and pip compatible distribution packages from PyPI and micropython.org/pi to a local directory, USB volume or directly to MicroPython filesystem over
serial connection (requires rshell).

positional arguments:
{install} Currently the only supported command is 'install'
package_spec Package specification, eg. 'micropython-os' or 'micropython-os>=0.6'

optional arguments:
-h, --help show this help message and exit
-r [REQUIREMENT_FILE [REQUIREMENT_FILE ...]], --requirement [REQUIREMENT_FILE [REQUIREMENT_FILE ...]]
Install from the given requirements file.
-p [PORT], --port [PORT]
Serial port of the device (specify if you want minipip to upload the result to the device)
-t TARGET_DIR, --target TARGET_DIR
Target directory (on device, if port is given, otherwise local)
-i INDEX_URL, --index-url INDEX_URL
Custom index URL
-v, --verbose Show more details about the process
-q, --quiet Don't show non-error output
--version Show program version and exit
25 changes: 24 additions & 1 deletion minipip.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
#!/usr/bin/env python3
"""
MIT License
Copyright (c) 2021 Aivar Annamaa
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.
"""

import io
import json
Expand Down Expand Up @@ -33,7 +56,7 @@ def shlex_join(split_command):
PYPI_INDEX = "https://pypi.org/pypi"
DEFAULT_INDEX_URLS = [MP_ORG_INDEX, PYPI_INDEX]

__version__ = "0.1b1"
__version__ = "0.1b2"


class UserError(RuntimeError):
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
if line.strip() and not line.startswith("#"):
requirements.append(line)

with open(os.path.join(setupdir, "README.rst")) as fp:
long_description = fp.read()

setup(
name="minipip",
version=version,
description="Tool for installing packages for MicroPython and CircuitPython",
long_description=long_description,
url="https://github.com/aivarannamaa/minipip",
author="Aivar Annamaa",
license="MIT",
Expand Down

0 comments on commit c49d734

Please sign in to comment.