Giter VIP home page Giter VIP logo

python-udm-rest-api-client's Introduction

Python UDM REST Client

Python library to interact with the Univention UDM REST API, implements the interface of the Python UDM API.

Read the PyPi README for in introduction to this Python package.

For more detailed information, read the official docs.

Repo permissions

  • GitHub:
    • @dansan (Daniel Tröder)
    • @JuergenBS (Jürn Brodersen)
  • GitLab: UCS developers
  • PyPI:
    • @botner (Felix Botner)
    • @brodersen4univention (Jürn Brodersen)
    • @dansan (Daniel Tröder)
    • @jleadbetter-univention (J Leadbetter)
    • @SamualYaron (Ole Schwiegert)
    • @twenzel (Tobias Wenzel)
  • RTD: @dansan and @SamuelYaron
    • @dansan (Daniel Tröder)
    • @SamualYaron (Ole Schwiegert)
    • @jleadbetter-univention (J Leadbetter)

Tests

There are some isolated unittests, but most tests run against a real UDM REST API. Either an existing UCS installation can be used, or a LXD container started.

Run tests with the current Python interpreter:

make test

Using tox the tests can be executed with all supported Python versions:

make test-all

Using the UCS LXD container is automated in the Makefile. It has commands to download and start the LXD image (1 GB) and running the tests:

make create-lxd-test-server-config
make test

Initializing LXD is however left up to the developer (see https://linuxcontainers.org/lxd/). Using storage backend lvm, btrfs or zfs is recommended for repeated use. To run the tests only once, the storage backend dir is the easiest to use. It is very slow though, as it requires unpacking the image every time the container is started.

The Makefile also needs yq to be installed: https://github.com/mikefarah/yq

It is also possible to use an existing UCS server for the tests. Export UCS_HOST (the servers IP/FQDN), UCS_USERDN (the DN of an administrator account, usually uid=Administrator,cn=users,dc=...) and UCS_PASSWORD (the accounts password), before starting the tests:

export UCS_HOST="my.server.local"
export UCS_USERDN="uid=Administrator,cn=users,dc=domain,dc=local"
export UCS_PASSWORD="s3cr3t"
make test

Much more comfortable (especially for repeated use) is creating a file test_server.yaml in the tests directory, which will automatically be used by the tests:

cp test_server_example.yaml test/test_server.yaml
$EDITOR test_server.yaml

Don't forget to update the OpenAPI client library before running the test against a new server:

update_openapi_client --generator <docker|java> --username Administrator --password s3cr3t $UCS_HOST

Run update_openapi_client --help to see further options.

To get the IP address of the running UCS LXD container execute:

. lxd.sh ; lxd_container_ip

Releases

Prerequisites

You need a maintainer account with permissions for the udm-rest-client for:

For the PypI Test and PyPI accounts, generate an API token and add it to your .pypirc with the username __token__.

Install twine:

sudo apt install twine -y

Before the release

  • Verify the daily tests.
  • Create and merge a release commit:
    • Increment the Python package version in udm_rest_client/__init__py and setup.py
    • Update HISTORY.rst with changelog notes.
  • Tag the release commit with the new version.

PyPI Test Release

We want to make sure everything looks as expected on PyPI Test before pushing to production.

  • Push the package to test PyPi:

    make release-test
  • Verify the updated changelog in PyPI Test.
  • Do a smoke test install on a UCS@school VM. Sync the python-udm-rest-api-client folder to the VM, cd to the folder, and then:

    pip3 install --upgrade urllib3
    pip3 install -r requirements.txt
    pip3 install -i https://test.pypi.org/simple/ udm-rest-client

    The installation of requirements.txt is required, because not all needed packages have a PyPI Test version.

  • Verify the installed version:

    pip3 freeze | grep udm

PyPI Release

These steps push the newest version of the udm-rest-client.

  • Push the package to production PyPi:

    make release
  • Verify the updated changelog in PyPI.
  • Do a smoke test install on a UCS@School VM:

    pip3 install --upgrade urllib3
    pip3 install udm-rest-client
  • Verify the installed version:

    pip3 freeze | grep udm

Read the Docs

  • Visit the ReadTheDocs dashboard.
  • Verify that the builds for latest and stable passed.
  • Do a visual inspection of the published docs, latest and stable, paying particular attention that the changelog is up to date on both.

python-udm-rest-api-client's People

Contributors

dansan avatar dependabot[bot] avatar fbotner avatar juergenbs avatar pyup-bot avatar samuelyaron avatar spaceone avatar twenzel225 avatar univentionfwi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-udm-rest-api-client's Issues

pipelines failing with ImportError: cannot import name '_unicodefun' from 'click'

github pipelines are failing:
https://github.com/univention/python-udm-rest-api-client/runs/7627168375?check_suite_focus=true

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repoj8vxqbil/py_env-python3/bin/black", line 8, in <module>
    sys.exit(patched_main())
  File "/home/runner/.cache/pre-commit/repoj8vxqbil/py_env-python3/lib/python3.10/site-packages/black/__init__.py", line 6606, in patched_main
    patch_click()
  File "/home/runner/.cache/pre-commit/repoj8vxqbil/py_env-python3/lib/python3.10/site-packages/black/__init__.py", line 6595, in patch_click
    from click import _unicodefun  # type: ignore
ImportError: cannot import name '_unicodefun' from 'click' (/home/runner/.cache/pre-commit/repoj8vxqbil/py_env-python3/lib/python3.10/site-packages/click/__init__.py)

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.