Skip to content

Commit

Permalink
Merge pull request #56 from man-group/release-0.3.0
Browse files Browse the repository at this point in the history
0.3.0 with some quality of life improvements
  • Loading branch information
jonbannister authored Oct 5, 2021
2 parents 6caf2bb + 32c8864 commit ce0d324
Show file tree
Hide file tree
Showing 15 changed files with 91 additions and 24 deletions.
31 changes: 23 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,20 @@ defaults: &defaults
- run:
name: Version checks
command: |
grep -q $VERSION notebooker/_version.py || (echo "ERROR: Version number not found in notebooker/_version.py: $VERSION"; exit 1)
grep -q $VERSION notebooker/version.py || (echo "ERROR: Version number not found in notebooker/_version.py: $VERSION"; exit 1)
grep -q $VERSION CHANGELOG.md || (echo "ERROR: Version number not found in CHANGES.md: $VERSION"; exit 1)
grep -q $VERSION docs/conf.py || (echo "ERROR: Version number not found in docs/source/conf.py: $VERSION"; exit 1)
grep -q $VERSION notebooker/web/static/package.json || (echo "ERROR: Version number not found in package.json: $VERSION"; exit 1)
- run:
name: Output useful stuff
command: |
echo $VERSION > "$CIRCLE_ARTIFACTS/version.txt"
# Find the lines of the changelog between releases, escape double quotes, delete empty lines
sed -n '{ /------/= }' CHANGELOG.md \
| head -n 2 \
| xargs -n 2 bash -c 'sed -n "s/\"/\\\\\"/g;`expr $0 + 1`,`expr $1 - 2`p" CHANGELOG.md' \
| sed '/^$/d' \
> "$CIRCLE_ARTIFACTS/changes.md"
- run:
name: Install MongoDB
command: |
Expand Down Expand Up @@ -136,10 +146,6 @@ defaults: &defaults
python setup.py sdist
mkdir -p "$CIRCLE_ARTIFACTS/dist"
cp -r ./dist/* "$CIRCLE_ARTIFACTS/dist"
- run:
name: Upload to PyPI
command: |
echo $VERSION > "$CIRCLE_ARTIFACTS/version.txt"
- run:
name: Upload to PyPI
command: |
Expand All @@ -162,6 +168,7 @@ defaults: &defaults
root: /tmp/circleci-artifacts
paths:
- ./*/version.txt
- ./*/changes.md
- ./*/dist/*
version: 2
jobs:
Expand All @@ -170,7 +177,7 @@ jobs:
PYTHON_VERSION: "3_6"
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts/3_6
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results/3_6
VERSION: 0.2.1
VERSION: 0.3.0
PANDOC_RELEASES_URL: https://github.com/jgm/pandoc/releases
YARN_STATIC_DIR: notebooker/web/static/
IMAGE_NAME: mangroup/notebooker
Expand All @@ -182,7 +189,7 @@ jobs:
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts/3_7
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results/3_7
VERSION: 0.2.1
VERSION: 0.3.0
PANDOC_RELEASES_URL: https://github.com/jgm/pandoc/releases
YARN_STATIC_DIR: notebooker/web/static/
IMAGE_NAME: mangroup/notebooker
Expand All @@ -200,7 +207,15 @@ jobs:
name: "Publish release on GitHub"
command: |
VERSION=$(cat /tmp/circleci-artifacts/3_6/version.txt)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -soft ${VERSION} /tmp/circleci-artifacts/3_6/dist
CHANGES=$(cat /tmp/circleci-artifacts/3_6/changes.md)
ghr -t ${GITHUB_TOKEN} \
-u ${CIRCLE_PROJECT_USERNAME} \
-r ${CIRCLE_PROJECT_REPONAME} \
-c ${CIRCLE_SHA1} \
-n ${VERSION} \
-b "${CHANGES}" \
-soft \
${VERSION} /tmp/circleci-artifacts/3_6/dist
workflows:
version: 2
build_all:
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
0.3.0 (2021-10-05)
------------------

* Major feature: scheduling natively within Notebooker
* See [the docs](https://notebooker.readthedocs.io/en/latest/webapp/webapp.html#scheduling-a-report) for more info.
* Bugfix: Newer versions of uuid now work properly with Notebooker
* Improvement: See the version number in the Notebooker GUI and with a /core/version GET call.


0.2.1 (2021-02-11)
------------------

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Do also make sure to run the webapp and make sure you haven't broken anything.

# Releasing a new version
When releasing a new version, please increment the version number in:
* `notebooker/_version.py`
* `notebooker/version.py`
* `.circleci/config.yml`
* `docs/config.yml`
* `notebooker/web/static/package.json`
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
author = "Man Group Quant Tech"

# The full version, including alpha/beta/rc tags
release = "0.2.1"
release = "0.3.0"


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion notebooker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from ._version import __version__
from .version import __version__

__import__("pkg_resources").declare_namespace(__name__)
2 changes: 1 addition & 1 deletion notebooker/_entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import click

from notebooker import notebook_templates_example
from notebooker._version import __version__
from notebooker.version import __version__
from notebooker.constants import DEFAULT_SERIALIZER
from notebooker.execute_notebook import execute_notebook_entrypoint
from notebooker.serialization import SERIALIZER_TO_CLI_OPTIONS
Expand Down
1 change: 0 additions & 1 deletion notebooker/_version.py

This file was deleted.

1 change: 1 addition & 0 deletions notebooker/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.3.0"
11 changes: 11 additions & 0 deletions notebooker/web/routes/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from flask import Blueprint, jsonify, request

import notebooker.version
from notebooker.utils.results import get_all_available_results_json
from notebooker.web.utils import get_serializer, get_all_possible_templates, all_templates_flattened

Expand Down Expand Up @@ -53,3 +54,13 @@ def all_possible_templates_flattened():
:returns: A JSON which is a list of all possible templates with their full names.
"""
return jsonify({"result": all_templates_flattened()})


@core_bp.route("/core/version")
def get_version_no():
"""
Core function which returns the Notebooker version number.
:returns: A JSON mapping from "version" to the string repr of the version number.
"""
return jsonify({"version": notebooker.version.__version__})
10 changes: 10 additions & 0 deletions notebooker/web/static/notebooker/header.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
$(document).ready(() => {
$.ajax({
url: '/core/version',
success: (result) => {
$('#versionTitle').text("v" + result.version);
$('#versionTitle').show();
},
error: () => {
$('#versionTitle').hide();
},
});
// Check auth is enabled on our host
$.ajax({
url: '/oauth/health',
Expand Down
5 changes: 5 additions & 0 deletions notebooker/web/static/notebooker/one_click_notebooks.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ td button i {
#usernameInfo {
margin-left: 0.5em;
}

#versionTitle {
width: 3em;
display: none;
}
2 changes: 1 addition & 1 deletion notebooker/web/static/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "notebooker",
"version": "0.2.1",
"version": "0.3.0",
"description": "Notebooker - Turn notebooks into reports",
"dependencies": {
"bootstrap-table": "1.15.3",
Expand Down
24 changes: 15 additions & 9 deletions notebooker/web/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,21 @@
<a class="item" id="schedulerButton" href="/scheduler">
Scheduler
</a>
<div class="right menu" id="authArea">
<div class="ui item loggedIn" style="display: none">
Logged in as: <span id="usernameInfo"></span>
<div class="right menu">
<div class="ui item">
<span id="versionTitle"></span>
</div>
<a class="ui item loggedIn" style="display: none" href="/oauth/logout?redirect=/">
Logout
</a>
<a class="ui item loggedOut" style="display: none" href="/oauth/authorize">
Log in
</a>
<div id="authArea">
<div class="ui item loggedIn" style="display: none">
Logged in as: <span id="usernameInfo"></span>
</div>
<a class="ui item loggedIn" style="display: none" href="/oauth/logout?redirect=/">
Logout
</a>
<a class="ui item loggedOut" style="display: none" href="/oauth/authorize">
Log in
</a>
</div>
</div>

</div>
Expand Down Expand Up @@ -89,5 +94,6 @@ <h4 class="ui header inverted">Execute a notebook:</h4>
</a>
</div>
</body>
<footer></footer>
</html>
{% endmacro %}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def get_version():
# https://packaging.python.org/guides/single-sourcing-package-version/#single-sourcing-the-version
base_dir = os.path.abspath(os.path.dirname(__file__))
version_file_loc = os.path.join(base_dir, ".", "notebooker", "_version.py")
version_file_loc = os.path.join(base_dir, ".", "notebooker", "version.py")
version = {}
with open(version_file_loc) as version_file:
exec(version_file.read(), version)
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/web/test_core_routes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import notebooker.version


def test_create_schedule(flask_app, setup_workspace):
Expand All @@ -9,3 +10,13 @@ def test_create_schedule(flask_app, setup_workspace):
assert rv.status_code == 200
data = json.loads(rv.data)
assert data == {"result": ["fake/report"]}


def test_version_number(flask_app, setup_workspace):
with flask_app.test_client() as client:
rv = client.get(
"/core/version",
)
assert rv.status_code == 200
data = json.loads(rv.data)
assert data == {"version": notebooker.version.__version__}

0 comments on commit ce0d324

Please sign in to comment.