-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated the development status from Beta to Production/Stable.
- Loading branch information
Showing
12 changed files
with
128 additions
and
76 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
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
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
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ coverage: | |
status: | ||
project: | ||
default: | ||
target: 0 | ||
target: 80 | ||
patch: | ||
default: | ||
target: 0 |
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,3 +1,3 @@ | ||
"""The **Nano-Utils** version.""" | ||
|
||
__version__ = '0.4.3' | ||
__version__ = '1.0.0' |
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
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
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
r"""Print :code:`"\nnumpy >= 1.20: TRUE"` if the :mod:`numpy` version is 1.20 or higher; print :code:`"\nnumpy >= 1.20: FALSE"` otherwise. | ||
:code:`"\nnumpy >= 1.20: ERROR"` will be printed if an exception is encountered. | ||
Examples | ||
-------- | ||
.. code:: bash | ||
>>> pip show numpy # doctest: +SKIP | ||
Name: numpy | ||
Version: 1.17.3 | ||
Summary: NumPy is the fundamental package for array computing with Python. | ||
Home-page: https://www.numpy.org | ||
... | ||
>>> python ./numpy_ge_1_20.py # doctest: +SKIP | ||
FALSE | ||
""" # noqa: E501 | ||
|
||
import warnings | ||
from typing import Optional | ||
|
||
from nanoutils import VersionInfo | ||
|
||
try: | ||
import numpy as np | ||
NUMPY_EX: Optional[ImportError] = None | ||
except ImportError as ex: | ||
NUMPY_EX = ex | ||
|
||
|
||
def main() -> None: | ||
"""Execute the script.""" | ||
__version__: Optional[str] = getattr(np, '__version__', None) | ||
|
||
try: | ||
major, minor, micro, *_ = __version__.split('.') # type: ignore | ||
version = VersionInfo(major=int(major), minor=int(minor), micro=int(micro)) | ||
except Exception as ex: | ||
warning = RuntimeWarning(f"Failed to parse the NumPy version: {__version__!r}") | ||
warning.__cause__ = ex | ||
warnings.warn(warning) | ||
return | ||
|
||
if version.major > 1 or (version.major == 1 and version.minor >= 20): | ||
print("TRUE") | ||
else: | ||
print("FALSE") | ||
|
||
|
||
if __name__ == '__main__': | ||
if NUMPY_EX is not None: | ||
_warning = ImportWarning(str(NUMPY_EX)) | ||
_warning.__cause__ = NUMPY_EX | ||
warnings.warn(_warning) | ||
del _warning | ||
else: | ||
main() |
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
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
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,20 +1,18 @@ | ||
"""Test the :mod:`sphinx` documentation generation.""" | ||
|
||
import shutil | ||
from os.path import join, isdir | ||
from os.path import join | ||
from sphinx.application import Sphinx | ||
|
||
from nanoutils import delete_finally | ||
|
||
SRCDIR = CONFDIR = 'docs' | ||
OUTDIR = join('tests', 'test_files', 'build') | ||
DOCTREEDIR = join('tests', 'test_files', 'build', 'doctrees') | ||
|
||
|
||
@delete_finally(OUTDIR) | ||
def test_sphinx_build() -> None: | ||
"""Test :meth:`sphinx.application.Sphinx.build`.""" | ||
app = Sphinx(SRCDIR, CONFDIR, OUTDIR, DOCTREEDIR, | ||
buildername='html', warningiserror=True) | ||
try: | ||
app.build(force_all=True) | ||
finally: | ||
if isdir(OUTDIR): | ||
shutil.rmtree(OUTDIR) | ||
app.build(force_all=True) |
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