Skip to main content

some small helpers used in many scripts

Project description

lib_platform

Build Status jupyter Pypi Status Codecov Status Better Code snyk security

some convenience functions used in many scripts

supports python 2.7 - python 3.7, pypy and possibly other dialects.

this is also a working example for travis.yml for multi-platform testing :

  • install WINE

  • install python 2.7 on wine 32 Bit

  • install python 2.7 on wine 64 Bit

  • install python 3.7 on wine 32 Bit

  • install python 3.7 on wine 64 Bit

  • run pytest on wine (all Versions mentioned above)

  • run code coverage on wine (all Versions mentioned above)

  • osx Build for Python 2.7, Python 3.7

  • pypy Build for Python 2.7, Python 3.7

  • Windows Build Python 2.7

  • Windows Build Python 3.7

100% code coverage, tested under Linux, OsX, Windows and Wine


Report Issues

Contribute

Pull Request

Code of Conduct


Try it in Jupyter Notebook

You might try it right away in Jupyter Notebook by using the “launch binder” badge, or click here

Installation and Upgrade

From source code:

# normal install
python setup.py install
# test without installing
python setup.py test

via pip latest Release:

# latest Release from pypi
pip install lib_platform

via pip latest Development Version:

# 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

via 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

via python:

# for the latest Release
python -m pip install --upgrade lib_platform

# for the latest Development Version
python -m pip install --upgrade https://github.com/bitranox/lib_platform/archive/master.zip

Basic Usage

>>> from lib_platform import *

>>> # possible values : lowercase, returns:  'darwin', 'linux', 'windows', 'windows_xp', 'windows_wine', 'windows_wine_xp'
>>> system
'linux'

>>> is_platform_linux
True

>>> is_platform_darwin
False

>>> is_platform_posix       # either darwin or linux
True

>>> is_platform_windows     # also True for windows_xp or windows_wine
False

>>> is_platform_windows_xp
False

>>> is_platform_windows_wine
False

>>> is_platform_windows_wine_xp
False

>>> username
'root'

>>> hostname
'test.host.com'

>>> hostname_short
'test'

>>> is_python2
False

>>> is_python3
True

>>> path_userhome
'/home/user'

Requirements

pytest, see : https://github.com/pytest-dev/pytest

typing, see : https://pypi.org/project/typing/

lib_registry, see: https://pypi.org/project/lib-registry/

Acknowledgement

special thanks to “uncle bob” Robert C. Martin, especially for his books on “clean code” and “clean architecture”

Contribute

I would love for you to fork and send me pull request for this project. Please contribute.

License

This software is licensed under the MIT license

See License file

Changelog

1.0.0

2019-03-28: Initial public release, PyPi Release

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

lib_platform-1.0.1.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

lib_platform-1.0.1-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page