pypiserver 最小开源pip 私服

发布时间 2023-04-20 10:08:22作者: 荣锋亮

pypiserver 是一个轻量的pip 私服,支持下载以及上传,对于pip 包我们可以通过scp 以及标准pip 上传处理

启动

基于venv

python3 -m venv venv
source venv/bin/activate
mkdir packages
pypi-server run -p 8080  packages

开发一个python pip 包

使用build

  • pyproject.toml
[project]
name = "dalongdemo"
authors = [
    {name = "dalong", email = "dalong@qq.com"},
]
description = "My package description"
requires-python = ">=3.7"
version = "0.0.1"
keywords = ["one", "two"]
license = {text = "BSD-3-Clause"}
  • 构建
pyproject-build
  • 效果

 


拷贝dist 到package 中就可以使用包了
效果

 

  • 安装使用
 
pip install -i http://localhost:8080/simple/ dalongdemo

 

说明

pypiserver 作为一个简单的pip 私服还是不错的,同时官方也提供了认证处理,目前主要是基于了本地存储,实际上基于nas 可以临时解决多节点的问题,基于s3
模式是一个更好的方案

参考资料

https://github.com/pypiserver/pypiserver
https://github.com/pypiserver/pypiserver#using-ad-hoc-authentication-providers
https://github.com/brettcannon/python-launcher
https://python-launcher.app/install/
https://pypa-build.readthedocs.io/en/stable/installation.html
https://github.com/pypa/pipx'
https://github.com/pypa/build/
https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
https://github.com/pypiserver/pypiserver/issues/253