diff --git a/.binder/postBuild b/.binder/postBuild index aa97083..2886827 100644 --- a/.binder/postBuild +++ b/.binder/postBuild @@ -1,20 +1,20 @@ # pip install master pip install --no-deps . -# Note: This produces build and pyiron_module_template.egg-info directories +# Note: This produces build and pyiron_ontology.egg-info directories # clean up if [ -d "notebooks" ]; then mv notebooks/* . fi -if [ -d "${HOME}/pyiron_module_template" ]; then +if [ -d "${HOME}/pyiron_ontology" ]; then rm -r ${HOME}/.binder \ ${HOME}/.ci_support \ ${HOME}/.github \ ${HOME}/build \ ${HOME}/docs \ ${HOME}/notebooks \ - ${HOME}/pyiron_module_template \ - ${HOME}/pyiron_module_template.egg-info \ + ${HOME}/pyiron_ontology \ + ${HOME}/pyiron_ontology.egg-info \ ${HOME}/tests \ ${HOME}/.gitattributes \ ${HOME}/.gitignore \ diff --git a/.coveragerc b/.coveragerc index 0176c43..1a4116d 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,5 +1,5 @@ # .coveragerc to control coverage.py [run] -source = pyiron_module_template -omit = pyiron_module_template/_version.py +source = pyiron_ontology +omit = pyiron_ontology/_version.py concurrency = multiprocessing \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 84b63df..15cfb82 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -pyiron_module_template/_version.py export-subst +pyiron_ontology/_version.py export-subst diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 3a29cab..bc0de8d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Create a bug report to help us eliminate issues and improve pyiron_module_template +about: Create a bug report to help us eliminate issues and improve pyiron_ontology title: '' labels: bug assignees: '' diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index f96aa7b..c1e6ea2 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,6 +1,6 @@ --- name: Feature request -about: Make a suggestion for a new feature or a change to pyiron_module_template +about: Make a suggestion for a new feature or a change to pyiron_ontology title: '' labels: enhancement assignees: '' @@ -13,7 +13,7 @@ assignees: '' **Detailed Description** - + **Further Information, Files, and Links** diff --git a/MANIFEST.in b/MANIFEST.in index 71f7e8d..fd3cf5d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include versioneer.py -include pyiron_module_template/_version.py +include pyiron_ontology/_version.py include LICENSE diff --git a/docs/conf.py b/docs/conf.py index fbf341e..c8169fb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -275,10 +275,10 @@ # dir menu entry, description, category) texinfo_documents = [ ('index', - 'pyiron_module_template', + 'pyiron_ontology', u'pyiron Documentation', u'Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department', - 'pyiron_module_template', + 'pyiron_ontology', 'One line description of project.', 'Miscellaneous'), ] @@ -295,7 +295,7 @@ # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False -main(['-e', '-o', 'apidoc', '../pyiron_module_template', '--force']) +main(['-e', '-o', 'apidoc', '../pyiron_ontology', '--force']) curdir = os.path.dirname(os.path.abspath(__file__)) if os.path.exists(os.path.join(curdir, 'source/notebooks')): diff --git a/docs/index.rst b/docs/index.rst index 1170c40..b7876e6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,11 +1,11 @@ -.. pyiron_module_template documentation master file +.. pyiron_ontology documentation master file .. _index: -====================== -pyiron_module_template -====================== +=============== +pyiron_ontology +=============== .. toctree:: :hidden: diff --git a/notebooks/version.ipynb b/notebooks/version.ipynb index f5956d8..179bc5a 100644 --- a/notebooks/version.ipynb +++ b/notebooks/version.ipynb @@ -7,8 +7,8 @@ "metadata": {}, "outputs": [], "source": [ - "import pyiron_module_template\n", - "print(pyiron_module_template.__version__)" + "import pyiron_ontology\n", + "print(pyiron_ontology.__version__)" ] } ], diff --git a/pyiron_module_template/__init__.py b/pyiron_ontology/__init__.py similarity index 50% rename from pyiron_module_template/__init__.py rename to pyiron_ontology/__init__.py index 80edaf0..97e444c 100644 --- a/pyiron_module_template/__init__.py +++ b/pyiron_ontology/__init__.py @@ -2,3 +2,7 @@ __version__ = get_versions()["version"] del get_versions + +from ._version import get_versions +__version__ = get_versions()['version'] +del get_versions diff --git a/pyiron_module_template/_version.py b/pyiron_ontology/_version.py similarity index 83% rename from pyiron_module_template/_version.py rename to pyiron_ontology/_version.py index 85bcfdd..cd5c629 100644 --- a/pyiron_module_template/_version.py +++ b/pyiron_ontology/_version.py @@ -1,3 +1,4 @@ + # This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build @@ -40,9 +41,9 @@ def get_config(): cfg = VersioneerConfig() cfg.VCS = "git" cfg.style = "pep440-pre" - cfg.tag_prefix = "pyiron_module_template-" - cfg.parentdir_prefix = "pyiron_module_template" - cfg.versionfile_source = "pyiron_module_template/_version.py" + cfg.tag_prefix = "pyiron_ontology-" + cfg.parentdir_prefix = "pyiron_ontology" + cfg.versionfile_source = "pyiron_ontology/_version.py" cfg.verbose = False return cfg @@ -57,18 +58,17 @@ class NotThisMethod(Exception): def register_vcs_handler(vcs, method): # decorator """Decorator to mark a method as the handler for a particular VCS.""" - def decorate(f): """Store f in HANDLERS[vcs][method].""" if vcs not in HANDLERS: HANDLERS[vcs] = {} HANDLERS[vcs][method] = f return f - return decorate -def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None): +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, + env=None): """Call the given command(s).""" assert isinstance(commands, list) p = None @@ -76,13 +76,10 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env= try: dispcmd = str([c] + args) # remember shell=False, so use git.cmd on windows, not just git - p = subprocess.Popen( - [c] + args, - cwd=cwd, - env=env, - stdout=subprocess.PIPE, - stderr=(subprocess.PIPE if hide_stderr else None), - ) + p = subprocess.Popen([c] + args, cwd=cwd, env=env, + stdout=subprocess.PIPE, + stderr=(subprocess.PIPE if hide_stderr + else None)) break except EnvironmentError: e = sys.exc_info()[1] @@ -119,22 +116,16 @@ def versions_from_parentdir(parentdir_prefix, root, verbose): for i in range(3): dirname = os.path.basename(root) if dirname.startswith(parentdir_prefix): - return { - "version": dirname[len(parentdir_prefix) :], - "full-revisionid": None, - "dirty": False, - "error": None, - "date": None, - } + return {"version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, "error": None, "date": None} else: rootdirs.append(root) root = os.path.dirname(root) # up a level if verbose: - print( - "Tried directories %s but none started with prefix %s" - % (str(rootdirs), parentdir_prefix) - ) + print("Tried directories %s but none started with prefix %s" % + (str(rootdirs), parentdir_prefix)) raise NotThisMethod("rootdir doesn't start with parentdir_prefix") @@ -190,7 +181,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of # just "foo-1.0". If we see a "tag: " prefix, prefer those. TAG = "tag: " - tags = set([r[len(TAG) :] for r in refs if r.startswith(TAG)]) + tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) if not tags: # Either we're using git < 1.8.3, or there really are no tags. We use # a heuristic: assume all version tags have a digit. The old git %d @@ -199,7 +190,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): # between branches and tags. By ignoring refnames without digits, we # filter out many common branch names like "release" and # "stabilization", as well as "HEAD" and "master". - tags = set([r for r in refs if re.search(r"\d", r)]) + tags = set([r for r in refs if re.search(r'\d', r)]) if verbose: print("discarding '%s', no digits" % ",".join(refs - tags)) if verbose: @@ -207,26 +198,19 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): for ref in sorted(tags): # sorting will prefer e.g. "2.0" over "2.0rc1" if ref.startswith(tag_prefix): - r = ref[len(tag_prefix) :] + r = ref[len(tag_prefix):] if verbose: print("picking %s" % r) - return { - "version": r, - "full-revisionid": keywords["full"].strip(), - "dirty": False, - "error": None, - "date": date, - } + return {"version": r, + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": None, + "date": date} # no suitable tags, so version is "0+unknown", but full hex is still there if verbose: print("no suitable tags, using unknown + full revision id") - return { - "version": "0+unknown", - "full-revisionid": keywords["full"].strip(), - "dirty": False, - "error": "no suitable tags", - "date": None, - } + return {"version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": "no suitable tags", "date": None} @register_vcs_handler("git", "pieces_from_vcs") @@ -241,7 +225,8 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): if sys.platform == "win32": GITS = ["git.cmd", "git.exe"] - out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=True) + out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, + hide_stderr=True) if rc != 0: if verbose: print("Directory %s not under git control" % root) @@ -249,19 +234,10 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there isn't one, this yields HEX[-dirty] (no NUM) - describe_out, rc = run_command( - GITS, - [ - "describe", - "--tags", - "--dirty", - "--always", - "--long", - "--match", - "%s*" % tag_prefix, - ], - cwd=root, - ) + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + "--always", "--long", + "--match", "%s*" % tag_prefix], + cwd=root) # --long was added in git-1.5.5 if describe_out is None: raise NotThisMethod("'git describe' failed") @@ -284,16 +260,17 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): dirty = git_describe.endswith("-dirty") pieces["dirty"] = dirty if dirty: - git_describe = git_describe[: git_describe.rindex("-dirty")] + git_describe = git_describe[:git_describe.rindex("-dirty")] # now we have TAG-NUM-gHEX or HEX if "-" in git_describe: # TAG-NUM-gHEX - mo = re.search(r"^(.+)-(\d+)-g([0-9a-f]+)$", git_describe) + mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) if not mo: # unparseable. Maybe git-describe is misbehaving? - pieces["error"] = "unable to parse git-describe output: '%s'" % describe_out + pieces["error"] = ("unable to parse git-describe output: '%s'" + % describe_out) return pieces # tag @@ -302,12 +279,10 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): if verbose: fmt = "tag '%s' doesn't start with prefix '%s'" print(fmt % (full_tag, tag_prefix)) - pieces["error"] = "tag '%s' doesn't start with prefix '%s'" % ( - full_tag, - tag_prefix, - ) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" + % (full_tag, tag_prefix)) return pieces - pieces["closest-tag"] = full_tag[len(tag_prefix) :] + pieces["closest-tag"] = full_tag[len(tag_prefix):] # distance: number of commits since tag pieces["distance"] = int(mo.group(2)) @@ -318,13 +293,13 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): else: # HEX: no tags pieces["closest-tag"] = None - count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], cwd=root) + count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], + cwd=root) pieces["distance"] = int(count_out) # total number of commits # commit date: see ISO-8601 comment in git_versions_from_keywords() - date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[ - 0 - ].strip() + date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], + cwd=root)[0].strip() pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) return pieces @@ -355,7 +330,8 @@ def render_pep440(pieces): rendered += ".dirty" else: # exception #1 - rendered = "0+untagged.%d.g%s" % (pieces["distance"], pieces["short"]) + rendered = "0+untagged.%d.g%s" % (pieces["distance"], + pieces["short"]) if pieces["dirty"]: rendered += ".dirty" return rendered @@ -469,13 +445,11 @@ def render_git_describe_long(pieces): def render(pieces, style): """Render the given version pieces into the requested style.""" if pieces["error"]: - return { - "version": "unknown", - "full-revisionid": pieces.get("long"), - "dirty": None, - "error": pieces["error"], - "date": None, - } + return {"version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None} if not style or style == "default": style = "pep440" # the default @@ -495,13 +469,9 @@ def render(pieces, style): else: raise ValueError("unknown style '%s'" % style) - return { - "version": rendered, - "full-revisionid": pieces["long"], - "dirty": pieces["dirty"], - "error": None, - "date": pieces.get("date"), - } + return {"version": rendered, "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], "error": None, + "date": pieces.get("date")} def get_versions(): @@ -515,7 +485,8 @@ def get_versions(): verbose = cfg.verbose try: - return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, verbose) + return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, + verbose) except NotThisMethod: pass @@ -524,16 +495,13 @@ def get_versions(): # versionfile_source is the relative path from the top of the source # tree (where the .git directory might live) to this file. Invert # this to find the root from __file__. - for i in cfg.versionfile_source.split("/"): + for i in cfg.versionfile_source.split('/'): root = os.path.dirname(root) except NameError: - return { - "version": "0+unknown", - "full-revisionid": None, - "dirty": None, - "error": "unable to find root of source tree", - "date": None, - } + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to find root of source tree", + "date": None} try: pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) @@ -547,10 +515,6 @@ def get_versions(): except NotThisMethod: pass - return { - "version": "0+unknown", - "full-revisionid": None, - "dirty": None, - "error": "unable to compute version", - "date": None, - } + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", "date": None} diff --git a/setup.cfg b/setup.cfg index f64d2cc..eebb0ad 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,8 +6,8 @@ [versioneer] VCS = git style = pep440-pre -versionfile_source = pyiron_module_template/_version.py +versionfile_source = pyiron_ontology/_version.py #versionfile_build = -tag_prefix = pyiron_module_template- -parentdir_prefix = pyiron_module_template +tag_prefix = pyiron_ontology- +parentdir_prefix = pyiron_ontology diff --git a/setup.py b/setup.py index 5d02728..644f785 100644 --- a/setup.py +++ b/setup.py @@ -5,12 +5,12 @@ import versioneer setup( - name='pyiron_module_template', + name='pyiron_ontology', version=versioneer.get_version(), - description='pyiron_module_template - module extension to pyiron.', + description='pyiron_ontology - module extension to pyiron.', long_description='http://pyiron.org', - url='https://github.com/pyiron/pyiron_module_template', + url='https://github.com/pyiron/pyiron_ontology', author='Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department', author_email='@mpie.de', license='BSD', diff --git a/tests/unit/test_tests.py b/tests/unit/test_tests.py index 2d9f5a8..a9c5658 100644 --- a/tests/unit/test_tests.py +++ b/tests/unit/test_tests.py @@ -1,9 +1,9 @@ import unittest -import pyiron_module_template +import pyiron_ontology class TestVersion(unittest.TestCase): def test_version(self): - version = pyiron_module_template.__version__ + version = pyiron_ontology.__version__ print(version) self.assertTrue(version.startswith('0')) diff --git a/update_module_name.sh b/update_module_name.sh deleted file mode 100644 index 5c3c9e1..0000000 --- a/update_module_name.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -module_name="pyiron_IntendedModuleName" -rst_delimit="=========================" # This should be as many '=' as the name length. - -for file in .binder/postBuild \ - .github/ISSUE_TEMPLATE/*.md \ - docs/conf.py \ - docs/index.rst \ - notebooks/version.ipynb \ - tests/unit/test_tests.py \ - .coveragerc \ - .gitattributes \ - MANIFEST.in \ - setup.cfg \ - setup.py -do - sed -i "s/pyiron_module_template/${module_name}/g" ${file} -done - -file=docs/index.rst -sed -i "s/pyiron_module_template/${module_name}/g" ${file} -sed -i "s/======================/${rst_delimit}/g" ${file} - -mv pyiron_module_template ${module_name} - -python -m versioneer setup - -rm update_module_name.sh