Metadata-Version: 2.4
Name: medlink-pylib
Version: 0.0.7
Summary: py utils lib
Author-email: Jacob Jiang <mingjing@medlink.global>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/mingjingjiang/medlink-pylib
Project-URL: Issues, https://github.com/mingjingjiang/medlink-pylib/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: starlette>=0.52.1
Dynamic: license-file

# pylib Package

This is a py utils lib package, here are log and lots of methods.
All methods you can see in file methods.py.

# Install and Import
```shell
python3 -m pip install --upgrade \
  build \
  twine \
  keyring \
  keyrings.google-artifactregistry-auth

gcloud config set project medlink-global-dev
gcloud auth application-default login

rm -rf dist src/*.egg-info
python3 -m build
ls dist
上传 wheel 和 source distribution：
python3 -m twine upload \
  --repository-url \
  https://us-central1-python.pkg.dev/medlink-global-dev/medlink-python/ \
  --username oauth2accesstoken \
  --password "$(gcloud auth print-access-token)" \
  dist/*

python3 -m pip install \
  keyrings.google-artifactregistry-auth

gcloud auth application-default login

python3 -m pip install \
  --extra-index-url \
  https://us-central1-python.pkg.dev/medlink-global-dev/medlink-python/simple/ \
  medlink-pylib
指定版本：
python3 -m pip install \
  --extra-index-url \
  https://us-central1-python.pkg.dev/medlink-global-dev/medlink-python/simple/ \
  medlink-pylib==0.0.5

验证：
python3 -m pip show medlink-pylib
python3 -c "import pylib; print(pylib.__file__)"
代码中使用：
from pylib.log import log
from pylib.methods import Methods
安装 requirements.txt
你的 requirements.txt 中可以正常写：
medlink-pylib==0.0.5
requests==2.32.5
PyYAML~=6.0
安装时使用：
python3 -m pip install \
  --upgrade \
  keyring \
  keyrings.google-artifactregistry-auth

gcloud auth application-default login

python3 -m pip install \
  -r requirements.txt \
  --extra-index-url \
  https://us-central1-python.pkg.dev/medlink-global-dev/medlink-python/simple/
这里使用 --extra-index-url 的原因是：
- medlink-pylib 从 Artifact Registry 下载
- requests、PyYAML 等其他依赖继续从公共 PyPI 下载
- 不需要把所有公共依赖复制到 Artifact Registry
如果只想下载私有包本身：
python3 -m pip download \
  --index-url \
  https://us-central1-python.pkg.dev/medlink-global-dev/medlink-python/simple/ \
  --no-deps \
  --dest ./downloads \
  medlink-pylib==0.0.5
下载并安装所有依赖时，--extra-index-url 是正确方式。Artifact Registry 下载账号需要 roles/artifactregistry.reader，上传账号需要 roles/artifactregistry.writer。

```

# Usage
```python
from pylib.log import log
log.debug('msg')
log.info('msg')
log.warning('msg')
log.error('msg')
log.critical('msg')
log.log('DEBUG', 'msg')
log.log('INFO', 'msg')
log.log('WARNING', 'msg')
log.log('ERROR', 'msg')
log.log('CRITICAL', 'msg', silence=True)

from pylib.methods import Methods
Methods.get_stack_funcs()
data_desensitived = Methods.mask_sensitive_data(dict_data)
```
