Exploring the development environment

This document will go through all repositories of Badges project and describe the state of development environment and how it could be improved.

Tahrir

Tahrir is a Fedora badges frontend. The guide for setting up development environment is described in DEVELOPING.md and it’s using Vagrant.

Vagrantfile.example is using F29, which is no longer available. Updated this to F36, but encountered issue when tried to provision the machine by ansible Failed to connect to the host via ssh: Shared connection to xxx.xxx.xxx.xxx closed. Solved by defining the domain of VM in Vagrantfile:

config.vm.define "tahrir" do |tahrir|
  tahrir.vm.host_name = "tahrir.example.com"

  tahrir.vm.provider :libvirt do |domain|
      # Season to taste
      domain.cpus = 4
      domain.graphics_type = "spice"
      domain.memory = 2048
      domain.video_type = "qxl"
  end
end

The installation of the tahrir needed a specific version of setuptools (57.5.0), later version doesn’t have 2to3 in it.

The provisioning steps in the ansible needed to be done manually, because of this setuptools issue. Installation in a virtual environment inside the vagrant machine was finished successfully.

Initialization of the database failed on ImportError: cannot import name ‘ZopeTransactionExtension’ from ‘zope.sqlalchemy’. To get over this I needed to remove extension=ZopeTransactionExtension() and corresponding import from .venv/lib64/python3.8/site-packages/tahrir_api-0.8.1-py3.8.egg/tahrir_api/model.py.

Next issue during the initialization of DB was ModuleNotFoundError: No module named ‘utils’ Fixed this by adding . before local imports in .venv/lib64/python3.8/site-packages/tahrir_api-0.8.1-py3.8.egg/tahrir_api/dbapi.py This was the end of the provisioning phase.

When trying to run pserve –reload development.ini I ended up with error TypeError: SignedCookieSessionFactory() got an unexpected keyword argument ‘cookie_secure’ Fixed by removing cookie_ prefix from SignedCookieSessionFactory call in /vagrant/tahrir/__init__.py

Another error ImportError: cannot import name ‘authenticated_userid’ from ‘pyramid.security’ (unknown location) Fixed this by changing the dependency pyramid < 2.0 in setup.py See https://github.com/stevearc/pypicloud/issues/274 for more info

After that the instance is running, but it’s not accessible outside of the VM. When trying curl http://0.0.0.0:8000 it throws error TypeError: __init__() got an unexpected keyword argument ‘extension’

At this point we wouldn’t want to put more effort in it, because it means starting to fix issues in app itself and this is not part of the investigation.

Recommendation

Before fixing the development environment Tahrir needs to be updated to python 3.0, so it could run no never versions of Fedora.

The development environment itself could be used with few enhancements. See investigation above.

tahrir_api

tahrir_api is part of Fedora Badges backend and provides API and database to work with. The guide for setting up development environment is available in README and it’s using Python virtual environment.

The guide is working without issue, but it’s missing any tools to work with tahrir_api itself.

Recommendation

Provide guide or tools to work with standalone tahrir_api in development environment.

fedbadges

fedbadges is part of Fedora Badges backend and provides consumer for fedmsg messages. There is no guide or any description of development environment.

Recommendation

Create a development environment that allows you to work with fedbadges and document it.