Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split non-ML part into a new talon-core package #200

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ COPY wheel/* /wheel/

RUN mkdir -p ${REPORT_PATH}

RUN python ./setup.py build bdist_wheel -d /wheel && \
RUN (cd talon-core && python setup.py build bdist_wheel -d /wheel) && \
(cd talon && python setup.py build bdist_wheel -d /wheel) && \
pip install --no-deps /wheel/*

ENTRYPOINT ["/bin/sh", "/app/run_tests.sh"]
155 changes: 0 additions & 155 deletions README.rst

This file was deleted.

1 change: 1 addition & 0 deletions README.rst
2 changes: 1 addition & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
set -ex
REPORT_PATH="${REPORT_PATH:-./}"
nosetests --with-xunit --with-coverage --cover-xml --cover-xml-file $REPORT_PATH/coverage.xml --xunit-file=$REPORT_PATH/nosetests.xml --cover-package=talon .
nosetests --with-xunit --with-coverage --cover-xml --cover-xml-file $REPORT_PATH/coverage.xml --xunit-file=$REPORT_PATH/nosetests.xml --cover-package=talon --cover-package=talon-core talon talon-core
64 changes: 0 additions & 64 deletions setup.py

This file was deleted.

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.
32 changes: 32 additions & 0 deletions talon-core/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from __future__ import absolute_import
from setuptools import setup, find_packages


setup(name='talon-core',
version='1.6.0',
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",
"regex",
"chardet",
"cchardet",
"cssselect",
"six",
"html5lib",
"joblib",
],
tests_require=[
"mock",
"nose",
"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
6 changes: 3 additions & 3 deletions talon/quotations.py → talon-core/talon_core/quotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
from lxml import etree, html
from six.moves import range

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

log = logging.getLogger(__name__)

Expand Down
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
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 @@ -8,7 +8,7 @@
from lxml.etree import _Element
from lxml.html import html5parser

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


def get_delimiter(msg_body: str) -> str:
Expand Down
8 changes: 8 additions & 0 deletions talon-core/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from __future__ import absolute_import
from nose.tools import *
from mock import *

import talon_core


talon_core.init()
13 changes: 13 additions & 0 deletions talon-core/tests/fixtures/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os

FIXTURES_DIR = os.path.dirname(__file__)
STANDARD_REPLIES = FIXTURES_DIR + "/standard_replies"

with open(FIXTURES_DIR + "/reply-quotations-share-block.eml") as f:
REPLY_QUOTATIONS_SHARE_BLOCK = f.read()

with open(FIXTURES_DIR + "/OLK_SRC_BODY_SECTION.html") as f:
OLK_SRC_BODY_SECTION = f.read()

with open(FIXTURES_DIR + "/reply-separated-by-hr.html") as f:
REPLY_SEPARATED_BY_HR = f.read()
Loading