diff --git a/.gitignore b/.gitignore index 5be4465..51200c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.py[cod] __pycache__ +.cache database.sqlite @@ -8,6 +9,7 @@ database.sqlite # Packages *.egg +*.eggs *.egg-info dist build diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1e4e375 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +sudo: false +language: python +python: + - "3.4" + - "3.5" +cache: + directories: + - $HOME/.cache/pip +install: + - pip install -r test-requirements.txt + - python setup.py develop + - pip freeze +script: py.test --cov=./ +after_success: + - codecov diff --git a/README.md b/README.md index 3bdfa00..58964d0 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,24 @@ -[![Stories in Ready](https://badge.waffle.io/jaywink/social-federation.png?label=ready&title=Ready)](https://waffle.io/jaywink/social-federation) -## Social-Federation +[![Stories in Ready](https://badge.waffle.io/jaywink/social-federation.png?label=ready&title=Ready)](https://waffle.io/jaywink/social-federation) [![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) -[![Code Health](https://landscape.io/github/jaywink/social-federation/master/landscape.svg?style=flat)](https://landscape.io/github/jaywink/social-federation/master) +# Social-Federation Python library to abstract social federation protocols. -Aims to first support Diaspora and then the W3C SocialWG ActivityStreams 2 based future protocol. +Aims to first support Diaspora and then the W3C SocialWG ActivityPub protocol. + +## Requirements + +* Python 3.x + +## Testing + +Install requirements: + + pip install -r test-requirements.txt + +Run tests: + + py.test ## License diff --git a/federation/protocols/diaspora/protocol.py b/federation/protocols/diaspora/protocol.py index d57126d..dcb2aaa 100644 --- a/federation/protocols/diaspora/protocol.py +++ b/federation/protocols/diaspora/protocol.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from base64 import b64decode, urlsafe_b64decode, b64encode, urlsafe_b64encode from json import loads, dumps from urllib.parse import unquote_plus, quote_plus, urlencode diff --git a/federation/tests/entities/diaspora/test_generators.py b/federation/tests/entities/diaspora/test_generators.py index 3c1793f..2eab243 100644 --- a/federation/tests/entities/diaspora/test_generators.py +++ b/federation/tests/entities/diaspora/test_generators.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from datetime import datetime from lxml import etree from unittest.mock import patch diff --git a/federation/tests/entities/diaspora/test_mappers.py b/federation/tests/entities/diaspora/test_mappers.py index df17e89..8d3a112 100644 --- a/federation/tests/entities/diaspora/test_mappers.py +++ b/federation/tests/entities/diaspora/test_mappers.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from datetime import datetime from federation.entities.base import Post diff --git a/federation/tests/entities/test_base.py b/federation/tests/entities/test_base.py index d9df275..b6570f1 100644 --- a/federation/tests/entities/test_base.py +++ b/federation/tests/entities/test_base.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from federation.tests.factories.entities import TaggedPostFactory diff --git a/federation/tests/factories/entities.py b/federation/tests/factories/entities.py index aedab9b..4490fc4 100644 --- a/federation/tests/factories/entities.py +++ b/federation/tests/factories/entities.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from random import shuffle import factory from factory import fuzzy diff --git a/federation/tests/fixtures/payloads.py b/federation/tests/fixtures/payloads.py index 14c1c67..a8fbf10 100644 --- a/federation/tests/fixtures/payloads.py +++ b/federation/tests/fixtures/payloads.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + ENCRYPTED_DIASPORA_PAYLOAD = """ {encrypted_header} diff --git a/federation/tests/hostmeta/test_generators.py b/federation/tests/hostmeta/test_generators.py index e00b1a6..9d9a171 100644 --- a/federation/tests/hostmeta/test_generators.py +++ b/federation/tests/hostmeta/test_generators.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import json from jsonschema import validate, ValidationError import pytest diff --git a/federation/tests/protocols/diaspora/test_diaspora.py b/federation/tests/protocols/diaspora/test_diaspora.py index 264b1bc..d0b9931 100644 --- a/federation/tests/protocols/diaspora/test_diaspora.py +++ b/federation/tests/protocols/diaspora/test_diaspora.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from base64 import urlsafe_b64decode from lxml import etree import pytest diff --git a/federation/tests/test_controllers.py b/federation/tests/test_controllers.py index 649a209..5a29db2 100644 --- a/federation/tests/test_controllers.py +++ b/federation/tests/test_controllers.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from unittest.mock import patch, Mock from Crypto.PublicKey import RSA import pytest diff --git a/setup.py b/setup.py index 553cdd3..d148641 100644 --- a/setup.py +++ b/setup.py @@ -2,13 +2,20 @@ from setuptools import setup, find_packages +description = 'Python library for abstracting social federation protocols' + + setup( name='Social-Federation', version='0.1.1', - description='Python library for abstracting social federation protocols', + description=description, + long_description=description, author='Jason Robinson', 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', packages=find_packages(exclude=["*.tests.*", "*.tests"]), license="BSD 3-clause", install_requires=[ @@ -19,9 +26,18 @@ setup( "python-dateutil==2.4.2", "python-xrd==0.1", ], - tests_require=[ - "pytest==2.7.2", - "factory_boy==2.5.2", - ], include_package_data=True, + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Topic :: Communications', + 'Topic :: Internet', + ], + keywords='federation diaspora activitypub social', ) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..4f582a9 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,5 @@ +pytest==2.9.1 +factory_boy==2.5.2 +codecov==1.6.3 +coverage<4.0a1 +pytest-cov==1.8.1