Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pyc
.vscode
.tox
dist
!.github
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ keywords:
- load
- loading
license: Apache-2.0
version: v1.1.4
version: 1.1.5
date-released: '2025-04-01'
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# [saveable-objects](README.md) Change Log

## Release v1.1.5

- 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 v1.1.4

- Hid superfluous table of contents in the index page of the User Guide in the documentation;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ Source code can be found at: [https://github.com/Christopher-K-Long/saveable-obj

## Version and Changes

The current version is [`1.1.4`](ChangeLog.md#release-114). Please see the [Change Log](ChangeLog.md) for more
The current version is [`1.1.5`](ChangeLog.md#release-115). Please see the [Change Log](ChangeLog.md) for more
details.
4 changes: 4 additions & 0 deletions docs/License.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
License
=======
.. include:: ../LICENSE
:parser: myst_parser.sphinx_
5 changes: 4 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ saveable-objects

user_guide/index
reference/index
ChangeLog.md.rst
ChangeLog.md.rst
License
GitHub <https://github.com/Christopher-K-Long/saveable-objects>
PyPI <https://pypi.org/project/saveable-objects/>
1 change: 1 addition & 0 deletions docs/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ User Guide
getting_started
creating_a_saveableobject
saving_and_loading
running_tests

.. include:: overview.md
:parser: myst_parser.sphinx_
Expand Down
5 changes: 5 additions & 0 deletions docs/user_guide/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
- [Creating a SaveableObject](creating_a_saveableobject.md)
- [Saving and loading](saving_and_loading.md)

## Running Tests

- [Running Tests](running_tests.md)


---

[Next](getting_started.md)
32 changes: 32 additions & 0 deletions docs/user_guide/running_tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Running Tests

Current status of units tests:

[![Unit Tests](https://github.com/Christopher-K-Long/saveable-objects/actions/workflows/test-python-package.yml/badge.svg)](https://github.com/Christopher-K-Long/saveable-objects/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 saveable-objects 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 saveable-objects 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 saveable-objects to install all the requirements. Next the tests can be executed with the command
```bash
pytest
```
from the root directory of saveable-objects.

---

[Previous](saving_and_loading.md)
2 changes: 1 addition & 1 deletion docs/user_guide/saving_and_loading.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,4 @@ we will this time load the state and find `b.z=10`.

This is the end of the tutorial. Now you know everything to use saveable-objects!

[Previous](creating_a_saveableobject.md)
[Previous](creating_a_saveableobject.md) | [Next](running_tests.md)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "saveable-objects"
version = "1.1.4"
version = "1.1.5"
authors = [
{ name="Christopher_K._Long", email="ckl45@cam.ac.uk" },
]
Expand Down
4 changes: 4 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
toml
pyyaml
numpy
cloudpickle
26 changes: 26 additions & 0 deletions tests/test_version_consistency.py
Original file line number Diff line number Diff line change
@@ -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"
9 changes: 9 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tox]
requires =
tox>=4
envlist = 3X

[testenv]
description = run unit tests
deps = -rtests/requirements.txt
commands = pytest tests