All Projects → ocf → ocflib

ocf / ocflib

Licence: other
Python libraries for account and server management

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ocflib

slackbridge
Bridge between IRC and Slack running on Kubernetes
Stars: ✭ 12 (-7.69%)
Mutual labels:  pre-commit, jenkinsfile
pre-commit-mirror-maker
Scripts for creating mirror repositories that do not have .pre-commit-hooks.yaml
Stars: ✭ 19 (+46.15%)
Mutual labels:  pre-commit
cibuildwheel
🎡 Build Python wheels for all the platforms on CI with minimal configuration.
Stars: ✭ 1,350 (+10284.62%)
Mutual labels:  pypi
pypi-simple
PyPI Simple Repository API client library
Stars: ✭ 21 (+61.54%)
Mutual labels:  pypi
django-q-email
Queues the sending of email with Django Q.
Stars: ✭ 32 (+146.15%)
Mutual labels:  pypi
habitipy
Command-line interface to Habitica
Stars: ✭ 47 (+261.54%)
Mutual labels:  pypi
py-dependency-install
A GitHub Action that installs Python package dependencies from a user-defined requirements.txt file path with optional pip, setuptools, and wheel installs/updates
Stars: ✭ 23 (+76.92%)
Mutual labels:  pypi
django-http-exceptions
HTTP exceptions for django
Stars: ✭ 29 (+123.08%)
Mutual labels:  pypi
yosys
Unofficial Yosys WebAssembly packages
Stars: ✭ 29 (+123.08%)
Mutual labels:  pypi
ios2androidres
Copy iOS image resources to their appropriate Android directory
Stars: ✭ 20 (+53.85%)
Mutual labels:  pypi
pygitrepo-project
A simplified, minimal but powerful Python Git Project development workflow CLI tools.
Stars: ✭ 32 (+146.15%)
Mutual labels:  pypi
openshift-wiki
Gitbook URL of WIKI
Stars: ✭ 16 (+23.08%)
Mutual labels:  jenkinsfile
termtables
🖥️ Pretty tables in the terminal
Stars: ✭ 85 (+553.85%)
Mutual labels:  pypi
dpytools
Collection of easy to use, beginner friendly but powerful, orthogonal tools to speed up discord bots development (discord.py)
Stars: ✭ 23 (+76.92%)
Mutual labels:  pypi
npm-groovy-lint
Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files using command line
Stars: ✭ 124 (+853.85%)
Mutual labels:  jenkinsfile
domnibus
Access domain information via python and command line.
Stars: ✭ 16 (+23.08%)
Mutual labels:  pypi
pypi-command-line
A powerful, colorful, beautiful command-line-interface for pypi.org
Stars: ✭ 32 (+146.15%)
Mutual labels:  pypi
pre-commit
pre-commit hook terraform; pre-commit hook prometheus
Stars: ✭ 35 (+169.23%)
Mutual labels:  pre-commit
python-lib
Opinionated cookiecutter template for creating a new Python library
Stars: ✭ 75 (+476.92%)
Mutual labels:  pypi
therapist
Work out your commitment issues.
Stars: ✭ 29 (+123.08%)
Mutual labels:  pypi

ocflib

Build Status Coverage Status PyPI version

ocflib is a Python library for working with Open Computing Facility services (in particular, accounts and server management).

The library targets Python 3.5.3 and 3.7 (the versions available in Debian stretch and buster).

The goal of the library is to make it easier to re-use OCF python code. In the past, code was split between approve, atool, create, chpass, sorry, signat, etc., which made it difficult to do things like share common password requirements.

What belongs here

In general, code which can be re-used should be here, but standalone applications or binaries shouldn't. For example, ocfweb uses ocflib code to change passwords and create accounts, but the Django web app doesn't belong here.

Using on OCF

ocflib is installed by Puppet on the OCF, so you can simply do things like import ocflib.lab.stats from the system python3 installation. We don't install it to python2 site-packages.

We build a Debian package which is installed by Puppet. We also publish new versions to PyPI, which is useful because it allows easy installation into virtualenvs.

Installing locally

For Testing Changes

The easiest way to test changes to ocflib is to create a virtualenv and install ocflib in development mode:

make venv
. venv/bin/activate

Now, if you import something from ocflib, you'll be using the version from your working copy.

Testing and linting

We use pytest to test our code, and pre-commit to lint it. You should run make test before pushing to run both.

The tests directory contains automated tests which you're encouraged to add to (and not break). The tests-manual directory contains scripts intended for testing.

Using pre-commit

We use pre-commit to lint our code before commiting. While some of the rules might seem a little arbitrary, it helps keep the style consistent, and ensure annoying things like trailing whitespace don't creep in.

You can simply run make install-hooks to install the necessary git hooks; once installed, pre-commit will run every time you commit.

Alternatively, if you'd rather not install any hooks, you can simply use make test as usual, which will also run the hooks.

Troubleshooting: Cracklib Error

If you're trying to run make install-hooks on ocfweb (or related repos) and get this error:

./_cracklib.c:40:10: fatal error: 'crack.h' file not found
  #include <crack.h>
           ^~~~~~~~~
  1 error generated.

The issue relates to the cracklib package not finding the necessary header files to install. Make sure cracklib is installed on your machine (https://github.com/cracklib/cracklib, if you're on Mac, brew install cracklib).

If you still get this error, there's a good chance it's an issue with the virtual environment, which might be using an old version of pip. Run the following commands:

source venv/bin/activate
pip install --upgrade pip
pip install cracklib
make install-hooks

This will update pip from 18 to 21, install cracklib (hopefully successfully), and then carry on with the build. Note that when you run make install-hooks, the pip version will revert back to 18. This is ok though, since cracklib has already been successfully installed and there should be no other issues.

Deploying changes

Deploying changes involves:

  • Running tests and linters
  • Pushing a new version to PyPI
  • Building a Debian package
  • Pushing the Debian package to our internal apt

Jenkins will automatically perform all of these steps for you on every push, including automatically generating a new version number. As long as make test passes, your code will be automatically deployed. You can monitor the progress of your deploy here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].