{"id":20915787,"url":"https://github.com/brainelectronics/test-pypiserver","last_synced_at":"2025-07-08T12:07:18.276Z","repository":{"id":69601931,"uuid":"555790406","full_name":"brainelectronics/test-pypiserver","owner":"brainelectronics","description":"PyPi Server for test deployments of MicroPython packages","archived":false,"fork":false,"pushed_at":"2022-10-22T12:23:13.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T23:16:29.198Z","etag":null,"topics":["docker-compose","pypiserver"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brainelectronics.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"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}},"created_at":"2022-10-22T10:38:35.000Z","updated_at":"2022-10-23T19:32:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"fcb2efbb-9d54-45ea-ada1-f2740d84b8d4","html_url":"https://github.com/brainelectronics/test-pypiserver","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/brainelectronics/test-pypiserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainelectronics%2Ftest-pypiserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainelectronics%2Ftest-pypiserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainelectronics%2Ftest-pypiserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainelectronics%2Ftest-pypiserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brainelectronics","download_url":"https://codeload.github.com/brainelectronics/test-pypiserver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainelectronics%2Ftest-pypiserver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264267071,"owners_count":23581929,"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":["docker-compose","pypiserver"],"created_at":"2024-11-18T16:18:22.252Z","updated_at":"2025-07-08T12:07:18.254Z","avatar_url":"https://github.com/brainelectronics.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Test PyPi Server\n\nPyPi Server for test deployments of MicroPython packages\n\n---------------\n\n## General\n\nPyPi Server for testing and deploy of MicroPython packages\n\n\u003c!-- MarkdownTOC --\u003e\n\n- [Installation](#installation)\n\t- [Install required tools](#install-required-tools)\n\t\t- [Python](#python)\n\t\t- [Docker Compose](#docker-compose)\n\t\t- [htpasswd](#htpasswd)\n- [Setup](#setup)\n\t- [Directories](#directories)\n\t- [Password file](#password-file)\n\t- [pypirc file](#pypirc-file)\n- [Usage](#usage)\n\t- [Start PyPi server](#start-pypi-server)\n\t- [Upload](#upload)\n\t- [Download](#download)\n\t\t- [Python](#python-1)\n\t\t- [MicroPython](#micropython)\n\t\t\t- [Connect to a network](#connect-to-a-network)\n\t\t\t- [Install latest package version](#install-latest-package-version)\n\t\t\t- [Install specific package version](#install-specific-package-version)\n- [Credits](#credits)\n\n\u003c!-- /MarkdownTOC --\u003e\n\n## Installation\n### Install required tools\n#### Python\n\nPython3 must be installed on your system. Check the current Python version\nwith the following command\n\n```bash\npython --version\npython3 --version\n```\n\nDepending on which command `Python 3.x.y` (with x.y as some numbers) is\nreturned, use that command to proceed.\n\n```bash\npython3 -m venv .venv\nsource .venv/bin/activate\n\npip install -r requirements.txt\n```\n\n#### Docker Compose\n\nSee [Install Docker Compose][ref-docker-compose-install]\n\n```bash\ndocker compose version\n# Docker Compose version v2.10.2\n```\n\n#### htpasswd\n\nSee [htpasswd docs][ref-htpasswd-usage]\n\n```bash\nsudo apt-get install apache2-utils\n```\n\n## Setup\n### Directories\n\nCreate the required directories to store the uploaded artifacts\n\n```bash\nmkdir -p data/auth\nmkdir -p data/packages\n```\n\n### Password file\n\n```bash\nhtpasswd -sc data/auth/.htpasswd upload-bot-0\n\nNew password: asdf\nRe-type new password: asdf\nAdding password for user upload-bot-0\n```\n\n### pypirc file\n\nThis file is used to authenticate the client at the PyPi Server. Edit or create\na `~/.pypirc` file on your system with a similar content\n\n```\n[distutils]\nindex-servers =\n  pypi\n  mypypiserver\n\n[pypi]\nusername:\u003cyour_pypi_username\u003e\npassword:\u003cyour_pypi_passwd\u003e\n\n[mypypiserver]\nrepository: http://localhost:8089\nusername: upload-bot-0\npassword: asdf\n```\n\n## Usage\n### Start PyPi server\n\nRun the following command in the directory of the `docker-compose.yml` file\n\n```bash\ndocker compose up\n```\n\nThe PyPi server will be available on `http://localhost:8089`. The port `8089`\nis choosen as maybe other web servers or services are already running on the\nsystem and using the general default port `8080`.\n\n### Upload\n\nIn order to upload an already created distribution file use this command\n\n```bash\n# if specified in pypirc file\ntwine upload --repository mypypiserver path/to/my-custom-package.tar.gz\n\n# use a URL instead of a keyword\ntwine upload --repository http://localhost:8089 path/to/my-custom-package.tar.gz\n```\n\n### Download\n#### Python\n\n```bash\n# if specified in pypirc file\npip install 'my-custom-package==0.1.0'\n\n# otherwise use the raw URL to the PyPi server\npip install --index-url http://localhost:8089 --trusted-host http://localhost:8089 'my-custom-package==0.1.0'\n```\n\n#### MicroPython\n\nTo use the PyPi server with MicroPython and it's `upip` package, a specialized\nJSON endpoint is used, which is supported by pypiserver to provide the package\ninformations. The JSON data can be inspected at\n`http://localhost:8089/PACKAGE_NAME/json`. It contains similar data as the\nfollowing example depending on the IP address running the PyPi server and of\ncourse the uploaded packages.\n\n```JSON\n{\n  \"info\": {\n    \"version\": \"0.2.0rc99+dev42\"\n  },\n  \"releases\": {\n    \"0.2.0rc99+dev42\": [\n      {\n        \"url\": \"http://192.168.178.105:8089/packages/my-micropython-package-0.2.0rc99+dev42.tar.gz\"\n      }\n    ],\n    \"0.1.0rc1+dev1\": [\n      {\n        \"url\": \"http://192.168.178.105:8089/packages/my-micropython-package-0.1.0rc1+dev1.tar.gz\"\n      }\n    ]\n  }\n}\n```\n\nMicroPython will [get this JSON][ref-upy-get-package-data] and install either\nthe latest version, taken specified by `['info']['version']` and then looked\nup in `['releases'][VERSION]` or from a specific version. In either case the\n`url` value of the specified release will be used to download the archive file.\n\n##### Connect to a network\n\n```python\nimport network\nimport upip\n\nstation = network.WLAN(network.STA_IF)\nstation.active(True)\nstation.connect('SSID', 'PASSWORD')\n```\n\n##### Install latest package version\n\nTo install the latest version of the hosted `my-micropython-package` use\nthis set of commands on a MicroPython board\n\n```python\nupip.index_urls = [\"http://IP-ADDRESS-OF-PYPISERVER:8089\"]\nupip.install(\"my-micropython-package\")\n```\n\nWhich will produce the following output on the MicroPython board\n\n```\nInstalling my-micropython-package 0.2.0rc99+dev42 from http://192.168.178.105:8089/packages/my-micropython-package-0.2.0rc99+dev42.tar.gz\n```\n\n##### Install specific package version\n\nTo install a specific version of the hosted `my-micropython-package` use\nthis set of commands on a MicroPython board\n\n```python\nupip.index_urls = [\"http://IP-ADDRESS-OF-PYPISERVER:8089\"]\nupip.install(\"my-micropython-package==0.1.0rc1+dev1\")\n```\n\nWhich will produce the following output on the MicroPython board\n\n```\nInstalling my-micropython-package 0.1.0rc1+dev1 from http://192.168.178.105:8089/packages/my-micropython-package-0.1.0rc1+dev1.tar.gz\n```\n\n## Credits\n\nBased on the [PyPiServer instructions][ref-pypiserver].\n\n\u003c!-- Links --\u003e\n[ref-docker-compose-install]: https://docs.docker.com/compose/install/\n[ref-htpasswd-usage]: https://httpd.apache.org/docs/2.4/programs/htpasswd.html\n[ref-upy-get-package-data]: https://github.com/micropython/micropython/blob/da4b38e7562dfa451917f9d7f344a7f26de8c7bd/tools/upip.py#L196\n[ref-pypa-pypiserver]: https://github.com/pypiserver/pypiserver\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainelectronics%2Ftest-pypiserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrainelectronics%2Ftest-pypiserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainelectronics%2Ftest-pypiserver/lists"}