Skip to content

Commit

Permalink
Merge branch 'release-0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
bbengfort committed Feb 19, 2016
2 parents dfc736c + 3af1bd7 commit 2562552
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 41 deletions.
3 changes: 3 additions & 0 deletions DESCRIPTION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Baleen is a tool for ingesting formal natural language data from the discourse of professional and amateur writers: e.g. bloggers and news outlets. Rather than performing web scraping, Baleen focuses on data ingestion through the use of RSS feeds. It performs as much raw data collection as it can, saving data into a Mongo document store.

For more, please see the full documentation at: http://baleen-ingest.readthedocs.org/en/latest/
7 changes: 7 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include *.md
include *.txt
include *.yml
include Makefile
recursive-include docs *.md
recursive-include docs *.jpg
recursive-include tests *.py
12 changes: 4 additions & 8 deletions baleen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@
## Imports
##########################################################################

from .version import get_version

##########################################################################
## Vesioning
## Package Version
##########################################################################

__version__ = (0,1,0)

def get_version():
"""
Returns the string containing the version number
"""
return "%i.%i.%i" % __version__
__version__ = get_version()
40 changes: 40 additions & 0 deletions baleen/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# baleen.version
# Stores version information such that it can be read by setuptools.
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Thu Feb 18 20:14:16 2016 -0500
#
# Copyright (C) 2016 Bengfort.com
# For license information, see LICENSE.txt
#
# ID: version.py [] benjamin@bengfort.com $

"""
Stores version information such that it can be read by setuptools.
"""

##########################################################################
## Imports
##########################################################################

__version_info__ = {
'major': 0,
'minor': 1,
'micro': 0,
'releaselevel': 'final',
'serial': 0,
}


def get_version(short=False):
"""
Computes a string representation of the version from __version_info__.
"""
assert __version_info__['releaselevel'] in ('alpha', 'beta', 'final')
vers = ["%(major)i.%(minor)i" % __version_info__, ]
if __version_info__['micro']:
vers.append(".%(micro)i" % __version_info__)
if __version_info__['releaselevel'] != 'final' and not short:
vers.append('%s%i' % (__version_info__['releaselevel'][0],
__version_info__['serial']))
return ''.join(vers)
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.md
116 changes: 84 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
#!/usr/bin/env python
# setup
# Setup script for baleen
# Setup script for installing baleen
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Fri Sep 19 10:59:24 2014 -0400
#
# Copyright (C) 2014 District Data Labs
# Copyright (C) 2014 Bengfort.com
# For license information, see LICENSE.txt and NOTICE.md
#
# ID: setup.py [] benjamin@bengfort.com $

"""
Setup script for baleen
Setup script for installing baleen.
See http://bbengfort.github.io/programmer/2016/01/20/packaging-with-pypi.html
"""

##########################################################################
## Imports
##########################################################################

try:
from setuptools import setup
from setuptools import find_packages
except ImportError:
raise ImportError("Could not import \"setuptools\"."
"Please install the setuptools package.")
import os
import re
import codecs

from setuptools import setup
from setuptools import find_packages

##########################################################################
## Package Information
##########################################################################

## Discover the packages
packages = find_packages(where=".", exclude=("tests", "bin", "docs", "fixtures",))
## Basic information
NAME = "baleen"
DESCRIPTION = "An automated ingestion service for blogs to construct a corpus for NLP research."
AUTHOR = "Benjamin Bengfort"
EMAIL = "benjamin@bengfort.com"
LICENSE = "MIT"
REPOSITORY = "https://github.com/bbengfort/baleen"
PACKAGE = "baleen"

## Load the requirements
requires = []
with open('requirements.txt', 'r') as reqfile:
for line in reqfile:
requires.append(line.strip())
## Define the keywords
KEYWORDS = ('nlp', 'baleen', 'ingestion', 'blogs', 'rss')

## Define the classifiers
classifiers = (
## See https://pypi.python.org/pypi?%3Aaction=list_classifiers
CLASSIFIERS = (
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
Expand All @@ -53,24 +58,71 @@
'Topic :: Utilities',
)

## Define the keywords
keywords = ('nlp', 'baleen', 'ingestion', 'blogs', 'rss')
## Important Paths
PROJECT = os.path.abspath(os.path.dirname(__file__))
REQUIRE_PATH = "requirements.txt"
VERSION_PATH = os.path.join(PACKAGE, "version.py")
PKG_DESCRIBE = "DESCRIPTION.txt"

## Directories to ignore in find_packages
EXCLUDES = (
"tests", "bin", "docs", "fixtures", "register", "notebooks",
)

##########################################################################
## Helper Functions
##########################################################################

def read(*parts):
"""
Assume UTF-8 encoding and return the contents of the file located at the
absolute path from the REPOSITORY joined with *parts.
"""
with codecs.open(os.path.join(PROJECT, *parts), 'rb', 'utf-8') as f:
return f.read()


def get_version(path=VERSION_PATH):
"""
Reads the __init__.py defined in the VERSION_PATH to find the get_version
function, and executes it to ensure that it is loaded correctly.
"""
namespace = {}
exec(read(path), namespace)
return namespace['get_version']()


def get_requires(path=REQUIRE_PATH):
"""
Yields a generator of requirements as defined by the REQUIRE_PATH which
should point to a requirements.txt output by `pip freeze`.
"""
for line in read(path).splitlines():
line = line.strip()
if line and not line.startswith('#'):
yield line

##########################################################################
## Define the configuration
##########################################################################

config = {
"name": "baleen",
"version": "0.1.0",
"description": "An automated ingestion service for blogs to construct a corpus for NLP research.",
"license": "MIT",
"author": "Benjamin Bengfort",
"author_email": "benjamin@bengfort.com",
"url": "https://github.com/bbengfort/baleen",
"download_url": 'https://github.com/bbengfort/baleen/tarball/v0.1.0',
"packages": packages,
"install_requires": requires,
"classifiers": classifiers,
"keywords": keywords,
"zip_safe": True,
"name": NAME,
"version": get_version(),
"description": DESCRIPTION,
"long_description": read(PKG_DESCRIBE),
"license": LICENSE,
"author": AUTHOR,
"author_email": EMAIL,
"maintainer": AUTHOR,
"maintainer_email": EMAIL,
"url": REPOSITORY,
"download_url": "{}/tarball/v{}".format(REPOSITORY, get_version()),
"packages": find_packages(where=PROJECT, exclude=EXCLUDES),
"install_requires": list(get_requires()),
"classifiers": CLASSIFIERS,
"keywords": KEYWORDS,
"zip_safe": False,
"scripts": ['bin/baleen'],
}

Expand Down
8 changes: 7 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@

import unittest

##########################################################################
## Module Constants
##########################################################################

TEST_VERSION = "0.1" ## Also the expected version onf the package

##########################################################################
## Test Cases
##########################################################################
Expand All @@ -45,4 +51,4 @@ def test_version(self):
Assert that the version is sane
"""
import baleen
self.assertEqual("0.1.0", baleen.get_version())
self.assertEqual(TEST_VERSION, baleen.__version__)

0 comments on commit 2562552

Please sign in to comment.