[{"element_type":"text","content":"\n  \n  \n        \u003cp\u003eMad With Power, or just keeping it on the down-low... There's a few good reasons to want to create or use a custom bundle of libraries for circuitpython!\u003c/p\u003e\n\u003cp\u003ePerhaps you write educational guides and lesson plans and want to have all your custom requirements in once easy to use place. Maybe you've got enough private, rudely-named, or \u003ca href=\"https://github.com/orgs/good-enough-technology/repositories\"\u003etrademark-infringing libraries\u003c/a\u003e / drivers / helpers for CircuitPython that you won't add to the community bundle, but still want the convenience of \u003ccode\u003ecircup\u003c/code\u003e (\u003cstrong\u003ethe package manager \u003c/strong\u003efor \u003cstrong\u003eCircuitPython\u003c/strong\u003e).\u003c/p\u003e\n\u003cp\u003eI love having a package manager for circuitpython (currently supports USB mass storage based devices, but theres a pull-request for web-workflow suppport).\u003cbr\u003e\u003ccode\u003ecircup install --auto --py\u003c/code\u003e and I get all my dependencies in readable form, modifiable even if I so wish!\u003c/p\u003e\n\u003cp\u003eSo a recent pull request caught my attention, for circup-depenencies that weren't in the pypi repository (python package hosting used by `pip`) yet or at all. That's the exact state of my libraries!\u003c/p\u003e\n\u003cp\u003eI also was aware of seeing a \u003cstrong\u003ebundle-add \u003c/strong\u003eoption for circup, used to add custom library bundles, so this weekend was time to bring it all together.\u003c/p\u003e\n\u003ch2\u003eMinor \u003ca href=\"https://en.wiktionary.org/wiki/yak_shaving\"\u003eYak Shaving\u003c/a\u003e - Get Library Ready\u003c/h2\u003e\n\u003cp\u003eI've cleaned up the library enough to have a releasable thing, but never sorted the docs. The project is a fork of a Sensirion python library, for which I actually have permission to use their name, but to avoid any issues I wanted to have a way without friction, like a custom library bundle. Anyway the docs use Sphinx, and the read-the-docs theme, but are an old form of config etc, so I cleaned up that to the point of publishing to github pages.\u003c/p\u003e\n\u003cp\u003eThen I could setup a pyproject.toml file with a \u003ccode\u003e[circup]\u003c/code\u003e section, and inside a field called \u003ccode\u003ecircup_dependencies\u003c/code\u003e with an array of strings. Similar to this:\u003c/p\u003e\n      \n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/000/498/original/Screenshot_2023-11-25_222819.png?1700951322","metadata":{"caption":""}},{"element_type":"text","content":"\n        \u003cp\u003eAfter looking at the \u003ca href=\"https://github.com/adafruit/CircuitPython_Community_Bundle\"\u003ecurrent community bundle\u003c/a\u003e (which has a build script, and publishes json+zips with each release) I noticed the dependencies were only setup for a requirements.txt and not the new pyproject.toml circup_dependencies section. The build script did however include the requirements.txt and pyproject.toml for each included library in the built release assets (a zip for each mpy/circuitpython version plus a python file version).\u003c/p\u003e\n\u003cp\u003eAs a result of this I've included fake requirements in my requirements.txt (they will actually pass and install with python on a pc as the names match the official libraries. Then the two circuitpython dependencies are included in pyproject.toml as described above.\u003c/p\u003e\n\u003cp\u003eThe last thing was that there were two libraries for release, the Sensirion SEN5x device driver, and a base Sensirion I2C python driver. Both of these need to be submoduled into my bundle repo, in a similar fashion to the official community bundle repo.\u003c/p\u003e\n\u003ch2\u003eCreate the bundle\u003c/h2\u003e\n\u003cp\u003eSimplest for me was to fork the community bundle, then clone it locally and \u003ccode\u003egit submodule deinit --all -f\u003c/code\u003e and delete all the submodules, then add the two of my own, and tweak the readme. I also stopped the CI script from attempting to publish to AWS S3. It's worth noting it will error if the submodules commit reference doesn't match latest tag.\u003c/p\u003e\n\u003cp\u003eThe usual \u003ccode\u003egit submodule add\u003c/code\u003e, for each library to be included, and if you update things in the driver repos then craft a new release for them and then come back to the bundle repo and enter the library submodule folder and \u003ccode\u003egit pull\u003c/code\u003e then commit and push those changes, then create a new release of the bundle. Probably equally wise to use the update script or tweak the CI script to update and release (could be scheduled).\u003c/p\u003e\n\u003ch2\u003eUse the Bundle\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003ecircup bundle-add \u003c/code\u003e\u0026lt;github_owner\u0026gt;\u003ccode\u003e/\u003c/code\u003e\u0026lt;github_repository_name\u0026gt;\u003c/p\u003e\n\u003cp\u003ee.g. for https://github.com/good-enough-technology/CircuitPython_GoodEnough_Bundle\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003ecircup bundle-add good-enough-technology/circuitpython_goodenough_bundle\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003ethen install newly available package:\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003ecircup install sensirion_i2c_sen5x\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003e(I prefer to add the --py option to get readable python instead of .mpy module files)\u003c/p\u003e\n\u003cp\u003e \u003c/p\u003e\n      ","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/000/499/original/Screenshot_2023-11-25_223043.png?1700951459","metadata":{"caption":""}}]