Rename library to federation

Less typing saves lives.
merge-requests/130/head
Jason Robinson 2016-10-04 22:07:24 +03:00
rodzic 5558f1099d
commit c5becee7fe
15 zmienionych plików z 60 dodań i 49 usunięć

Wyświetl plik

@ -2,7 +2,18 @@
## [unreleased]
### Backwards incompatible changes
### Library is now called `federation`
The name Social-Federation was really only an early project name which stuck. Since the beginning, the main module has been `federation`. It makes sense to unify these and also shorter names are generally nicer.
#### What do you need to do?
Mostly nothing since the module was already called `federation`. Some things to note below:
* Update your requirements with the new library name `federation`.
* If you hook to the old logger `social-federation`, update those to listen to `federation`, which is now the standard logger name used throughout.
### Other backwards incompatible changes
* `federation.utils.diaspora.retrieve_and_parse_profile` will now return `None` if the `Profile` retrieved doesn't validate. This will affect also the output of `federation.fetchers.retrieve_remote_profile` which is the high level function to retrieve profiles.
* Remove unnecessary `protocol` parameter from `federation.fetchers.retrieve_remote_profile`. We're miles away from including other protocols and ideally the caller shouldn't have to pass in the protocol anyway.
@ -13,7 +24,7 @@
### Backwards incompatible changes
* Made `guid` mandatory for `Profile` entity. Library users should always be able to get a full validated object as we consider `guid` a core attribute of a profile.
* Always validate entities created through `federation.entities.diaspora.mappers.message_to_objects`. This is the code that transforms federation messages for the Diaspora protocol to actual entity objects. Previously no validation was done and callers of `federation.inbound.handle_receive` received entities that were not always valid, for example they were missing a `guid`. Now validation is done in the conversion stage and errors are pushed to the `social-federation` logger in the event of invalid messages.
* Always validate entities created through `federation.entities.diaspora.mappers.message_to_objects`. This is the code that transforms federation messages for the Diaspora protocol to actual entity objects. Previously no validation was done and callers of `federation.inbound.handle_receive` received entities that were not always valid, for example they were missing a `guid`. Now validation is done in the conversion stage and errors are pushed to the `federation` logger in the event of invalid messages.
* Note Diaspora Profile XML messages do not provide a GUID. This is handled internally by fetching the guid from the remote hCard so that a valid `Profile` entity can be created.
### Added
@ -44,20 +55,20 @@
## [0.5.0] - 2016-09-05
### Breaking changes
- `federation.outbound.handle_create_payload` parameter `to_user` is now optional. Public posts don't need a recipient. This also affects Diaspora protocol `build_send` method where the change is reflected similarly. [#43](https://github.com/jaywink/social-federation/pull/43)
- `federation.outbound.handle_create_payload` parameter `to_user` is now optional. Public posts don't need a recipient. This also affects Diaspora protocol `build_send` method where the change is reflected similarly. [#43](https://github.com/jaywink/federation/pull/43)
- In practise this means the signature has changed for `handle_create_payload` and `build_send` from **`from_user, to_user, entity`** to **`entity, from_user, to_user=None`**.
### Added
- `Post.provider_display_name` is now supported in the entity outbound/inbound mappers. [#44](https://github.com/jaywink/social-federation/pull/44)
- Add utility method `federation.utils.network.send_document` which is just a wrapper around `requests.post`. User agent will be added to the headers and exceptions will be silently captured and returned instead. [#45](https://github.com/jaywink/social-federation/pull/45)
- Add Diaspora entity utility `federation.entities.diaspora.utils.get_full_xml_representation`. Renders the entity XML document and wraps it in `<XML><post>...</post></XML>`. [#46](https://github.com/jaywink/social-federation/pull/46)
- `Post.provider_display_name` is now supported in the entity outbound/inbound mappers. [#44](https://github.com/jaywink/federation/pull/44)
- Add utility method `federation.utils.network.send_document` which is just a wrapper around `requests.post`. User agent will be added to the headers and exceptions will be silently captured and returned instead. [#45](https://github.com/jaywink/federation/pull/45)
- Add Diaspora entity utility `federation.entities.diaspora.utils.get_full_xml_representation`. Renders the entity XML document and wraps it in `<XML><post>...</post></XML>`. [#46](https://github.com/jaywink/federation/pull/46)
## [0.4.1] - 2016-09-04
### Fixes
- Don't quote/encode `Protocol.build_send` payload. It was doing it wrongly in the first place and also it's not necessary since Diaspora 0.6 protocol changes. [#41](https://github.com/jaywink/social-federation/pull/41)
- Fix identification of Diaspora protocol messages. This was not working in the case that the attributes in the tag were in different order. [#41](https://github.com/jaywink/social-federation/pull/41)
- Don't quote/encode `Protocol.build_send` payload. It was doing it wrongly in the first place and also it's not necessary since Diaspora 0.6 protocol changes. [#41](https://github.com/jaywink/federation/pull/41)
- Fix identification of Diaspora protocol messages. This was not working in the case that the attributes in the tag were in different order. [#41](https://github.com/jaywink/federation/pull/41)
## [0.4.0] - 2016-07-24

Wyświetl plik

@ -1,22 +1,22 @@
[![Build Status](https://travis-ci.org/jaywink/social-federation.svg?branch=master)](https://travis-ci.org/jaywink/social-federation) [![codecov.io](https://codecov.io/github/jaywink/social-federation/coverage.svg?branch=master)](https://codecov.io/github/jaywink/social-federation?branch=master) [![Code Health](https://landscape.io/github/jaywink/social-federation/master/landscape.svg?style=flat)](https://landscape.io/github/jaywink/social-federation/master) [![Requirements Status](https://requires.io/github/jaywink/social-federation/requirements.svg?branch=master)](https://requires.io/github/jaywink/social-federation/requirements/?branch=master) [![Stories in Ready](https://badge.waffle.io/jaywink/social-federation.png?label=ready&title=Board)](https://waffle.io/jaywink/social-federation)
[![Build Status](https://travis-ci.org/jaywink/federation.svg?branch=master)](https://travis-ci.org/jaywink/federation) [![codecov.io](https://codecov.io/github/jaywink/federation/coverage.svg?branch=master)](https://codecov.io/github/jaywink/federation?branch=master) [![Code Health](https://landscape.io/github/jaywink/federation/master/landscape.svg?style=flat)](https://landscape.io/github/jaywink/federation/master) [![Requirements Status](https://requires.io/github/jaywink/federation/requirements.svg?branch=master)](https://requires.io/github/jaywink/federation/requirements/?branch=master) [![Stories in Ready](https://badge.waffle.io/jaywink/federation.png?label=ready&title=Board)](https://waffle.io/jaywink/federation)
[![PyPI version](https://badge.fury.io/py/social-federation.svg)](https://pypi.python.org/pypi/Social-Federation) [![Documentation Status](http://readthedocs.org/projects/social-federation/badge/?version=latest)](http://social-federation.readthedocs.io/en/latest/?badge=latest) [![PyPI downloads](https://img.shields.io/pypi/dm/Social-Federation.svg)](https://pypi.python.org/pypi/Social-Federation) [![PyPI](https://img.shields.io/pypi/pyversions/Social-Federation.svg?maxAge=2592000)](https://pypi.python.org/pypi/Social-Federation) [![PyPI](https://img.shields.io/pypi/l/Social-Federation.svg?maxAge=2592000)](https://pypi.python.org/pypi/Social-Federation)
[![PyPI version](https://badge.fury.io/py/federation.svg)](https://pypi.python.org/pypi/federation) [![Documentation Status](http://readthedocs.org/projects/federation/badge/?version=latest)](http://federation.readthedocs.io/en/latest/?badge=latest) [![PyPI downloads](https://img.shields.io/pypi/dm/federation.svg)](https://pypi.python.org/pypi/federation) [![PyPI](https://img.shields.io/pypi/pyversions/federation.svg?maxAge=2592000)](https://pypi.python.org/pypi/federation) [![PyPI](https://img.shields.io/pypi/l/federation.svg?maxAge=2592000)](https://pypi.python.org/pypi/federation)
# Social-Federation
# federation
Python library to abstract social web federation protocols like Diaspora.
## Introduction
The aim of Social-Federation is to provide and abstract multiple social web protocols like Diaspora in one package. This way applications can be built to (almost) transparently support many protocols without the app builder having to know everything about those protocols.
The aim of `federation` is to provide and abstract multiple social web protocols like Diaspora in one package. This way applications can be built to (almost) transparently support many protocols without the app builder having to know everything about those protocols.
While the library does aim to provide an easy way to implement protocols like Diaspora into your application, it will not be a one to one mirror image of said protocols. The idea is to present one unified collection of entities and high level methods to the application to use. Since protocols can support different feature sets or have different ideas on even simple entities like status messages, it would be impossible to model the core entities according to a single protocol.
![](http://social-federation.readthedocs.io/en/latest/_images/generic_diagram.png)
![](http://federation.readthedocs.io/en/latest/_images/generic_diagram.png)
## Status
Currently the library supports a part of the Diaspora protocol with remaining parts being constantly added. See the [Diaspora](http://social-federation.readthedocs.io/en/latest/protocols.html#diaspora) protocol page for support status.
Currently the library supports a part of the Diaspora protocol with remaining parts being constantly added. See the [Diaspora](http://federation.readthedocs.io/en/latest/protocols.html#diaspora) protocol page for support status.
The code base is well tested and in use in several projects. Backward incompatible changes will however be made at this stage still, however those will be clearly documented in changelog entries.
@ -24,15 +24,15 @@ The code base is well tested and in use in several projects. Backward incompatib
### Installation and requirements
See [installation documentation](http://social-federation.readthedocs.io/en/latest/install.html).
See [installation documentation](http://federation.readthedocs.io/en/latest/install.html).
### Usage and API documentation
See [usage documentation](http://social-federation.readthedocs.io/en/latest/usage.html).
See [usage documentation](http://federation.readthedocs.io/en/latest/usage.html).
### Support and help
See [development and support documentation](http://social-federation.readthedocs.io/en/latest/development.html).
See [development and support documentation](http://federation.readthedocs.io/en/latest/development.html).
### License

Wyświetl plik

@ -91,9 +91,9 @@ qthelp:
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Social-Federation.qhcp"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/federation.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Social-Federation.qhc"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/federation.qhc"
.PHONY: applehelp
applehelp:
@ -110,8 +110,8 @@ devhelp:
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Social-Federation"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Social-Federation"
@echo "# mkdir -p $$HOME/.local/share/devhelp/federation"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/federation"
@echo "# devhelp"
.PHONY: epub

Wyświetl plik

@ -5,7 +5,7 @@ from recommonmark.parser import CommonMarkParser
from federation import __version__
#
# Social-Federation documentation build configuration file, created by
# Federation documentation build configuration file, created by
# sphinx-quickstart on Sun Oct 2 12:42:19 2016.
#
# This file is execfile()d with the current directory set to its
@ -147,7 +147,7 @@ html_theme = 'alabaster'
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = 'Social-Federation v0.8.0'
# html_title = 'federation v0.8.0'
# A shorter title for the navigation bar. Default is the same as html_title.
#
@ -247,7 +247,7 @@ html_static_path = ['_static']
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'Social-Federationdoc'
htmlhelp_basename = 'federationdoc'
# -- Options for LaTeX output ---------------------------------------------
@ -315,7 +315,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'social-federation', 'Social-Federation Documentation',
(master_doc, 'federation', 'federation Documentation',
[author], 1)
]
@ -330,8 +330,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Social-Federation', 'Social-Federation Documentation',
author, 'Social-Federation', 'One line description of project.',
(master_doc, 'federation', 'federation Documentation',
author, 'federation', 'One line description of project.',
'Miscellaneous'),
]

Wyświetl plik

@ -1,7 +1,7 @@
.. _example-projects:
Projects using Social-Federation
--------------------------------
Projects using federation
-------------------------
For examples on how to integrate this library into your project, check these examples:

Wyświetl plik

@ -1,10 +1,10 @@
.. Social-Federation documentation master file, created by
.. federation documentation master file, created by
sphinx-quickstart on Sun Oct 2 12:42:19 2016.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Social-Federation
=================
federation
==========
Python library to abstract social web federation protocols like Diaspora.

Wyświetl plik

@ -16,4 +16,4 @@ Installation
Install with pip or include in your requirements file.::
pip install Social-Federation
pip install federation

Wyświetl plik

@ -1,7 +1,7 @@
Introduction
============
The aim of Social-Federation is to provide and abstract multiple social web protocols like Diaspora in one package. This way applications can be built to (almost) transparently support many protocols without the app builder having to know everything about those protocols.
The aim of *federation* is to provide and abstract multiple social web protocols like Diaspora in one package. This way applications can be built to (almost) transparently support many protocols without the app builder having to know everything about those protocols.
While the library does aim to provide an easy way to implement protocols like Diaspora into your application, it will not be a one to one mirror image of said protocols. The idea is to present one unified collection of entities and high level methods to the application to use. Since protocols can support different feature sets or have different ideas on even simple entities like status messages, it would be impossible to model the core entities according to a single protocol.
@ -10,7 +10,7 @@ While the library does aim to provide an easy way to implement protocols like Di
Status
------
Currently the library supports a part of the Diaspora protocol with remaining parts being constantly added. See the `Diaspora <http://social-federation.readthedocs.io/en/latest/protocols.html#diaspora>`_ protocol page for support status.
Currently the library supports a part of the Diaspora protocol with remaining parts being constantly added. See the `Diaspora <http://federation.readthedocs.io/en/latest/protocols.html#diaspora>`_ protocol page for support status.
The code base is well tested and in use in several projects. Backward incompatible changes will however be made at this stage still, however those will be clearly documented in changelog entries.
@ -20,17 +20,17 @@ Additional information
Installation and requirements
.............................
See `installation documentation <http://social-federation.readthedocs.io/en/latest/install.html>`_.
See `installation documentation <http://federation.readthedocs.io/en/latest/install.html>`_.
Usage and API documentation
...........................
See `usage documentation <http://social-federation.readthedocs.io/en/latest/usage.html>`_.
See `usage documentation <http://federation.readthedocs.io/en/latest/usage.html>`_.
Support and help
................
See `development and support documentation <http://social-federation.readthedocs.io/en/latest/development.html>`_.
See `development and support documentation <http://federation.readthedocs.io/en/latest/development.html>`_.
License
.......

Wyświetl plik

@ -5,7 +5,7 @@ Usage
Entities
--------
Social-Federation has it's own base entity classes. When incoming messages are processed, the protocol specific entity mappers transform the messages into our base entities. In reverse, when creating outgoing payloads, outgoing protocol specific messages are constructed from the base entities.
Federation has it's own base entity classes. When incoming messages are processed, the protocol specific entity mappers transform the messages into our base entities. In reverse, when creating outgoing payloads, outgoing protocol specific messages are constructed from the base entities.
Entity types are as follows below.
@ -34,7 +34,7 @@ If you need the correct protocol speficic entity class from the base entity, eac
Discovery
---------
Social-Federation provides many generators to allow providing the discovery documents that are necessary for the Diaspora protocol for example. The have been made as Pythonic as possible so that library users don't have to meddle with the various documents and their internals. Since each web framework will have it's own way of constructing views, one will still have to provide the view code to call the generators.
Federation provides many generators to allow providing the discovery documents that are necessary for the Diaspora protocol for example. The have been made as Pythonic as possible so that library users don't have to meddle with the various documents and their internals. Since each web framework will have it's own way of constructing views, one will still have to provide the view code to call the generators.
The protocols themselves are too complex to document within this library, please consult protocol documentation on what kind of discovery documents are expected to be served by the application.

Wyświetl plik

@ -9,7 +9,7 @@ from federation.entities.diaspora.entities import (
DiasporaPost, DiasporaComment, DiasporaLike, DiasporaRequest, DiasporaProfile, DiasporaRetraction)
logger = logging.getLogger("social-federation")
logger = logging.getLogger("federation")
MAPPINGS = {
"status_message": DiasporaPost,

Wyświetl plik

@ -3,7 +3,7 @@ import logging
from federation.exceptions import NoSuitableProtocolFoundError
logger = logging.getLogger("social-federation")
logger = logging.getLogger("federation")
PROTOCOLS = (
"diaspora",

Wyświetl plik

@ -15,7 +15,7 @@ from lxml import etree
from federation.exceptions import EncryptedMessageError, NoHeaderInMessageError, NoSenderKeyFoundError
from federation.protocols.base import BaseProtocol
logger = logging.getLogger("social-federation")
logger = logging.getLogger("federation")
PROTOCOL_NAME = "diaspora"
PROTOCOL_NS = "https://joindiaspora.com/protocol"

Wyświetl plik

@ -8,7 +8,7 @@ from xrd import XRD
from federation.entities.base import Profile
from federation.utils.network import fetch_document
logger = logging.getLogger("social-federation")
logger = logging.getLogger("federation")
def retrieve_diaspora_hcard(handle):

Wyświetl plik

@ -6,9 +6,9 @@ from requests.exceptions import RequestException, HTTPError, SSLError
from federation import __version__
logger = logging.getLogger("social-federation")
logger = logging.getLogger("federation")
USER_AGENT = "python/social-federation/%s" % __version__
USER_AGENT = "python/federation/%s" % __version__
def fetch_document(url=None, host=None, path="/", timeout=10, raise_ssl_errors=True):

Wyświetl plik

@ -14,7 +14,7 @@ def get_long_description():
setup(
name='Social-Federation',
name='federation',
version=__version__,
description=description,
long_description=get_long_description(),
@ -22,8 +22,8 @@ setup(
author_email='mail@jasonrobinson.me',
maintainer='Jason Robinson',
maintainer_email='mail@jasonrobinson.me',
url='https://github.com/jaywink/social-federation',
download_url='https://github.com/jaywink/social-federation/releases',
url='https://github.com/jaywink/federation',
download_url='https://github.com/jaywink/federation/releases',
packages=find_packages(),
license="BSD 3-clause",
install_requires=[