Skip to content

Commit

Permalink
Split non-ML part into a new talon-core package
Browse files Browse the repository at this point in the history
The nonstandard `setup.py install --no-ml` option didn’t work
correctly with pip.  We could move the ML dependencies into an extra,
but that approach was previously rejected (#121): extras can’t be
enabled by default, so it could have been disruptive to existing
users.  Instead, we split off a new talon-core package with no ML
dependencies, and have talon re-export everything from it.

Fixes #130; fixes #131.

Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Oct 3, 2019
1 parent d9ed7cc commit 9140900
Show file tree
Hide file tree
Showing 106 changed files with 461 additions and 198 deletions.
155 changes: 0 additions & 155 deletions README.rst

This file was deleted.

1 change: 1 addition & 0 deletions README.rst
File renamed without changes.
5 changes: 5 additions & 0 deletions talon-core/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
recursive-exclude tests *.pyc *~
recursive-exclude talon *.pyc *~
include LICENSE
include MANIFEST.in
include README.rst
6 changes: 6 additions & 0 deletions talon-core/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
talon-core
==========

This is the part of talon that does not depend on NumPy, SciPy, and
scikit-learn, and does not include any machine learning functionality.
See the main talon package for documentation.
31 changes: 31 additions & 0 deletions talon-core/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from __future__ import absolute_import
from setuptools import setup, find_packages


setup(name='talon-core',
version='1.4.8',
description=("Mailgun library "
"to extract message quotations and signatures."),
long_description=open("README.rst").read(),
author='Mailgun Inc.',
author_email='[email protected]',
url='https://github.com/mailgun/talon',
license='APACHE2',
packages=find_packages(exclude=['tests', 'tests.*']),
include_package_data=True,
zip_safe=True,
install_requires=[
"lxml>=2.3.3",
"regex>=1",
'chardet>=1.0.1',
'cchardet>=0.3.5',
'cssselect',
'six>=1.10.0',
'html5lib'
],
tests_require=[
"mock",
"nose>=1.2.1",
"coverage"
]
)
6 changes: 6 additions & 0 deletions talon-core/talon_core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from __future__ import absolute_import
from talon_core.quotations import register_xpath_extensions


def init():
register_xpath_extensions()
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from __future__ import absolute_import
import regex as re

from talon.utils import cssselect
from talon_core.utils import cssselect

CHECKPOINT_PREFIX = '#!%!'
CHECKPOINT_SUFFIX = '!%!#'
Expand Down
4 changes: 2 additions & 2 deletions talon/quotations.py → talon-core/talon_core/quotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

from lxml import html, etree

from talon.utils import (get_delimiter, html_tree_to_text,
from talon_core.utils import (get_delimiter, html_tree_to_text,
html_document_fromstring)
from talon import html_quotations
from talon_core import html_quotations
from six.moves import range
import six

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import regex as re

from talon.signature.constants import (SIGNATURE_MAX_LINES,
from talon_core.signature.constants import (SIGNATURE_MAX_LINES,
TOO_LONG_SIGNATURE_LINE)
from talon.utils import get_delimiter
from talon_core.utils import get_delimiter

log = logging.getLogger(__name__)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion talon/utils.py → talon-core/talon_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from lxml.cssselect import CSSSelector
from lxml.html import html5parser

from talon.constants import RE_DELIMITER
from talon_core.constants import RE_DELIMITER


def safe_format(format_string, *args, **kwargs):
Expand Down
11 changes: 11 additions & 0 deletions talon-core/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from __future__ import absolute_import
from nose.tools import *
from mock import *

import talon_core


EML_MSG_FILENAME = "tests/fixtures/standard_replies/yahoo.eml"


talon_core.init()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# noinspection PyUnresolvedReferences
import re

from talon import quotations, utils as u
from talon_core import quotations, utils as u
from . import *
from .fixtures import *
from lxml import html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from . import *
from . fixtures import *

from talon import quotations
from talon_core import quotations


@patch.object(quotations, 'extract_from_html')
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import absolute_import
from .. import *

from talon.signature import bruteforce
from talon_core.signature import bruteforce


def test_empty_body():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os

import email.iterators
from talon import quotations
from talon_core import quotations
import six
from six.moves import range
from six import StringIO
Expand Down
2 changes: 1 addition & 1 deletion tests/utils_test.py → talon-core/tests/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import cchardet
import six

from talon import utils as u
from talon_core import utils as u
from . import *


Expand Down
Loading

0 comments on commit 9140900

Please sign in to comment.