现代化的python项目模版
Project description
modern python project
create a repository in github
- gitignore
- license
- readme
global tools
pyenv
brew install pyenv
# modify shell
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
# build dependencies of python
brew install openssl readline sqlite3 xz zlib
source ~/.bash_profile
python
pyenv install 3.9.0
# make python version in local directory
pyenv local 3.9.0
poetry
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
-
open a new shell, initialize python project
peotry init -n
-
修改
project.toml -
增加
src, 在其中增加modern_pythonpackage repository --> kebab casemodern-pythonpython package --> snake casemodern_python -
__init__.py# src/modern_python/__init__.py __version__ = "0.1.0"
-
创建python虚拟环境
poetry install # run python inside the new venv poetry run python
-
添加依赖
poetry add click
initial code
在 src/modern_python 中创建 console.py
在 project.toml 中
[tool.poetry.scripts]
modern-python = "modern_python.console:main"
# install
poetry install
# run
poetry run modern-python
添加 requests
test
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modern-python-0.3.2.tar.gz.
File metadata
- Download URL: modern-python-0.3.2.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.2 CPython/3.9.0 Linux/5.4.0-1031-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54e377ae3a4f71cdba8341973b97d3e76d58359cf82ad216fe61f200bac3fc48
|
|
| MD5 |
68adffa638080eb0bd0b6d989cecf47f
|
|
| BLAKE2b-256 |
f061e0fdb716bb8d0d2b96d5bba83569fea633fe203bb5801fdd405f4984b0f5
|
File details
Details for the file modern_python-0.3.2-py3-none-any.whl.
File metadata
- Download URL: modern_python-0.3.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.2 CPython/3.9.0 Linux/5.4.0-1031-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50f1ecbf1406abadab8d4333a24698fd25a575ff4b9d9cf37744d76efa9e8c82
|
|
| MD5 |
e37e45ec5a167dc34e7bec1322db1797
|
|
| BLAKE2b-256 |
2f49ba12cc00b9a7d975038108d095cf0865e4594538050697781de01eed9bca
|