许多脚本中使用的一些小助手

lib-platform的Python项目详细描述


libu平台

Pypi Statuslicensemaintenancejupyter

Build StatusCodecov StatusBetter CodeMaintainabilitysnyk security

许多脚本中使用的一些方便的函数

支持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下测试,自动每日生成和监视



在线试用

您可以使用“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发布

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
javascript问题:通过URL用网站数据填充Textview   java TabLayout Android,如何用几个标签填充整个屏幕宽度,并用大量标签滚动?   Eclipse Java运行的文件不再存在于我的工作区中   安装两个Java版本时,使用Java的windows链接不起作用   java将多个图形添加到单个JPanel   java Kafka ConsumerFactory,带有两个Desiarizer   使用反射更改java类超类   当一致性测试失败时,java有没有办法让堆栈跟踪显示在控制台中   java映射到基元类型的HashMap的快速替代方案是什么?   java关闭一个jframe所有剩余的打开jframe都将关闭。   java为什么不推荐“使用getString()获取设备标识符”?   java值比较和值赋值之间有什么性能差异吗?   Java实体数组到JavaScript数组   java使用流将一个列表转换为另一个列表   在JTree中保存对象,但更改显示的名称(java swing)?   java“Hello world”Android应用程序,文件尽可能少,没有IDE,只有文本编辑器   java在方法之间传递值   java如何为项目数组创建ParseQuery?