diff --git a/.github/workflows/test-python-package.yml b/.github/workflows/test-python-package.yml index 31b4ef9..0092f33 100644 --- a/.github/workflows/test-python-package.yml +++ b/.github/workflows/test-python-package.yml @@ -69,7 +69,7 @@ jobs: run: | python -m pip install --upgrade pip pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi for w in ./dist/*.whl; do python -m pip install $w; done - name: Lint with flake8 run: | diff --git a/.gitignore b/.gitignore index f6e48a2..99add88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.pyc .vscode +.tox dist !.github \ No newline at end of file diff --git a/CITATION.cff b/CITATION.cff index 0a46129..d6054ad 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -27,5 +27,5 @@ keywords: - chunking - chunks license: Apache-2.0 -version: v1.0.3 +version: 1.0.4 date-released: '2025-04-01' \ No newline at end of file diff --git a/ChangeLog.md b/ChangeLog.md index 4d8cef0..abf233f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,12 @@ # [thread-chunks](README.md) Change Log +## Release 1.0.4 + +- Added the license to the documentation +- Added link to the GitHub repository to the navigation pane in the documentation +- Added a version consistency test +- Added [tox](https://tox.wiki/) support for user testing. + ## Release 1.0.3 - Hid superfluous table of contents in the index page of the User Guide in the documentation; diff --git a/README.md b/README.md index 4fd5c6b..4857c81 100644 --- a/README.md +++ b/README.md @@ -33,5 +33,5 @@ Source code can be found at: [https://github.com/Christopher-K-Long/thread-chunk ## Version and Changes -The current version is [`1.0.3`](ChangeLog.md#release-103). Please see the [Change Log](ChangeLog.md) for more +The current version is [`1.0.4`](ChangeLog.md#release-104). Please see the [Change Log](ChangeLog.md) for more details. \ No newline at end of file diff --git a/docs/License.rst b/docs/License.rst new file mode 100644 index 0000000..c12accf --- /dev/null +++ b/docs/License.rst @@ -0,0 +1,4 @@ +License +======= +.. include:: ../LICENSE + :parser: myst_parser.sphinx_ \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 7cefc58..19dcc79 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -7,8 +7,8 @@ thread-chunks ============= .. include:: ../README.md - :parser: myst_parser.sphinx_ - :start-after: # thread-chunks + :parser: myst_parser.sphinx_ + :start-after: # thread-chunks .. toctree:: @@ -18,4 +18,6 @@ thread-chunks user_guide/index reference/index ChangeLog.md.rst - + License + GitHub + PyPI \ No newline at end of file diff --git a/docs/user_guide/actors.md b/docs/user_guide/actors.md index 47f2dcf..c7edf42 100644 --- a/docs/user_guide/actors.md +++ b/docs/user_guide/actors.md @@ -74,4 +74,4 @@ output = chunk(g, parameters, actors, chunk_size=chunk_size) Now you know everything you need to go and use ``thread-chunks``! --- -[Previous](checkpointing.md) \ No newline at end of file +[Previous](checkpointing.md) | [Next](running_tests.md) \ No newline at end of file diff --git a/docs/user_guide/index.rst b/docs/user_guide/index.rst index 470f1ac..b81f704 100644 --- a/docs/user_guide/index.rst +++ b/docs/user_guide/index.rst @@ -9,6 +9,7 @@ User Guide chunking checkpointing actors + running_tests .. include:: overview.md :parser: myst_parser.sphinx_ diff --git a/docs/user_guide/overview.md b/docs/user_guide/overview.md index c68fbe8..a512783 100644 --- a/docs/user_guide/overview.md +++ b/docs/user_guide/overview.md @@ -10,5 +10,9 @@ - [Checkpointing](checkpointing.md) - [Actors](actors.md) +## Running Tests + + - [Running Tests](running_tests.md) + --- [Next](getting_started.md) \ No newline at end of file diff --git a/docs/user_guide/running_tests.md b/docs/user_guide/running_tests.md new file mode 100644 index 0000000..27092c7 --- /dev/null +++ b/docs/user_guide/running_tests.md @@ -0,0 +1,32 @@ +# Running Tests + +Current status of units tests: + +[![Unit Tests](https://github.com/Christopher-K-Long/thread-chunks/actions/workflows/test-python-package.yml/badge.svg)](https://github.com/Christopher-K-Long/thread-chunks/actions/workflows/test-python-package.yml) + +You can run the unit tests yourself using [pytest](https://docs.pytest.org) or [tox](https://tox.wiki/). + +## Using [tox](https://tox.wiki/) + +Once [tox](https://tox.wiki/) is installed you can execute the command +```bash +tox +``` +in from a terminal in the root directory of thread-chunks to execute the tests for your installed python interpreter. + +## Using [pytest](https://docs.pytest.org) + +To execute the tests with [pytest](https://docs.pytest.org) you will need to set up a python environment with thread-chunks and the packages in `texts/requirements.txt`. For example, you can run +```bash +pip install ./ +pip install tests/requirements.txt +``` +from the root directory of thread-chunks to install all the requirements. Next the tests can be executed with the command +```bash +pytest +``` +from the root directory of thread-chunks. + +--- + +[Previous](actors.md) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 79b8e8d..88ec8e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "thread-chunks" -version = "1.0.3" +version = "1.0.4" authors = [ { name="Christopher_K._Long", email="ckl45@cam.ac.uk" }, ] diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 0000000..f38aee4 --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,8 @@ +ray +toml +tqdm +numpy +pyyaml +pytest +cloudpickle +saveable-objects \ No newline at end of file diff --git a/tests/test_version_consistency.py b/tests/test_version_consistency.py new file mode 100644 index 0000000..b73f97b --- /dev/null +++ b/tests/test_version_consistency.py @@ -0,0 +1,26 @@ +import os +import toml +import yaml + +PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) +README_FILE = os.path.join(PROJECT_DIR, "README.md") +TOML_FILE = os.path.join(PROJECT_DIR, "pyproject.toml") +CITATION_FILE = os.path.join(PROJECT_DIR, "CITATION.cff") +CHANGELOG_FILE = os.path.join(PROJECT_DIR, "ChangeLog.md") + +def test_version_consistency(): + toml_version = toml.load(TOML_FILE)["project"]["version"] + with open(CITATION_FILE, "r") as f: + citation_content = yaml.safe_load(f) + citation_version = citation_content["version"] + assert citation_version == toml_version + with open(README_FILE, "r") as f: + for line in f.readline(): + if "`](ChangeLog.md#release-" in line: + assert f"[`{toml_version}`](ChangeLog.md#release-{toml_version.replace('.', '')})" in line + with open(CHANGELOG_FILE, "r") as f: + for line in f.readlines(): + if line.startswith("## "): + assert toml_version in line + break + else: assert False, "Version not found in CHANGELOG.md" \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..d6e2726 --- /dev/null +++ b/tox.ini @@ -0,0 +1,9 @@ +[tox] +requires = + tox>=4 +envlist = 3X + +[testenv] +description = run unit tests +deps = -rtests/requirements.txt +commands = pytest tests \ No newline at end of file