-
-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from john-kurkowski/master
Avoid importing the package in setup.py
- Loading branch information
Showing
3 changed files
with
36 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,34 @@ | ||
'''tldextract setup.py''' | ||
"""`tldextract` accurately separates the gTLD or ccTLD (generic or country code | ||
top-level domain) from the registered domain and subdomains of a URL. | ||
>>> import tldextract | ||
>>> tldextract.extract('http://forums.news.cnn.com/') | ||
ExtractResult(subdomain='forums.news', domain='cnn', suffix='com') | ||
>>> tldextract.extract('http://forums.bbc.co.uk/') # United Kingdom | ||
ExtractResult(subdomain='forums', domain='bbc', suffix='co.uk') | ||
>>> tldextract.extract('http://www.worldbank.org.kg/') # Kyrgyzstan | ||
ExtractResult(subdomain='www', domain='worldbank', suffix='org.kg') | ||
`ExtractResult` is a namedtuple, so it's simple to access the parts you want. | ||
>>> ext = tldextract.extract('http://forums.bbc.co.uk') | ||
>>> (ext.subdomain, ext.domain, ext.suffix) | ||
('forums', 'bbc', 'co.uk') | ||
>>> # rejoin subdomain and domain | ||
>>> '.'.join(ext[:2]) | ||
'forums.bbc' | ||
>>> # a common alias | ||
>>> ext.registered_domain | ||
'bbc.co.uk' | ||
""" | ||
|
||
import re | ||
import sys | ||
from setuptools import setup | ||
import tldextract | ||
|
||
# I don't want to learn reStructuredText right now, so strip Markdown links | ||
# that make pip barf. | ||
LONG_DESCRIPTION_MD = tldextract.tldextract.__doc__ | ||
LONG_DESCRIPTION_MD = __doc__ | ||
LONG_DESCRIPTION = re.sub(r'(?s)\[(.*?)\]\((http.*?)\)', r'\1', LONG_DESCRIPTION_MD) | ||
|
||
INSTALL_REQUIRES = ["setuptools"] | ||
|
@@ -16,7 +37,7 @@ | |
|
||
setup( | ||
name="tldextract", | ||
version=tldextract.__version__, | ||
version="1.7.2", | ||
author="John Kurkowski", | ||
author_email="[email protected]", | ||
description=("Accurately separate the TLD from the registered domain and" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
"""Export tldextract's public interface.""" | ||
|
||
import pkg_resources | ||
|
||
from .tldextract import extract, TLDExtract | ||
|
||
__version__ = "1.7.2" | ||
try: | ||
__version__ = pkg_resources.get_distribution('tldextract').version # pylint: disable=no-member | ||
except pkg_resources.DistributionNotFound as _: | ||
__version__ = '(local)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters