Skip to content

Commit

Permalink
1.0 refactoring and cleanup.
Browse files Browse the repository at this point in the history
Various cleanup and refactoring after merging 1.0 branch into master.
  • Loading branch information
jjjake committed Dec 4, 2015
1 parent 97e28bf commit 2b82488
Show file tree
Hide file tree
Showing 60 changed files with 4,844 additions and 2,180 deletions.
27 changes: 4 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
.PHONY: docs

VERSION=$(shell grep version internetarchive/__init__.py | cut -d"'" -f2)
VERSION=$(shell grep -m1 version internetarchive/__init__.py | cut -d\' -f2)

init:
pip install -e .

init-speedups:
pip install -e '.[speedups]'

test:
py.test --verbose

coverage:
py.test --verbose --cov-report html --cov=internetarchive
py.test -v --cov-report term-missing --cov internetarchive

publish:
git tag -a v$(VERSION) -m 'version $(VERSION)'
Expand All @@ -27,22 +21,9 @@ docs:
cd docs && make html
@echo "\033[95m\n\nBuild successful! View the docs homepage at docs/build/html/index.html.\n\033[0m"

pyyaml-egg:
pip install --no-use-wheel -d . pyyaml==3.11
tar -zxf PyYAML-3.11.tar.gz
cd PyYAML-3.11; \
gsed -i '1i import setuptools' setup.py; \
python2.7 setup.py --without-libyaml bdist_egg
mkdir -p wheelhouse
mv PyYAML-3.11/dist/*egg wheelhouse/

clean-pex:
rm -fr ia-pex "$$HOME/.pex/install/*" "$$HOME/.pex/build/*"

pex-binary: clean-pex pyyaml-egg
binary:
pip wheel .
find wheelhouse -name 'PyYAML-3.11*whl' -delete
pex -v --repo wheelhouse/ -r pex-requirements.txt -e internetarchive.iacli.ia:main -o ia-$(VERSION)-py2.pex --no-pypi
pex -v . -e internetarchive.cli.ia:main -o ia-$(VERSION)-py2.pex --no-pypi --repo wheelhouse/

publish-binary: pex-binary
./ia-$(VERSION)-py2.pex upload ia-pex ia-$(VERSION)-py2.pex
Expand Down
5 changes: 0 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ You can also modify metadata after `configuring ia <https://github.com/jjjake/in
$ ia metadata <identifier> --modify="foo:bar" --modify="baz:foooo"
Data Mining
~~~~~~~~~~~

IA Mine can be used for data mining Archive.org metadata and search results: `https://github.com/jjjake/iamine <https://github.com/jjjake/iamine>`__.

Searching
~~~~~~~~~

Expand Down
11 changes: 7 additions & 4 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
.. _api:

API Documentation
=================
Developer Interface
===================

.. module:: internetarchive

Main Interface
--------------
.. autofunction:: get_session
.. autofunction:: get_item
.. autofunction:: get_files
.. autofunction:: iter_files
.. autofunction:: modify_metadata
.. autofunction:: upload
.. autofunction:: download
.. autofunction:: delete
.. autofunction:: get_tasks
.. autofunction:: search_items
.. autofunction:: get_data_miner
.. autofunction:: configure
.. autofunction:: get_username
6 changes: 6 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -267,3 +268,8 @@
#texinfo_no_detailmenu = False

#autodoc_member_order = 'bysource'

intersphinx_mapping = {
'python': ('https://docs.python.org/2.7', None),
'requests': ('http://docs.python-requests.org/en/latest/', None)
}
55 changes: 47 additions & 8 deletions internetarchive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
~~~~~~~~~~~~~~~~~~~~~~~
Internetarchive is a python interface to archive.org.
usage:
Usage::
>>> from internetarchive import get_item
>>> item = get_item('govlawgacode20071')
Expand All @@ -13,19 +14,47 @@
:copyright: (c) 2015 by Internet Archive.
:license: AGPL 3, see LICENSE for more details.
"""
from __future__ import absolute_import

__title__ = 'internetarchive'
__version__ = '0.9.8'
__version__ = '1.0.0.dev2'
__author__ = 'Jacob M. Johnson'
__license__ = 'AGPL 3'
__copyright__ = 'Copyright 2015 Internet Archive'

from .item import Item, File
from .search import Search
from .catalog import Catalog
from .api import *
from internetarchive.item import Item
from internetarchive.files import File
from internetarchive.search import Search
from internetarchive.catalog import Catalog
from internetarchive.session import ArchiveSession
from internetarchive.api import get_item, get_files, modify_metadata, upload, \
download, delete, get_tasks, search_items, \
get_session, configure


__all__ = [
'__version__',

# Classes.
'ArchiveSession',
'Item',
'File',
'Search',
'Catalog',

# API.
'get_item',
'get_files',
'modify_metadata',
'upload',
'download',
'delete',
'get_tasks',
'search_items',
'get_session',
'configure',
]


# Set default logging handler to avoid "No handler found" warnings.
Expand All @@ -38,5 +67,15 @@ def emit(self, record):
pass


log = logging.getLogger('internetarchive')
log = logging.getLogger(__name__)
log.addHandler(NullHandler())


from pkg_resources import iter_entry_points, load_entry_point
for object in iter_entry_points(group='internetarchive.plugins', name=None):
try:
globals()[object.name] = load_entry_point(
object.dist, 'internetarchive.plugins', object.name)
__all__.append(object.name)
except ImportError:
log.warning('Failed to import plugin: {}'.format(object.name))
Loading

0 comments on commit 2b82488

Please sign in to comment.