{"id":13605354,"url":"https://github.com/micropython/micropython-lib","last_synced_at":"2025-05-12T13:13:56.659Z","repository":{"id":15590253,"uuid":"18326156","full_name":"micropython/micropython-lib","owner":"micropython","description":"Core Python libraries ported to MicroPython","archived":false,"fork":false,"pushed_at":"2025-04-24T07:03:30.000Z","size":2494,"stargazers_count":2586,"open_issues_count":277,"forks_count":1041,"subscribers_count":123,"default_branch":"master","last_synced_at":"2025-05-12T13:13:38.392Z","etag":null,"topics":["micropython"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micropython.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-04-01T10:47:14.000Z","updated_at":"2025-05-11T15:23:14.000Z","dependencies_parsed_at":"2023-10-04T10:02:42.919Z","dependency_job_id":"c05dc77e-3194-4a41-87af-f237dffec130","html_url":"https://github.com/micropython/micropython-lib","commit_stats":{"total_commits":1596,"total_committers":94,"mean_commits":16.97872340425532,"dds":0.2543859649122807,"last_synced_commit":"394cbfc98a333dd1d4db35fb69379c72c30337f3"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropython%2Fmicropython-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropython%2Fmicropython-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropython%2Fmicropython-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropython%2Fmicropython-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micropython","download_url":"https://codeload.github.com/micropython/micropython-lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745196,"owners_count":21957319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["micropython"],"created_at":"2024-08-01T19:00:57.760Z","updated_at":"2025-05-12T13:13:56.622Z","avatar_url":"https://github.com/micropython.png","language":"Python","readme":"# micropython-lib\n\nThis is a repository of packages designed to be useful for writing MicroPython\napplications.\n\nThe packages here fall into categories corresponding to the four top-level\ndirectories:\n\n* **python-stdlib**: Compatible versions of modules from [The Python Standard\n    Library](https://docs.python.org/3/library/). These should be drop-in\n    replacements for the corresponding Python modules, although many have\n    reduced functionality or missing methods or classes (which may not be an\n    issue for most cases).\n\n * **python-ecosys**: Compatible, but reduced-functionality versions of\n     packages from the wider Python ecosystem. For example, a package that\n     might be found in the [Python Package Index](https://pypi.org/).\n\n * **micropython**: MicroPython-specific packages that do not have equivalents\n     in other Python environments. This includes drivers for hardware\n     (e.g. sensors, peripherals, or displays), libraries to work with\n     embedded functionality (e.g. bluetooth), or MicroPython-specific\n     packages that do not have equivalents in CPython.\n\n* **unix-ffi**: These packages are specifically for the MicroPython Unix port\n    and provide access to operating-system and third-party libraries via FFI,\n    or functionality that is not useful for non-Unix ports.\n\n## Usage\n\nTo install a micropython-lib package, there are four main options. For more\ninformation see the [Package management documentation](https://docs.micropython.org/en/latest/reference/packages.html)\ndocumentation.\n\n### On a network-enabled device\n\nAs of MicroPython v1.20 (and nightly builds since October 2022), boards\nwith WiFi and Ethernet support include the `mip` package manager.\n\n```py\n\u003e\u003e\u003e import mip\n\u003e\u003e\u003e mip.install(\"package-name\")\n```\n\n### Using `mpremote` from your PC\n\n`mpremote` is the officially-supported tool for interacting with a MicroPython\ndevice and, since v0.4.0, support for installing micropython-lib packages is\nprovided by using the `mip` command.\n\n```bash\n$ mpremote connect /dev/ttyUSB0 mip install package-name\n```\n\nSee the [mpremote documentation](https://docs.micropython.org/en/latest/reference/mpremote.html).\n\n### Freeze into your firmware\n\nIf you are building your own firmware, all packages in this repository include\na `manifest.py` that can be included into your board manifest via the\n`require()` command. See [Manifest files](https://docs.micropython.org/en/latest/reference/manifest.html#require) for\nmore information.\n\n### Copy the files manually\n\nMany micropython-lib packages are just single-file modules, and you can\nquickly get started by copying the relevant Python file to your device. For\nexample, to add the `base64` library, you can directly copy\n`python-stdlib/base64/base64.py` to the `lib` directory on your device.\n\nThis can be done using `mpremote`, for example:\n\n```bash\n$ mpremote connect /dev/ttyUSB0 cp python-stdlib/base64/base64.py :/lib\n```\n\nFor packages that are implemented as a package directory, you'll need to copy\nthe directory instead. For example, to add `collections.defaultdict`, copy\n`collections/collections/__init__.py` and\n`collections-defaultdict/collections/defaultdict.py` to a directory named\n`lib/collections` on your device.\n\nNote that unlike the other three approaches based on `mip` or `manifest.py`,\nyou will need to manually resolve dependencies. You can inspect the relevant\n`manifest.py` file to view the list of dependencies for a given package.\n\n## Installing packages from forks\n\nIt is possible to use the `mpremote mip install` or `mip.install()` methods to\ninstall packages built from a\n[fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks)\nof micropython-lib, if the fork's owner has opted in.\n\nThis can be useful to install packages from a pending Pull Request, for example.\n\nFirst, the owner of the fork must opt-in as described under\n[Publishing packages from forks](CONTRIBUTING.md#publishing-packages-from-forks).\n\nAfter this has happened, each time someone pushes to a branch in that fork then\nGitHub Actions will automatically publish the packages to a GitHub Pages site.\n\nTo install these packages, use commands such as:\n\n```bash\n$ mpremote connect /dev/ttyUSB0 mip install --index https://USERNAME.github.io/micropython-lib/mip/BRANCH_NAME PACKAGE_NAME\n```\n\nOr from a networked device:\n\n```py\nimport mip\nmip.install(PACKAGE_NAME, index=\"https://USERNAME.github.io/micropython-lib/mip/BRANCH_NAME\")\n```\n\n(Where `USERNAME`, `BRANCH_NAME` and `PACKAGE_NAME` are replaced with the owner\nof the fork, the branch the packages were built from, and the package name.)\n\n## Contributing\n\nWe use [GitHub Discussions](https://github.com/micropython/micropython/discussions)\nas our forum, and [Discord](https://micropython.org/discord) for chat. These\nare great places to ask questions and advice from the community or to discuss your\nMicroPython-based projects.\n\nThe [MicroPython Wiki](https://github.com/micropython/micropython/wiki) is\nalso used for micropython-lib.\n\nFor bugs and feature requests, please [raise an issue](https://github.com/micropython/micropython-lib/issues/new).\n\nWe welcome pull requests to add new packages, fix bugs, or add features.\nPlease be sure to follow the\n[Contributor's Guidelines \u0026 Code Conventions](CONTRIBUTING.md). Note that\nMicroPython is licensed under the [MIT license](LICENSE) and all contributions\nshould follow this license.\n\n### Future plans (and new contributor ideas)\n\n* Develop a set of example programs using these packages.\n* Develop more MicroPython packages for common tasks.\n* Expand unit testing coverage.\n* Add support for referencing remote/third-party repositories.\n\n## Notes on terminology\n\nThe terms *library*, *package*, and *module* are overloaded and lead to some\nconfusion. The interpretation used in by the MicroPython project is that:\n\nA *library* is a collection of installable packages, e.g. [The Python Standard\n  Library](https://docs.python.org/3/library/), or micropython-lib.\n\nA *package* can refer to two things. The first meaning, \"library package\", is\nsomething that can be installed from a library, e.g. via `mip` (or `pip` in\nCPython/PyPI). Packages provide *modules* that can be imported. The ambiguity\nhere is that the module provided by the package does not necessarily have to\nhave the same name, e.g. the `pyjwt` package provides the `jwt` module. In\nCPython, the `pyserial` package providing the `serial` module is another\ncommon example.\n\nA *module* is something that can be imported. For example, \"the *os* module\".\n\nA module can be implemented either as a single file, typically also called\na *module* or \"single-file module\", or as a *package* (the second meaning),\nwhich in this context means a directory containing multiple `.py` files\n(usually at least an `__init__.py`).\n\nIn micropython-lib, we also have the concept of an *extension package* which\nis a library package that extends the functionality of another package, by\nadding additional files to the same package directory. These packages have\nhyphenated names. For example, the `collections-defaultdict` package extends\nthe `collections` package to add the `defaultdict` class to the `collections`\nmodule.\n\n","funding_links":[],"categories":["More libraries","硬件_其他"],"sub_categories":["网络服务_其他"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicropython%2Fmicropython-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicropython%2Fmicropython-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicropython%2Fmicropython-lib/lists"}