diff --git a/build.sh b/build.sh deleted file mode 100755 index 68751b3..0000000 --- a/build.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -#python setup.py build -#jython ez_setup.py - -# This is the current way to create a python 2.7 distribution from source, really -python setup.py bdist_egg - -# TODO: have setup.py read version number from a text file or from github tag -tar cvf metadig-py-1.2.0.tar dist metadig diff --git a/ez_setup.py b/ez_setup.py deleted file mode 100755 index c101cf4..0000000 --- a/ez_setup.py +++ /dev/null @@ -1,284 +0,0 @@ -#!/usr/local/bin/python -"""Bootstrap setuptools installation - -If you want to use setuptools in your package's setup.py, just include this -file in the same directory with it, and add this to the top of your setup.py:: - - from ez_setup import use_setuptools - use_setuptools() - -If you want to require a specific version of setuptools, set a download -mirror, or use an alternate download directory, you can do so by supplying -the appropriate options to ``use_setuptools()``. - -This file can also be run as a script to install or upgrade setuptools. -""" -import sys -DEFAULT_VERSION = "0.6c11" -DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3] - -md5_data = { - 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca', - 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb', - 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b', - 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a', - 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618', - 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac', - 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5', - 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4', - 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c', - 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b', - 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090', - 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4', - 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7', - 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5', - 'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de', - 'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b', - 'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2', - 'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086', - 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27', - 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277', - 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa', - 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e', - 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e', - 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f', - 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2', - 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc', - 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167', - 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64', - 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d', - 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20', - 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab', - 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53', - 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2', - 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e', - 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372', - 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902', - 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de', - 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b', - 'setuptools-0.6c9-py2.3.egg': 'a83c4020414807b496e4cfbe08507c03', - 'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a', - 'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6', - 'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e19383e7b59245a', -} - -import sys, os -try: from hashlib import md5 -except ImportError: from md5 import md5 - -def _validate_md5(egg_name, data): - if egg_name in md5_data: - digest = md5(data).hexdigest() - if digest != md5_data[egg_name]: - print >>sys.stderr, ( - "md5 validation of %s failed! (Possible download problem?)" - % egg_name - ) - sys.exit(2) - return data - -def use_setuptools( - version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, - download_delay=15 -): - """Automatically find/download setuptools and make it available on sys.path - - `version` should be a valid setuptools version number that is available - as an egg for download under the `download_base` URL (which should end with - a '/'). `to_dir` is the directory where setuptools will be downloaded, if - it is not already available. If `download_delay` is specified, it should - be the number of seconds that will be paused before initiating a download, - should one be required. If an older version of setuptools is installed, - this routine will print a message to ``sys.stderr`` and raise SystemExit in - an attempt to abort the calling script. - """ - was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules - def do_download(): - egg = download_setuptools(version, download_base, to_dir, download_delay) - sys.path.insert(0, egg) - import setuptools; setuptools.bootstrap_install_from = egg - try: - import pkg_resources - except ImportError: - return do_download() - try: - pkg_resources.require("setuptools>="+version); return - except pkg_resources.VersionConflict, e: - if was_imported: - print >>sys.stderr, ( - "The required version of setuptools (>=%s) is not available, and\n" - "can't be installed while this script is running. Please install\n" - " a more recent version first, using 'easy_install -U setuptools'." - "\n\n(Currently using %r)" - ) % (version, e.args[0]) - sys.exit(2) - except pkg_resources.DistributionNotFound: - pass - - del pkg_resources, sys.modules['pkg_resources'] # reload ok - return do_download() - -def download_setuptools( - version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, - delay = 15 -): - """Download setuptools from a specified location and return its filename - - `version` should be a valid setuptools version number that is available - as an egg for download under the `download_base` URL (which should end - with a '/'). `to_dir` is the directory where the egg will be downloaded. - `delay` is the number of seconds to pause before an actual download attempt. - """ - import urllib2, shutil - egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3]) - url = download_base + egg_name - saveto = os.path.join(to_dir, egg_name) - src = dst = None - if not os.path.exists(saveto): # Avoid repeated downloads - try: - from distutils import log - if delay: - log.warn(""" ---------------------------------------------------------------------------- -This script requires setuptools version %s to run (even to display -help). I will attempt to download it for you (from -%s), but -you may need to enable firewall access for this script first. -I will start the download in %d seconds. - -(Note: if this machine does not have network access, please obtain the file - - %s - -and place it in this directory before rerunning this script.) ----------------------------------------------------------------------------""", - version, download_base, delay, url - ); from time import sleep; sleep(delay) - log.warn("Downloading %s", url) - src = urllib2.urlopen(url) - # Read/write all in one block, so we don't create a corrupt file - # if the download is interrupted. - data = _validate_md5(egg_name, src.read()) - dst = open(saveto,"wb"); dst.write(data) - finally: - if src: src.close() - if dst: dst.close() - return os.path.realpath(saveto) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -def main(argv, version=DEFAULT_VERSION): - """Install or upgrade setuptools and EasyInstall""" - try: - import setuptools - except ImportError: - egg = None - try: - egg = download_setuptools(version, delay=0) - sys.path.insert(0,egg) - from setuptools.command.easy_install import main - return main(list(argv)+[egg]) # we're done here - finally: - if egg and os.path.exists(egg): - os.unlink(egg) - else: - if setuptools.__version__ == '0.0.1': - print >>sys.stderr, ( - "You have an obsolete version of setuptools installed. Please\n" - "remove it from your system entirely before rerunning this script." - ) - sys.exit(2) - - req = "setuptools>="+version - import pkg_resources - try: - pkg_resources.require(req) - except pkg_resources.VersionConflict: - try: - from setuptools.command.easy_install import main - except ImportError: - from easy_install import main - main(list(argv)+[download_setuptools(delay=0)]) - sys.exit(0) # try to force an exit - else: - if argv: - from setuptools.command.easy_install import main - main(argv) - else: - print "Setuptools version",version,"or greater has been installed." - print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)' - -def update_md5(filenames): - """Update our built-in md5 registry""" - - import re - - for name in filenames: - base = os.path.basename(name) - f = open(name,'rb') - md5_data[base] = md5(f.read()).hexdigest() - f.close() - - data = [" %r: %r,\n" % it for it in md5_data.items()] - data.sort() - repl = "".join(data) - - import inspect - srcfile = inspect.getsourcefile(sys.modules[__name__]) - f = open(srcfile, 'rb'); src = f.read(); f.close() - - match = re.search("\nmd5_data = {\n([^}]+)}", src) - if not match: - print >>sys.stderr, "Internal error!" - sys.exit(2) - - src = src[:match.start(1)] + repl + src[match.end(1):] - f = open(srcfile,'w') - f.write(src) - f.close() - - -if __name__=='__main__': - if len(sys.argv)>2 and sys.argv[1]=='--md5update': - update_md5(sys.argv[2:]) - else: - main(sys.argv[1:]) - - - - - - diff --git a/install.sh b/install.sh deleted file mode 100755 index 187ad12..0000000 --- a/install.sh +++ /dev/null @@ -1,5 +0,0 @@ -mkdir /opt/local/metadig/metadig-py -rsync -av dist /opt/local/metadig/metadig-py -rsync -av metadig /opt/local/metadig/metadig-py - -#LICENSE README.md build/ buildit.sh* dist/ ez_setup.py* install.sh metadig/ metadig.egg-info/ setup.py diff --git a/metadig-py-1.2.0.tar b/metadig-py-1.2.0.tar deleted file mode 100644 index 1675a51..0000000 Binary files a/metadig-py-1.2.0.tar and /dev/null differ diff --git a/metadig/checks.py b/metadig/checks.py index 40157b4..9d455c4 100644 --- a/metadig/checks.py +++ b/metadig/checks.py @@ -2,62 +2,72 @@ """ import sys -import urllib2 -from urlparse import urlparse +import urllib.request, urllib.error, urllib.parse +from urllib.parse import urlparse + def getType(object): - print 'type: {}'.format(type(object)) - + print("type: {}".format(type(object))) + + def isResolvable(url): -# First parse the url for a protocol, host port and path + # First parse the url for a protocol, host port and path """Function that checks if a url is resolvable - + The function first checks if the url uses HTTP protocols, which is currently the only protocol supported. - + Args: url - the url to check for resolvability - + Returns: list: the first element is either True or False (i.e. is/is not resolvable) the second element is a status message, describing success or an error message. - + """ - #url = 'https://cn.dataone.org/cn/v2/resolve/urn:uuid:7098ba54-ca6f-4e35-beb3-718bd0fe58a8' + # url = 'https://cn.dataone.org/cn/v2/resolve/urn:uuid:7098ba54-ca6f-4e35-beb3-718bd0fe58a8' urlComps = urlparse(url) location = urlComps.netloc - if(urlComps.netloc == ""): + if urlComps.netloc == "": return (False, '"{}" does not appear to be a URL'.format(url)) - - # Check the 'schema' to see if it is an open one. Currently we + + # Check the 'schema' to see if it is an open one. Currently we # are just check for http and https. - knownProtocols = ['http', 'https'] - if(urlComps.scheme not in set(knownProtocols)): - return (False, 'Unknown or proprietary communications protocol: "{}", known protocols: {}'.format(urlComps.scheme, ", ".join(knownProtocols))) - - # Perform an HTTP 'Head' request - we just want to know if the file exists and do not need to - # download it. - request = urllib2.Request(url) - request.get_method = lambda : 'HEAD' + knownProtocols = ["http", "https"] + if urlComps.scheme not in set(knownProtocols): + return ( + False, + 'Unknown or proprietary communications protocol: "{}", known protocols: {}'.format( + urlComps.scheme, ", ".join(knownProtocols) + ), + ) + + # Perform an HTTP 'Head' request - we just want to know if the file exists and do not need to + # download it. + request = urllib.request.Request(url) + request.get_method = lambda: "HEAD" # Python urllib2 strangly throws an error for an http status, and the response object is returned - # by the exception code. + # by the exception code. try: - response = urllib2.urlopen(request) - except urllib2.HTTPError as he: - # An error was encountered resolving the url, check which one so that we can print + response = urllib.request.urlopen(request) + except urllib.error.HTTPError as he: + # An error was encountered resolving the url, check which one so that we can print # a more meaningful error message than provided by HTTPError # FYI, HTTP status codes (from FAIR FM_A1.1 https://github.com/FAIRMetrics/Metrics/blob/master/Distributions/FM_A1.1.pdf) - if (he.code == 400): + if he.code == 400: return (False, "Unable to resolved URL {}: Bad request".format(url)) - elif (he.code == 401): + elif he.code == 401: return (False, "Unable to resolved URL {}: Unauthorized".format(url)) - elif (he.code == 404): + elif he.code == 404: return (False, "Unable to resolved URL {}: Not Found".format(url)) - elif (he.code == 500): + elif he.code == 500: return (False, "Unable to resolved URL {}: Server Error".format(url)) else: - return (False, 'Error resolving URL "{}": {} {}'.format(url, he.code, he.headers)) - except urllib2.URLError as ue: + return ( + False, + 'Error resolving URL "{}": {} {}'.format(url, he.code, he.headers), + ) + except urllib.error.URLError as ue: return (False, ue.reason[1]) except Exception as e: return (False, repr(e)) @@ -65,19 +75,23 @@ def isResolvable(url): return (False, repr(oe)) except: return (False, "Unexpected error:", sys.exc_info()[0]) - + response.close() - if(response.code in set([200, 202, 203, 206, 301, 302, 303])): - return (True, "Successfully resolved the URL {}: status {}".format(url, response.code)) + if response.code in set([200, 202, 203, 206, 301, 302, 303, 307, 308]): + return ( + True, + "Successfully resolved the URL {}: status {}".format(url, response.code), + ) else: return (False, "Did not resolved the URL {}".format(url)) + # Check if an identifier has a valid, known namespace -#def isNamespaceValid(identifier): +# def isNamespaceValid(identifier): # delimiter = ':' # if(identifier.find(delimeter == -1)): # return False, "Missing namespace in identifier" -# +# # namespace, id = identfier.split(':', 1) -# +# # return True, "The namespace is valid" diff --git a/metadig/variable.py b/metadig/variable.py index 3faf654..98d0684 100644 --- a/metadig/variable.py +++ b/metadig/variable.py @@ -7,73 +7,75 @@ import sys import re -import java.util.ArrayList as ArrayList -import java.math.BigDecimal as BigDecimal +from java.util import ArrayList +from java.math import BigDecimal + # CHeck if an object is blank or undefined. def isBlank(object): - pattern = re.compile(r'\s+') - # Depending on the values extracted from the xpath, the following types may be returned - # by the Java Based scripting engine (jython): - # - an int (single value, all numeric) - # - a string - # - a boolean (i.e. "Yes", "Y", "No", "No") - this type isn't expected for award - # - a java.util.ArrayList (multiple values, each typed as int, boolean or string) - if(isinstance(object, int) or isinstance(object, float) or isinstance(object, long)): - return False - elif (isinstance(object, str) or isinstance(object, unicode)): - # If award is a string, check that it is not all whitespace - objStripped = re.sub(pattern, '', object) - if (len(objStripped) == 0): - return True - else: + pattern = re.compile(r"\s+") + # Depending on the values extracted from the xpath, the following types may be returned + # by the Java Based scripting engine (jython): + # - an int (single value, all numeric) + # - a string + # - a boolean (i.e. "Yes", "Y", "No", "No") - this type isn't expected for award + # - a java.util.ArrayList (multiple values, each typed as int, boolean or string) + if isinstance(object, int) or isinstance(object, float) or isinstance(object, int): return False - elif(isinstance(object, ArrayList)): - # Multiple objects exist - # Return as soon as a non-blank object is found - # Also, check if all values are blank - blankFound = False - for i in range(0, len(object)): - thisObj = object.get(i) - if (isinstance(thisObj, int)): - return False - else: - objStripped = re.sub(pattern, '', thisObj) - if (len(objStripped) == 0): - blankFound = True + elif isinstance(object, str) or isinstance(object, str): + # If award is a string, check that it is not all whitespace + objStripped = re.sub(pattern, "", object) + if len(objStripped) == 0: + return True else: - return False - elif(isinstance(object, list)): - # Multiple objects exist - # Return as soon as a non-blank object is found - # Also, check if all values are blank - blankFound = False - for i in range(0, len(object)): - thisObj = object[i] - if (isinstance(thisObj, int)): - return False - else: - objStripped = re.sub(pattern, '', thisObj) - if (len(objStripped) == 0): - blankFound = True - else: - return False - - # If we reached this point and blankFound is true, then all - # values are blank - if blankFound: - return True - else: - raise Exception('Unknown variable type {}'.format(type(object))) - + return False + elif isinstance(object, ArrayList): + # Multiple objects exist + # Return as soon as a non-blank object is found + # Also, check if all values are blank + blankFound = False + for i in range(0, len(object)): + thisObj = object.get(i) + if isinstance(thisObj, int): + return False + else: + objStripped = re.sub(pattern, "", thisObj) + if len(objStripped) == 0: + blankFound = True + else: + return False + elif isinstance(object, list): + # Multiple objects exist + # Return as soon as a non-blank object is found + # Also, check if all values are blank + blankFound = False + for i in range(0, len(object)): + thisObj = object[i] + if isinstance(thisObj, int): + return False + else: + objStripped = re.sub(pattern, "", thisObj) + if len(objStripped) == 0: + blankFound = True + else: + return False + + # If we reached this point and blankFound is true, then all + # values are blank + if blankFound: + return True + else: + raise Exception("Unknown variable type {}".format(type(object))) + + def toUnicode(object, *argv): """Convert jython and Python types to unicode The input object can be either a Jython variable type or a Python variable - type. The object is converted to a Python unicode object. When ArrayLists and + type. The object is converted to a Python unicode object. When ArrayLists and lists are evaluated, each element is inspected and converted to unicode. - Convertering all variables to unicode, ensures that the quality check code has less + Convertering all variables to unicode, ensures that the quality check code has less checking that it has to do, and also to remove any reference to jython objects in the check code (in the future, a pure Python scripting engine may be used). @@ -84,43 +86,41 @@ def toUnicode(object, *argv): Returns: unicode: either a scalar or list is returned, depending on the input """ - - if(len(argv) > 0): + + if len(argv) > 0: encoding = argv[0] else: encoding = "utf-8" - - if(isinstance(object, int)): - return(unicode(str(object), encoding)) - elif(isinstance(object, float)): - return(unicode(str(object), encoding)) - elif(isinstance(object, long)): - return(unicode(str(object), encoding)) - elif(isinstance(object, bool)): - return(unicode(str(object), encoding)) - elif (isinstance(object, str)): - return(unicode(object, encoding)) - elif (isinstance(object, unicode)): - return(object) - elif(isinstance(object, list)): + + if isinstance(object, int): + return str(str(object), encoding) + elif isinstance(object, float): + return str(str(object), encoding) + elif isinstance(object, int): + return str(str(object), encoding) + elif isinstance(object, bool): + return str(str(object), encoding) + elif isinstance(object, str): + return object + elif isinstance(object, list): row = [] # Multiple objects exist # Return as soon as a non-blank object is found # Also, check if all values are blank for i in range(0, len(object)): row.append(toUnicode(object[i], encoding)) - return(row) - elif(isinstance(object, ArrayList)): + return row + elif isinstance(object, ArrayList): row = [] # Multiple objects exist # Return as soon as a non-blank object is found # Also, check if all values are blank for i in range(0, len(object)): row.append(toUnicode(object.get(i), encoding)) - return(row) - elif(isinstance(object, BigDecimal)): - return(unicode(object.toString())); - elif(object is None): + return row + elif isinstance(object, BigDecimal): + return str(object.toString()) + elif object is None: return object else: - raise Exception('Unknown variable type {}'.format(type(object))) + raise Exception("Unknown variable type {}".format(type(object))) diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..1c5e25d --- /dev/null +++ b/poetry.lock @@ -0,0 +1,172 @@ +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" + +[[package]] +name = "exceptiongroup" +version = "1.1.3" +description = "Backport of PEP 654 (exception groups)" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "importlib-metadata" +version = "6.7.0" +description = "Read metadata from Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} +zipp = ">=0.5" + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +perf = ["ipython"] +testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +category = "dev" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "jep" +version = "4.1.1" +description = "Jep embeds CPython in Java" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "packaging" +version = "23.1" +description = "Core utilities for Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "pluggy" +version = "1.2.0" +description = "plugin and hook calling mechanisms for python" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pytest" +version = "7.4.2" +description = "pytest: simple powerful testing with Python" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "typing-extensions" +version = "4.7.1" +description = "Backported and Experimental Type Hints for Python 3.7+" +category = "dev" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "zipp" +version = "3.15.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] + +[metadata] +lock-version = "1.1" +python-versions = "^3.7" +content-hash = "9d7ec3394e672a619877511605d8d84e0bc2205059b5f9bec1bdd2333f44deba" + +[metadata.files] +colorama = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] +exceptiongroup = [ + {file = "exceptiongroup-1.1.3-py3-none-any.whl", hash = "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3"}, + {file = "exceptiongroup-1.1.3.tar.gz", hash = "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9"}, +] +importlib-metadata = [ + {file = "importlib_metadata-6.7.0-py3-none-any.whl", hash = "sha256:cb52082e659e97afc5dac71e79de97d8681de3aa07ff18578330904a9d18e5b5"}, + {file = "importlib_metadata-6.7.0.tar.gz", hash = "sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4"}, +] +iniconfig = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] +jep = [ + {file = "jep-4.1.1.tar.gz", hash = "sha256:5914a4d815a7e86819f55be3de840edc2d3fe0d0b3f67626e5cea73841b1d1c0"}, +] +packaging = [ + {file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"}, + {file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"}, +] +pluggy = [ + {file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"}, + {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, +] +pytest = [ + {file = "pytest-7.4.2-py3-none-any.whl", hash = "sha256:1d881c6124e08ff0a1bb75ba3ec0bfd8b5354a01c194ddd5a0a870a48d99b002"}, + {file = "pytest-7.4.2.tar.gz", hash = "sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069"}, +] +tomli = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] +typing-extensions = [ + {file = "typing_extensions-4.7.1-py3-none-any.whl", hash = "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36"}, + {file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"}, +] +zipp = [ + {file = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"}, + {file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"}, +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7a26655 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,20 @@ +[tool.poetry] +name = "metadig" +version = "1.2.0" +description='Metadig Quality Engine Python Library' +authors = ["Peter Slaughter ","Jeanette Clark "] +readme = "README.md" +packages = [{include = "metadig"}] + +[tool.poetry.dependencies] +python = "^3.7" +jep = "4.1.1" + + +[tool.poetry.group.dev.dependencies] +pytest = "^7.4.2" +black = "^24.1.1" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/setup.py b/setup.py deleted file mode 100644 index d773201..0000000 --- a/setup.py +++ /dev/null @@ -1,33 +0,0 @@ -from setuptools import setup -from setuptools import find_packages - -long_description = ''' -Metadig provides tools that can be used by the MetaDIG Quality Engine -''' -#with open("README.md", "r") as fh: -#long_description = fh.read() - -setup(name='metadig', - version='1.2.0', - author="Peter Slaughter", - author_email="slaughter@nceas.ucsb.edu", - description='Metadig Quality Engine Python Library', - long_description=long_description, - url='https://github.com/NCEAS/metadig-py', - download_url='https://github.com/NCEAS/metadig/tarball/1.1.0', - license='Apache-2', - packages=find_packages(), - install_requires=[ - #'scipy>=0.14', - ], - classifiers=[ - 'Development Status :: 1 - Development/Unstable', - 'License :: OSI Approved :: Apache 2 ', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Topic :: Software Development :: Libraries', - 'Topic :: Software Development :: Libraries :: Python Modules' - ] -) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29