许多脚本中使用的一些小助手
lib-platform的Python项目详细描述
libu平台
许多脚本中使用的一些方便的函数
支持Python2.7-Python3.7、Pypy和其他方言。
这也是travis.yml用于多平台测试的一个工作示例:
- 安装葡萄酒
- 在wine上安装python 2.7 32位
- 在Wine 64位上安装Python2.7
- 在wine上安装python 3.7 32位
- 在Wine 64位上安装Python 3.7
- 在葡萄酒上运行pytest(以上提到的所有版本)
- 在Wine上运行代码覆盖(上面提到的所有版本)
- 用于Python2.7和Python3.7的OSX构建
- python 2.7和python 3.7的pypyy构建
- Windows Build Python 2.7版
- Windows Build Python 3.7
- 为github和pypi使用rst-include构建rst文档
100% code coverage,mypy静态类型检查,在Linux, OsX, Windows and Wine下测试,自动每日生成和监视
- Try it Online
- Installation and Upgrade
- Basic Usage
- Requirements
- Acknowledgements
- Contribute
- Report Issues
- Pull Request
- Code of Conduct
- License
在线试用
您可以使用“launch binder”徽章立即在jupyter笔记本中尝试,或者单击here
安装和升级
源代码:
# normal install python setup.py install # test without installing python setup.py test
VIA PIP最新版本:
# latest Release from pypi pip install lib_platform # test without installing pip install lib_platform --install-option test
VIA PIP最新开发版本:
# upgrade all dependencies regardless of version number (PREFERRED) pip install --upgrade https://github.com/bitranox/lib_platform/archive/master.zip --upgrade-strategy eager # normal install pip install --upgrade https://github.com/bitranox/lib_platform/archive/master.zip # test without installing pip install https://github.com/bitranox/lib_platform/archive/master.zip --install-option test
通过Requirements.txt:
# Insert following line in Your requirements.txt: # for the latest Release: lib_platform # for the latest Development Version : https://github.com/bitranox/lib_platform/archive/master.zip # to install and upgrade all modules mentioned in requirements.txt: pip install --upgrade -r /<path>/requirements.txt
通过Python:
# for the latest Releasepython-mpipinstallupgradelib_platform# for the latest Development Versionpython-mpipinstallupgradehttps://github.com/bitranox/lib_platform/archive/master.zip
基本用法
>>>importlib_platform>>># get system as string>>>system=lib_platform.system>>># bool is_platform_linux>>>is_platform_linux=lib_platform.is_platform_linux>>># bool is_platform_darwin>>>is_platform_darwin=lib_platform.is_platform_darwin>>># bool is_platform_posix>>>is_platform_posix=lib_platform.is_platform_posix# either darwin or linux>>># bool is_platform_windows>>>is_platform_windows=lib_platform.is_platform_posix# also True for windows_xp or windows_wine>>># bool is_platform_windows_xp>>>is_platform_windows_xp=lib_platform.is_platform_windows_xp>>># bool is_platform_windows_wine>>>is_platform_windows_wine=lib_platform.is_platform_windows_wine>>># bool is_platform_windows_wine_xp>>>is_platform_windows_wine_xp=lib_platform.is_platform_windows_wine_xp>>># string username lib_platform.username>>>username=lib_platform.username>>># string fqdn hostname>>>hostname=lib_platform.hostname>>># string hostname short>>>hostname_short=lib_platform.hostname_short>>># bool is_python2>>>is_python2=lib_platform.is_python2>>># bool is_python3>>>is_python3=lib_platform.is_python3>>># path to userhome>>>path_userhome=lib_platform.path_userhome>>># is user administrator (has user admin rights)>>>is_user_admin=lib_platform.is_user_admin
要求
将自动安装以下模块:
pytest # see : https://github.com/pytest-dev/pytest typing # see : https://pypi.org/project/typing/ lib_registry # see: https://pypi.org/project/lib-registry/
确认
- 特别感谢“Bob叔叔”Robert C.Martin,特别是他写的关于“干净代码”和“干净架构”的书
贡献
我希望你能给我这个项目的请求。 -please Contribute
许可证
此软件是根据MIT license授权的
更改日志
1.0.3
2019-06-14:添加为用户管理员(检查管理权限)
1.0.2
2019-04-28:文档更新,setup.py中的小修复程序
1.0.0
2019-03-28:首次公开发布,PYPI发布