Python modules for interacting with Fedora Services
Project description
====================
Python Fedora Module
====================
:Author: Toshio Kuratomi
:Date: 18 August 2015
:Version: 0.5.x
The Fedora module provides a python API for building `Fedora Services`_ and
clients that connect to them. It has functions and classes that help to build
TurboGears_ applications and classes to make building clients of those
services much easier.
.. _`Fedora Services`: doc/service.html
.. _TurboGears: http://www.turbogears.org
.. contents::
-------
License
-------
This python module is distributed under the terms of the GNU Lesser General
Public License Version 2 or later.
------------
Dependencies
------------
``python-fedora`` requires the ``munch``, ``kitchen``, and ``requests`` python
modules. It used to use ``pycurl``, but was updated to use ``requests`` as of
version ``0.3.32``.
The ``flask_fas_openid`` module requires the ``python-openid`` and
``python-openid-teams`` modules.
----------
Installing
----------
``python-fedora`` is found in rpm form in Fedora proper. Sometimes a new
version will be placed in the Fedora Infrastructure yum repository for testing
within Infrastructure before being released to the general public. Installing
from the yum repository should be as easy as::
# yum install python-fedora
If you want to install from a checkout of the development branch, follow these
procedures::
# git clone https://github.com/fedora-infra/python-fedora.git
# cd python-fedora
# ./setup.py install
See the configuration notes in each section for information on configuring
your application after install.
---------------------------
Fedora Accounts Integration
---------------------------
We provide several modules that make connecting to the `Fedora Account
System`_ easier.
.. _`Fedora Account System`: https://fedorahosted.org/fas
General Purpose API
===================
The ``fedora.accounts.fas2`` module allows code to integrate with the `Fedora
Account System`_. It uses the JSON interface provided by the Account System
servre to retrieve information about users.
Note: This API is not feature complete. If you'd like to help add methods,
document the existing methods, or otherwise aid in development of this API
please contact us on the infrastructure list: infrastructure@lists.fedoraproject.org
or on IRC: lmacken, abadger1999, and ricky in #fedora-admin, irc.freenode.net.
Using the general API requires instantiating an ``AccountSystem`` object. You
then use methods on the ``AccountSystem`` to get and set information on the
people in the account system.
At the moment, there are only a few methods implemented. Full documentation on
these methods is available from the ``AccountSystem``'s docstrings from the
interpreter or, for instance, by running::
VERSION
3) Download new translations and verify they are valid by compiling them::
zanata-cli pull
python releaseutils.py build_catalogs
# If everything checks out
git commit -m 'Merge new translations from fedora.zanata.org'
4) Make sure that the NEWS file is accurate (use git log if needed).
5) Update python-fedora.spec and fedora/release.py with the new version
information.
# Make edits to python-fedora.spec and release.py
git commit
6) Make sure the docs are proper and publish them::
# Build docs and check for errors
python setup.py build_sphinx
# pypi
python setup.py upload_docs
7) Push the release branch to the server::
# Update files
git flow release publish VERSION
9) Create the tarball in this clean checkout::
python setup.py sdist
10) copy the dist/python-fedora-VERSION.tar.gz and python-fedora.spec files to
where you build Fedora RPMS. Do a test build::
cp dist/python-fedora-*.tar.gz python-fedora.spec /srv/git/python-fedora/
pushd /srv/git/python-fedora/
fedpkg switch-branch master
make mockbuild
11) Make sure the build completes. Run rpmlint on the results. Install and
test the new packages::
rpmlint *rpm
sudo rpm -Uvh *noarch.rpm
[test]
12) When satisfied that the build works, create a fresh tarball and upload to
pypi::
popd # Back to the release directory
python setup.py sdist upload --sign
13) copy the same tarball to fedorahosted. The directory to upload to is
slightly different for fedorahosted admins vs normal fedorahosted users:
Admin::
scp dist/python-fedora*tar.gz* fedorahosted.org:/srv/web/releases/p/y/python-fedora/
Normal contributor::
scp dist/python-fedora*tar.gz* fedorahosted.org:python-fedora
14) mark the release as finished in git::
cd ../python-fedora
git flow release finish $VERSION
git push --all
git push --tags
15) Finish building and pushing packages for Fedora.
Python Fedora Module
====================
:Author: Toshio Kuratomi
:Date: 18 August 2015
:Version: 0.5.x
The Fedora module provides a python API for building `Fedora Services`_ and
clients that connect to them. It has functions and classes that help to build
TurboGears_ applications and classes to make building clients of those
services much easier.
.. _`Fedora Services`: doc/service.html
.. _TurboGears: http://www.turbogears.org
.. contents::
-------
License
-------
This python module is distributed under the terms of the GNU Lesser General
Public License Version 2 or later.
------------
Dependencies
------------
``python-fedora`` requires the ``munch``, ``kitchen``, and ``requests`` python
modules. It used to use ``pycurl``, but was updated to use ``requests`` as of
version ``0.3.32``.
The ``flask_fas_openid`` module requires the ``python-openid`` and
``python-openid-teams`` modules.
----------
Installing
----------
``python-fedora`` is found in rpm form in Fedora proper. Sometimes a new
version will be placed in the Fedora Infrastructure yum repository for testing
within Infrastructure before being released to the general public. Installing
from the yum repository should be as easy as::
# yum install python-fedora
If you want to install from a checkout of the development branch, follow these
procedures::
# git clone https://github.com/fedora-infra/python-fedora.git
# cd python-fedora
# ./setup.py install
See the configuration notes in each section for information on configuring
your application after install.
---------------------------
Fedora Accounts Integration
---------------------------
We provide several modules that make connecting to the `Fedora Account
System`_ easier.
.. _`Fedora Account System`: https://fedorahosted.org/fas
General Purpose API
===================
The ``fedora.accounts.fas2`` module allows code to integrate with the `Fedora
Account System`_. It uses the JSON interface provided by the Account System
servre to retrieve information about users.
Note: This API is not feature complete. If you'd like to help add methods,
document the existing methods, or otherwise aid in development of this API
please contact us on the infrastructure list: infrastructure@lists.fedoraproject.org
or on IRC: lmacken, abadger1999, and ricky in #fedora-admin, irc.freenode.net.
Using the general API requires instantiating an ``AccountSystem`` object. You
then use methods on the ``AccountSystem`` to get and set information on the
people in the account system.
At the moment, there are only a few methods implemented. Full documentation on
these methods is available from the ``AccountSystem``'s docstrings from the
interpreter or, for instance, by running::
3) Download new translations and verify they are valid by compiling them::
zanata-cli pull
python releaseutils.py build_catalogs
# If everything checks out
git commit -m 'Merge new translations from fedora.zanata.org'
4) Make sure that the NEWS file is accurate (use git log if needed).
5) Update python-fedora.spec and fedora/release.py with the new version
information.
# Make edits to python-fedora.spec and release.py
git commit
6) Make sure the docs are proper and publish them::
# Build docs and check for errors
python setup.py build_sphinx
# pypi
python setup.py upload_docs
7) Push the release branch to the server::
# Update files
git flow release publish
9) Create the tarball in this clean checkout::
python setup.py sdist
10) copy the dist/python-fedora-VERSION.tar.gz and python-fedora.spec files to
where you build Fedora RPMS. Do a test build::
cp dist/python-fedora-*.tar.gz python-fedora.spec /srv/git/python-fedora/
pushd /srv/git/python-fedora/
fedpkg switch-branch master
make mockbuild
11) Make sure the build completes. Run rpmlint on the results. Install and
test the new packages::
rpmlint *rpm
sudo rpm -Uvh *noarch.rpm
[test]
12) When satisfied that the build works, create a fresh tarball and upload to
pypi::
popd # Back to the release directory
python setup.py sdist upload --sign
13) copy the same tarball to fedorahosted. The directory to upload to is
slightly different for fedorahosted admins vs normal fedorahosted users:
Admin::
scp dist/python-fedora*tar.gz* fedorahosted.org:/srv/web/releases/p/y/python-fedora/
Normal contributor::
scp dist/python-fedora*tar.gz* fedorahosted.org:python-fedora
14) mark the release as finished in git::
cd ../python-fedora
git flow release finish $VERSION
git push --all
git push --tags
15) Finish building and pushing packages for Fedora.