Code Monkey home page Code Monkey logo

nocaselist's Introduction

Pywbem - A WBEM client and related utilities, written in pure Python

Version on Pypi Test status (master) Docs status (master) Test coverage (master) Supported Python

Overview

Pywbem is a WBEM client and WBEM indication listener and provides related WBEM client-side functionality. It is written in pure Python and runs on Python 3.

WBEM is a standardized approach for systems management defined by the DMTF that is used in the industry for a wide variety of systems management tasks. See WBEM Standards for more information. An important use of this approach is the SMI-S standard defined by SNIA for managing storage.

Functionality

The major components of pywbem are shown in this diagram:

pywbem components

The green components all have Python APIs for use by user applications. The yellow components are command line utilities. The blue components are not part of the pywbem or pywbemtools packages.

The pywbem components all run on the client side and communicate with a remote WBEM server using the standard CIM operations over HTTP (CIM-XML) protocol defined by the DMTF.

Pywbem provides the following Python APIs:

  • WBEM Client Library - An API that supports issuing WBEM operations to a WBEM server, using the CIM operations over HTTP (CIM-XML) protocol defined by the DMTF.
  • WBEM Server Library - An API that encapsulates selected functionality of a WBEM server for use by a WBEM client application, such as determining the Interop namespace and other basic information about the server, or the management profiles advertised by the server.
  • WBEM Indication Listener - An API for creating and managing a thread-based WBEM listener that waits for indications (i.e. event notifications) emitted by a WBEM server using the CIM-XML protocol. The API supports registering callback functions that get called when indications are received by the listener.
  • WBEM Subscription Manager - An API for viewing and managing subscriptions for indications on a WBEM server.
  • MOF Compiler - An API for compiling MOF files or strings into a CIM repository (e.g. on a WBEM server), or for test-compiling MOF.
  • Mock WBEM server - An API for setting up a mocked WBEM server that is used instead of a real WBEM server. This allows setting up well-defined WBEM servers locally that can be used for example for prototyping or testing user applications.

Pywbem provides this command line utility:

  • mof_compiler - A MOF compiler that takes MOF files as input and compiles them into a CIM repository (e.g. on a WBEM server).

The related pywbemtools project provides the following command line utilities:

  • pywbemcli - A client-side command line interface for a WBEM server, supporting a command line mode and an interactive (repl) mode.
  • pywbemlistener - A command that runs and manages WBEM indication listeners that can receive indications from a WBEM server.

Installation

To install the latest released version of pywbem into your active Python environment:

$ pip install pywbem

This will also install any prerequisite Python packages.

Starting with version 1.0.0, pywbem has no OS-level prerequisite packages.

On newer versions of some operating systems(ex. Ubuntu 23.04, Debian 12) pywbem will only install into a virtual environment. This is by design to avoid conflicts between OS distributed python packages and other user installed packages and is documented in Python PEP 668. See the pywbem documentation Troubleshooting section for more information if an "Externally-managed-environment" error occurs during installation.

For more details and alternative ways to install, see the Installation section in the pywbem documentation.

Documentation

  • Documentation - Concepts, tutorials, Python API, command line tools, and developer documentation.
  • Tutorial - The tutorials in the documentation are provided as Jupyter notebooks and provide working examples of pywbem API usage.
  • Change log - Detailed change history in the documentation.
  • Presentations - status, concepts, and implementation of pywbem.

Quick Start

The following simple example script lists the namespaces and the Interop namespace in a particular WBEM server:

#!/usr/bin/env python

import pywbem

server_url = 'http://localhost'
user = 'fred'
password = 'blah'

conn = pywbem.WBEMConnection(server_url, (user, password))

server = pywbem.WBEMServer(conn)

print(f"Interop namespace:\n  {server.interop_ns}")

print("All namespaces:")
for ns in server.namespaces:
    print(f"  {ns}")

Project Planning

For each upcoming release, the bugs and feature requests that are planned to be addressed in that release are listed in the issue tracker with an according milestone set that identifies the target release. The due date on the milestone definition is the planned release date. There is usually also an issue that sets out the major goals for an upcoming release.

Planned Next Release

Fix versions of pywbem are released as needed.

The next planned feature version(s) of pywbem can be found by listing the release definition issues.

Contributing

For information on how to contribute to pywbem, see the Contributing section in the pywbem documentation.

License

Pywbem is provided under the GNU Lesser General Public License (LGPL) version 2.1, or (at your option) any later version.

nocaselist's People

Contributors

andy-maier avatar

Stargazers

 avatar

Watchers

 avatar  avatar

nocaselist's Issues

Version incompatibilities during make develop

After cleaning up the dependencies in PR #8, the following incompatibilities are still reported:

Locally on macOS using Python 2.7 + 3.8 with latest package levels:

ERROR: flake8 3.8.3 has requirement pyflakes<2.3.0,>=2.2.0, but you'll have pyflakes 2.1.1 which is incompatible.

Python 2.7 with latest package levels (see Travis run):

ERROR: flake8 3.8.3 has requirement pyflakes<2.3.0,>=2.2.0, but you'll have pyflakes 2.1.1 which is incompatible.
ERROR: tox 3.17.1 has requirement six>=1.14.0, but you'll have six 1.11.0 which is incompatible.
ERROR: virtualenv 20.0.27 has requirement pathlib2<3,>=2.3.3; python_version < "3.4" and sys_platform != "win32", but you'll have pathlib2 2.3.2 which is incompatible.

Python 3.4 with latest package levels (see Travis run):

ERROR: flake8 3.8.3 has requirement pyflakes<2.3.0,>=2.2.0, but you'll have pyflakes 2.1.1 which is incompatible.
ERROR: tox 3.14.0 has requirement importlib-metadata<1,>=0.12; python_version < "3.8", but you'll have importlib-metadata 1.1.3 which is incompatible.

Python 3.5 + 3.8 + pypy(2.7) + pypy3(3.6) with latest package levels (see Travis run + Travis run + Travis run + Travis run):

ERROR: flake8 3.8.3 has requirement pyflakes<2.3.0,>=2.2.0, but you'll have pyflakes 2.1.1 which is incompatible.
ERROR: tox 3.17.1 has requirement six>=1.14.0, but you'll have six 1.12.0 which is incompatible.

Python 3.6 + 3.7 with latest package levels (see Travis run + Travis run):

ERROR: astroid 2.4.2 has requirement six~=1.12, but you'll have six 1.11.0 which is incompatible.
ERROR: flake8 3.8.3 has requirement pyflakes<2.3.0,>=2.2.0, but you'll have pyflakes 2.1.1 which is incompatible.
ERROR: tox 3.17.1 has requirement six>=1.14.0, but you'll have six 1.11.0 which is incompatible.

Python 2+3 on macOS with latest package levels (see Travis run + Travis run):

ERROR: flake8 3.8.3 has requirement pyflakes<2.3.0,>=2.2.0, but you'll have pyflakes 2.1.1 which is incompatible.

installtest fails on pypy3 with latest package levels

From Travis run on pypy3 with latest package levels (see https://travis-ci.org/github/pywbem/nocaselist/jobs/709856857):

$ make installtest
Makefile: Running install tests
tests/installtest/test_install.sh dist/nocaselist-1.0.0.dev1-py2.py3-none-any.whl dist/nocaselist-1.0.0.dev1.tar.gz python
Preparing for the tests
Creating test directory: tests/installtest/../../tmp_installtest
Creating source archive unpack directory: tests/installtest/../../tmp_installtest/src_dist
Removing .egg file: tests/installtest/../../dist/nocaselist*.egg
Testcase test1: Pip install from repo root directory: tests/installtest/../..
Saving location of current virtualenv: /home/travis/virtualenv/pypy3.6-7.1.1
Before creating virtualenv: tests/installtest/../../tmp_installtest/virtualenvs/nocaselist_test_test1
Python version: Python 3.6.1 (784b254d6699, Apr 14 2019, 10:22:42)
[PyPy 7.1.1-beta0 with GCC 6.2.0 20160901] from /home/travis/virtualenv/pypy3.6-7.1.1/bin/python
Pip version: pip 20.1.1 from /home/travis/virtualenv/pypy3.6-7.1.1/site-packages/pip (python 3.6)
Creating virtualenv: tests/installtest/../../tmp_installtest/virtualenvs/nocaselist_test_test1
Activating virtualenv: tests/installtest/../../tmp_installtest/virtualenvs/nocaselist_test_test1
Error: Command failed with rc=1: source tests/installtest/../../tmp_installtest/virtualenvs/nocaselist_test_test1/bin/activate, output follows:
tests/installtest/test_install.sh: line 230: tests/installtest/../../tmp_installtest/virtualenvs/nocaselist_test_test1/bin/activate: No such file or directory
Makefile:573: recipe for target 'installtest' failed
make: *** [installtest] Error 1
The command "make installtest" exited with 2.

AttributeError: 'NocaseList' object has no attribute '_lc_list' during unpickling

Actual behavior

When pickling an object of NocaseList, the following error shows up during unpickling:

>>> ncl = NocaseList(['a', 'B'])
>>> pkl = pickle.dumps(ncl)
>>> ncl2 = pickle.loads(pkl)
AttributeError: 'NocaseList' object has no attribute '_lc_list'

Expected behavior

Should work.

Execution environment

  • nocaselist version: 1.0.1
  • Python version: 3.8.5
  • Operating System (type+version): MacOS

Non-standard behavior for `+` and `+=`

The implementations of + and += in NocaseList behave different from the built-in list.

  • For +, the built-in list treats the right hand operand as an iterable of items to be added and requires it to be a list, while NocaseList treats the the right hand operand as a single item to add (tested on Python 2.7 and 3.8):
>>> r = list() + 'Dog'; r
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can only concatenate list (not "str") to list
>>> r = NocaseList() + 'Dog'; r
['Dog']

>>> r = list() + ['Dog']; r
['Dog']
>>> r = NocaseList() + ['Dog']; r
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/maiera/PycharmProjects/pywbem/nocaselist/nocaselist/_nocaselist.py", line 116, in __add__
    lst.append(value)
  File "/Users/maiera/PycharmProjects/pywbem/nocaselist/nocaselist/_nocaselist.py", line 319, in append
    self._lc_list.append(value.lower())
AttributeError: 'list' object has no attribute 'lower'
  • For +=, the built-in list treats the right hand operand as an iterable of items to be added (but does not require it to be a list), while NocaseList treats the the right hand operand as a single item to add (tested on Python 2.7 and 3.8):
>>> r = list(); r += 'Dog'; r
['D', 'o', 'g']
>>> r = NocaseList(); r += 'Dog'; r
['Dog']

>>> r = list(); r += ['Dog']; r
['Dog']
>>> r = NocaseList(); r += ['Dog']; 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/maiera/PycharmProjects/pywbem/nocaselist/nocaselist/_nocaselist.py", line 127, in __iadd__
    self.append(value)
  File "/Users/maiera/PycharmProjects/pywbem/nocaselist/nocaselist/_nocaselist.py", line 319, in append
    self._lc_list.append(value.lower())
AttributeError: 'list' object has no attribute 'lower'

The test cases were:

from nocaselist import NocaseList

r = list() + 'Dog'; r
r = NocaseList() + 'Dog'; r

r = list() + ['Dog']; r
r = NocaseList() + ['Dog']; r

r = list(); r += 'Dog'; r
r = NocaseList(); r += 'Dog'; r

r = list(); r += ['Dog']; r
r = NocaseList(); r += ['Dog']; r

r = list(); r.extend('Dog'); r
r = NocaseList(); r.extend('Dog'); r

r = list(); r.extend(['Dog']); r
r = NocaseList(); r.extend(['Dog']); r

r = list(); r.append('Dog'); r
r = NocaseList(); r.append('Dog'); r

r = list(); r.append(['Dog']); r
r = NocaseList(); r.append(['Dog']); r

Test with latest package levels does not use latest indirect dependents

Actual behavior

The installation of packages is done with pip install --upgrade. That does not upgrade already installed versions of indirect dependents. The Ubuntu used by Travis has quite a number of packages preinstalled in the virtualenv it provides, so these packages stay at versions that are not the latest, if they satisfy the minimum requirements of the other packages.

Expected behavior

Testing with latest package levels should upgrade all packages including indirect dependencies.

This can be achieved by adding the pip option --upgrade-strategy eager.

Execution environment

  • nocaselist version: 1.0.3
  • Python version: any
  • Operating System (type+version): any

Testcases that specify no expected warning tolerate warnings

Actual behavior

Testcases that specify no expected warning tolerate warnings that occur nevertheless.

Expected behavior

Testcases that specify no expected warning should verify that no warning occurs and fail otherwise.

Execution environment

  • nocasedict version: 1.0.2
  • Python version: and
  • Operating System (type+version): any

Switch to sphinx-rtd-theme

The Python classic theme is really outdated these days, with Python 2.7 being EOL. Switch to using the sphinx_rtd_theme (see nocasedict).

Resolve issues with Fedora packaging

The Fedora packaging request https://bugzilla.redhat.com/show_bug.cgi?id=1880953 has a comment with some suggestions:

  • Please bump to 1.0.3
  • Files are 404, relying on https://github.com/pywbem/nocaselist/blob/master/packaging/fedora/python-nocaselist.spec
  • You don't need to specify the BuildRequires twice:
    BuildRequires:  python3-devel
    BuildRequires:  python3dist(setuptools)
    
    # Test deps
    BuildRequires:  python3dist(pytest)
    BuildRequires:  python3dist(six)
    
    and here:
    %package -n python3-%{srcname}
    Summary:        %{summary}
    BuildRequires:  python3-devel
    BuildRequires:  python3dist(setuptools)
    # Test deps
    BuildRequires:  python3dist(pytest)
    BuildRequires:  python3dist(six)
    

Add comment why __sizeof__() is not implemented

The sys.getsizeof(obj) function returns the memory size of obj in Bytes. It does that by calling __sizeof__() on the object and adding the GC overhead if the object is GC-managed.

The rules for whether a user-defined class like NocaseList has to implement __sizeof__() are not documented in the Python docs.

Here is a comparison between list and NocaseList that shows reaonable sizes for NocaseList.

Therefore, all that seems to be needed is to add a comment as to why sizeof() is not implemented.

import sys
from nocaselist import NocaseList
nl = NocaseList()
sl = list()
print("len list NocaseList")
for x in range(0, 25):
    print(x, sys.getsizeof(sl), sys.getsizeof(nl))
    value = str(x)
    nl.append(value)
    sl.append(value)

resulting in:

len list NocaseList
0 56 72
1 88 104
2 88 104
3 88 104
4 88 104
5 120 136
6 120 136
7 120 136
8 120 136
9 184 200
10 184 200
11 184 200
12 184 200
13 184 200
14 184 200
15 184 200
16 184 200
17 256 272
18 256 272
19 256 272
20 256 272
21 256 272
22 256 272
23 256 272
24 256 272

2.0.0: pytest is falang in all units with `TypeError: exceptions must be derived from Warning, not <class 'NoneType'>`

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using installer module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

Looks like it may be cause by use latest pytest 8.1.1 but I'm not 100% sure.

AttributeError: 'Path' object has no attribute 'write_bytes' from virtualenv on py34

Actual behavior

See Travis run: https://travis-ci.org/github/pywbem/nocaselist/jobs/732737366

Testcase test1: Pip install from repo root directory: /home/travis/build/pywbem/nocaselist
Saving location of current virtualenv: /home/travis/virtualenv/python3.4.8
Before creating virtualenv: /home/travis/build/pywbem/nocaselist/tmp_installtest/virtualenvs/nocaselist_test_test1
Python version: Python 3.4.8 from /home/travis/virtualenv/python3.4.8/bin/python
Pip version: pip 19.1.1 from /home/travis/virtualenv/python3.4.8/lib/python3.4/site-packages/pip (python 3.4)
Creating virtualenv: /home/travis/build/pywbem/nocaselist/tmp_installtest/virtualenvs/nocaselist_test_test1
Error: Command failed with rc=1: virtualenv -p /home/travis/virtualenv/python3.4.8/bin/python  /home/travis/build/pywbem/nocaselist/tmp_installtest/virtualenvs/nocaselist_test_test1, output follows:
AttributeError: 'Path' object has no attribute 'write_bytes'
Makefile:585: recipe for target 'installtest' failed

Expected behavior

Success

Execution environment

  • nocaselist version: 1.0.2
  • Python version: 3.4
  • Operating System (type+version): Ubuntu (Travis)

Remove Python version enforcement

The __init__.py module enforces the supported Python versions at run time. For a package like nocaselist, this seems overkill. Remove the enforcement.

Support clear() also on Python 2

The built-in list class supports clear() only starting with Python 3.3.

I think it would be good for ease of use if NocaseList supported all features from Python 3.8 back on all supported Python versions. I think the clear() method is the only one that would need to be added on Python 2.

Run coveralls on all Python versions

Coveralls is able to merge the results of multiple runs on different Python versions. Remove the restriction in .travis.yml to invoke it only on a single Python version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.