Skip to content

Commit

Permalink
Set up versioneer (mdtraj#1909)
Browse files Browse the repository at this point in the history
* Set up versioneer

* remove pdb version import

* remove all from mdtraj import veresion errors

* try import version later

* xyz mdtraj.version

* typo

* use mdtraj._version instead

* use mdtraj.__version__

* Skip un-used version check in docs

* Help sphinx along

---------

Co-authored-by: Jeremy M. G. Leung <[email protected]>
  • Loading branch information
mattwthompson and jeremyleung521 authored Jul 19, 2024
1 parent aaa85c6 commit 6d77f4e
Show file tree
Hide file tree
Showing 13 changed files with 772 additions and 69 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mdtraj/_version.py export-subst
35 changes: 0 additions & 35 deletions basesetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,41 +272,6 @@ def _minimal_ext_cmd(cmd):
return GIT_REVISION


def write_version_py(version, isreleased, filename):
cnt = """
# This file is generated in setup.py at build time.
version = '{version}'
short_version = '{short_version}'
full_version = '{full_version}'
git_revision = '{git_revision}'
release = {release}
"""
# git_revision
if os.path.exists(".git"):
git_revision = git_version()
else:
git_revision = "Unknown"

# short_version, full_version
if isreleased:
full_version = version
short_version = version
else:
full_version = f"{version}+{git_revision}"
short_version = version

with open(filename, "w") as f:
f.write(
cnt.format(
version=version,
short_version=short_version,
full_version=full_version,
git_revision=git_revision,
release=isreleased,
),
)


def copy_same_file_pass(source, destination):
try:
# Try to copy
Expand Down
19 changes: 10 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import msmb_theme
import sphinx_rtd_theme

import mdtraj.version
from mdtraj import __version__

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand All @@ -37,12 +37,12 @@
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.mathjax",
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"numpydoc",
"notebook_sphinxext",
"nbsphinx",
"nbsphinx_link"
"nbsphinx_link",
]

autosummary_generate = True
Expand Down Expand Up @@ -70,10 +70,11 @@
# built documents.
#

# versions which Sphinx uses for default html_title
# The short X.Y version.
version = mdtraj.version.short_version
version = __version__
# The full version, including alpha/beta/rc tags.
release = mdtraj.version.version
release = version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -115,12 +116,12 @@

# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False

# -- Options for NBsphinx --------------------------------------------------

# nbsphinx specific options
nbsphinx_allow_errors = True # Continue through Jupyter errors
nbsphinx_execute = 'never' # Never execute cells
nbsphinx_execute = "never" # Never execute cells


# -- Options for HTML output ----------------------------------------------
Expand Down Expand Up @@ -334,4 +335,4 @@
__ https://github.com/mdtraj/mdtraj/tree/master/
"""
+ r"{{ docpath }}"
)
)
4 changes: 4 additions & 0 deletions mdtraj/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@
from ._lprmsd import lprmsd
from ._rmsd import rmsd, rmsf

from . import _version

__version__ = _version.get_versions()["version"]

__all__ = (
"reporters",
"lprmsd",
Expand Down
Loading

0 comments on commit 6d77f4e

Please sign in to comment.