pypinonevirgin


Namepypinonevirgin JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/Jim107225017
SummaryBuild my first PyPI package
upload_time2022-12-29 07:05:23
maintainerJim Chen
docs_urlNone
authorJim Chen
requires_python>=3.7.3
licenseMIT
keywords build your pypi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pypi
Build My first PyPI package
PyPI : the Python Package Index

###### tags: `Python` `PyPI`

## Steps-by-Steps
1. 準備好要上傳 PyPI 的套件
    > :memo: 
    > 1. 資料夾結構
    > ![steps_0.png](https://i.imgur.com/fUDgUGv.png)


2. 進入該層目錄 : `cd C:\Users\chichun.chen\Desktop\git\pypi`

3. 打包檢查 : `python setup.py check`

4. 打包 : `python setup.py sdist`
    > :memo: 
    > 1. **sdist** : 較常用,支持 **pip** 安裝
    > 2. bdist_egg : 支持 easy_install 安装
    > 3. 打包好的檔案會在 `/dist` 底下
    > ![steps_1.png](https://i.imgur.com/InQ2tEs.png)
    > 
    > 4. 使用 `pip install pypinonevirgin-0.0.1.tar.gz` 測試打包完的檔案是否能正確執行

5. 安裝 **twine** 作為後續上傳 PyPI 用 : `pip install twine`

6. 註冊 [PyPI](https://pypi.org/)

7. 上傳 : `twine upload dist/*`
    > :memo: 
    > 1. 需註冊 PyPI 帳號密碼
    > ![steps_2.png](https://i.imgur.com/xSqHkps.png)

## FAQ
* Register Fail:
    * **Command** : `python setup.py register`
    * **ErrorMsg** : Server response (410): Project pre-registration is no longer required or supported, upload your files instead.
    * **Explain** : PyPI 因為 HTTP 安全性認證的問題,不再支援 register、upload 等指令
    * **Solution** : 改用 `twine upload` (官方建議)

* Upload Fail : 
    * **Command** : `twine upload dist/*`
    * **ErrorMsg** : HTTPError: 400 Bad Request: This filename has already been used, use a different version.
    * **Explain** : PyPI 上已經存在相同名稱的套件/版號
    * **Solution** : 更改套件名稱 or 調整版號

* console_scripts : 
    > :memo: 
    > 1. Build python scripts automatically
    > ![steps_3.png](https://i.imgur.com/hICMmdU.png)



## Windows 打印資料夾結構的小工具
```powershell=
tree <yourPath> /f | Select-Object -Skip 2 | ForEach-Object {
	if ($_.Contains(':\')) {
		Write-Host $_ -ForegroundColor Cyan
	}
	elseif ($_.Contains('─')) {
		Write-Host "$($_.Replace('─', '─<'))>" -ForegroundColor Yellow
	}
	else{
		Write-Host $_ -ForegroundColor White
	}
}

```

## Reference
* [PyPI Official](https://pypi.org/)
* [PyPI 教學](https://zhuanlan.zhihu.com/p/26159930)
* [PyPI 教學](https://www.cnblogs.com/jaysonteng/p/15221886.html)
* [輸出資料夾結構](https://blog.darkthread.net/blog/dump-folder-tree/)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Jim107225017",
    "name": "pypinonevirgin",
    "maintainer": "Jim Chen",
    "docs_url": null,
    "requires_python": ">=3.7.3",
    "maintainer_email": "jim850212@gmail.com",
    "keywords": "build your pypi",
    "author": "Jim Chen",
    "author_email": "jim850212@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b2/a3/8a6242bbe2986592d1fb784f619dbf2cd23b9900d552ecd3665f2f0a86b2/pypinonevirgin-0.0.2.tar.gz",
    "platform": null,
    "description": "# pypi\r\nBuild My first PyPI package\r\nPyPI : the Python Package Index\r\n\r\n###### tags: `Python` `PyPI`\r\n\r\n## Steps-by-Steps\r\n1. \u6e96\u5099\u597d\u8981\u4e0a\u50b3 PyPI \u7684\u5957\u4ef6\r\n    > :memo: \r\n    > 1. \u8cc7\u6599\u593e\u7d50\u69cb\r\n    > ![steps_0.png](https://i.imgur.com/fUDgUGv.png)\r\n\r\n\r\n2. \u9032\u5165\u8a72\u5c64\u76ee\u9304 : `cd C:\\Users\\chichun.chen\\Desktop\\git\\pypi`\r\n\r\n3. \u6253\u5305\u6aa2\u67e5 : `python setup.py check`\r\n\r\n4. \u6253\u5305 : `python setup.py sdist`\r\n    > :memo: \r\n    > 1. **sdist** : \u8f03\u5e38\u7528\uff0c\u652f\u6301 **pip** \u5b89\u88dd\r\n    > 2. bdist_egg : \u652f\u6301 easy_install \u5b89\u88c5\r\n    > 3. \u6253\u5305\u597d\u7684\u6a94\u6848\u6703\u5728 `/dist` \u5e95\u4e0b\r\n    > ![steps_1.png](https://i.imgur.com/InQ2tEs.png)\r\n    > \r\n    > 4. \u4f7f\u7528 `pip install pypinonevirgin-0.0.1.tar.gz` \u6e2c\u8a66\u6253\u5305\u5b8c\u7684\u6a94\u6848\u662f\u5426\u80fd\u6b63\u78ba\u57f7\u884c\r\n\r\n5. \u5b89\u88dd **twine** \u4f5c\u70ba\u5f8c\u7e8c\u4e0a\u50b3 PyPI \u7528 : `pip install twine`\r\n\r\n6. \u8a3b\u518a [PyPI](https://pypi.org/)\r\n\r\n7. \u4e0a\u50b3 : `twine upload dist/*`\r\n    > :memo: \r\n    > 1. \u9700\u8a3b\u518a PyPI \u5e33\u865f\u5bc6\u78bc\r\n    > ![steps_2.png](https://i.imgur.com/xSqHkps.png)\r\n\r\n## FAQ\r\n* Register Fail:\r\n    * **Command** : `python setup.py register`\r\n    * **ErrorMsg** : Server response (410): Project pre-registration is no longer required or supported, upload your files instead.\r\n    * **Explain** : PyPI \u56e0\u70ba HTTP \u5b89\u5168\u6027\u8a8d\u8b49\u7684\u554f\u984c\uff0c\u4e0d\u518d\u652f\u63f4 register\u3001upload \u7b49\u6307\u4ee4\r\n    * **Solution** : \u6539\u7528 `twine upload` (\u5b98\u65b9\u5efa\u8b70)\r\n\r\n* Upload Fail : \r\n    * **Command** : `twine upload dist/*`\r\n    * **ErrorMsg** : HTTPError: 400 Bad Request: This filename has already been used, use a different version.\r\n    * **Explain** : PyPI \u4e0a\u5df2\u7d93\u5b58\u5728\u76f8\u540c\u540d\u7a31\u7684\u5957\u4ef6/\u7248\u865f\r\n    * **Solution** : \u66f4\u6539\u5957\u4ef6\u540d\u7a31 or \u8abf\u6574\u7248\u865f\r\n\r\n* console_scripts : \r\n    > :memo: \r\n    > 1. Build python scripts automatically\r\n    > ![steps_3.png](https://i.imgur.com/hICMmdU.png)\r\n\r\n\r\n\r\n## Windows \u6253\u5370\u8cc7\u6599\u593e\u7d50\u69cb\u7684\u5c0f\u5de5\u5177\r\n```powershell=\r\ntree <yourPath> /f | Select-Object -Skip 2 | ForEach-Object {\r\n\tif ($_.Contains(':\\')) {\r\n\t\tWrite-Host $_ -ForegroundColor Cyan\r\n\t}\r\n\telseif ($_.Contains('\u2500')) {\r\n\t\tWrite-Host \"$($_.Replace('\u2500', '\u2500<'))>\" -ForegroundColor Yellow\r\n\t}\r\n\telse{\r\n\t\tWrite-Host $_ -ForegroundColor White\r\n\t}\r\n}\r\n\r\n```\r\n\r\n## Reference\r\n* [PyPI Official](https://pypi.org/)\r\n* [PyPI \u6559\u5b78](https://zhuanlan.zhihu.com/p/26159930)\r\n* [PyPI \u6559\u5b78](https://www.cnblogs.com/jaysonteng/p/15221886.html)\r\n* [\u8f38\u51fa\u8cc7\u6599\u593e\u7d50\u69cb](https://blog.darkthread.net/blog/dump-folder-tree/)\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Build my first PyPI package",
    "version": "0.0.2",
    "split_keywords": [
        "build",
        "your",
        "pypi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "a78dc6fd1b90ab05f3d0d59c7073e8b2",
                "sha256": "df00d3b3cc2915e45fe6604158e412b046e7f9abd3c9708beb7c5ac841d7300a"
            },
            "downloads": -1,
            "filename": "pypinonevirgin-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a78dc6fd1b90ab05f3d0d59c7073e8b2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.3",
            "size": 3387,
            "upload_time": "2022-12-29T07:05:23",
            "upload_time_iso_8601": "2022-12-29T07:05:23.224179Z",
            "url": "https://files.pythonhosted.org/packages/b2/a3/8a6242bbe2986592d1fb784f619dbf2cd23b9900d552ecd3665f2f0a86b2/pypinonevirgin-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-29 07:05:23",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "pypinonevirgin"
}
        
Elapsed time: 0.02630s