diff --git a/.gitignore b/.gitignore
index 9cc9f05..60b75e4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,9 @@
# Ignoring shape predictor
app/data/classifiers/*.dat
+# redis dump db
+dump.rdb
+
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..2f70fca
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,13 @@
+dist: xenial
+language: python
+
+cache: pip
+python:
+ - '3.7'
+
+install:
+ - pip install -r requirements.txt
+ - pip freeze
+
+script:
+ - pytest
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9b1724d..4e3b61e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,10 +1,68 @@
# Contributing to CSSI REST API
-We would love for you to contribute to CSSI API and help make it even better than it is
-today!
+We would love for you to contribute to CSSI REST API and help make
+it even better than it is today!. As a contributor, here are the
+guidelines for you to follow:
-### Type
+ - [Commit Message Guidelines](#commit)
+ - [Branch Naming Conventions](#branch-naming)
+
+## Commit Message Guidelines
+
+We have used `semantic git commits` through out the application and would like to keep them consistent. Please follow the following specified rules when committing your code.
+
+### Commit Message Format
+Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
+format that includes a **type**, a **scope** and a **subject**:
+
+```
+():
+
+
+
+
# Getting Started
@@ -42,14 +63,18 @@ python manage.py runserver
# Built With
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+# Releases
+
+Please read the [RELEASES.md](./docs/RELEASES.md) guideline to learn about the process for releasing the project.
# Changelog
@@ -59,6 +84,12 @@ Please refer [CHANGELOG.md](CHANGELOG.md) to learn about the latest improvements
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for contributing guidelines and to learn about our code of conduct.
+# Contributors
+
+
+
+
+
# License
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fproject-cssi%2Fcssi-api?ref=badge_large)
diff --git a/VERSION.txt b/VERSION.txt
new file mode 100644
index 0000000..9a4043a
--- /dev/null
+++ b/VERSION.txt
@@ -0,0 +1 @@
+0,1,0,alpha,1,0,0
\ No newline at end of file
diff --git a/app/routes/v1/application.py b/app/routes/v1/application.py
index a0f327a..aa121f9 100644
--- a/app/routes/v1/application.py
+++ b/app/routes/v1/application.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# (c) Copyright 2019 Brion Mario.
+# (c) Copyright 2019 CSSI.
# (c) This file is part of the CSSI REST API and is made available under MIT license.
-# (c) For more information, see https://github.com/brionmario/cssi-api/blob/master/LICENSE.txt
-# (c) Please forward any queries to the given email address. email: brion@apareciumlabs.com
+# (c) For more information, see https://github.com/project-cssi/cssi-api/blob/master/LICENSE.md
+# (c) Please forward any queries to the given email address. email: opensource@apareciumlabs.com
"""Application routes module
diff --git a/app/routes/v1/questionnaire.py b/app/routes/v1/questionnaire.py
index be21216..7012e37 100644
--- a/app/routes/v1/questionnaire.py
+++ b/app/routes/v1/questionnaire.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# (c) Copyright 2019 Brion Mario.
+# (c) Copyright 2019 CSSI.
# (c) This file is part of the CSSI REST API and is made available under MIT license.
-# (c) For more information, see https://github.com/brionmario/cssi-api/blob/master/LICENSE.txt
-# (c) Please forward any queries to the given email address. email: brion@apareciumlabs.com
+# (c) For more information, see https://github.com/project-cssi/cssi-api/blob/master/LICENSE.md
+# (c) Please forward any queries to the given email address. email: opensource@apareciumlabs.com
"""Application routes module
diff --git a/app/routes/v1/session.py b/app/routes/v1/session.py
index 1eb8c8c..182ca75 100644
--- a/app/routes/v1/session.py
+++ b/app/routes/v1/session.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# (c) Copyright 2019 Brion Mario.
+# (c) Copyright 2019 CSSI.
# (c) This file is part of the CSSI REST API and is made available under MIT license.
-# (c) For more information, see https://github.com/brionmario/cssi-api/blob/master/LICENSE.txt
-# (c) Please forward any queries to the given email address. email: brion@apareciumlabs.com
+# (c) For more information, see https://github.com/project-cssi/cssi-api/blob/master/LICENSE.md
+# (c) Please forward any queries to the given email address. email: opensource@apareciumlabs.com
"""Session routes module
diff --git a/config/config.py b/config/config.py
index ded27de..a3e6ae3 100644
--- a/config/config.py
+++ b/config/config.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# (c) Copyright 2019 Brion Mario.
+# (c) Copyright 2019 CSSI.
# (c) This file is part of the CSSI REST API and is made available under MIT license.
-# (c) For more information, see https://github.com/brionmario/cssi-api/blob/master/LICENSE.txt
-# (c) Please forward any queries to the given email address. email: brion@apareciumlabs.com
+# (c) For more information, see https://github.com/project-cssi/cssi-api/blob/master/LICENSE.md
+# (c) Please forward any queries to the given email address. email: opensource@apareciumlabs.com
"""Configurations for the CSSI REST API
diff --git a/docs/RELEASES.md b/docs/RELEASES.md
new file mode 100644
index 0000000..9c3e172
--- /dev/null
+++ b/docs/RELEASES.md
@@ -0,0 +1,82 @@
+# Release Instructions
+
+This document contains all the necessary instructions to release the
+project and to generate the corresponding changelog.
+
+## Versioning
+
+We follow the [PEP0440](https://www.python.org/dev/peps/pep-0440/)
+versioning standard when releasing `cssi` library. Please read the
+[versioning](./VERSIONING.md) guidelines document carefully before
+attempting any release related tasks.
+
+## Creating a Release
+
+### Install Changelog Generator
+
+We have used the `git-changelog` package to automate the changelog
+generation process. Click
+[here](https://pypi.org/project/git-changelog/) to learn more about
+`git-changelog`. Execute the below command to install the package on
+your machine.
+
+```bash
+pip install git-changelog
+```
+
+### Using the release script
+
+We have created a script to automate the taging and versioning of the
+releae pipeline. Follow the bellow guidelines when using the release
+script.
+
+NOTE: Execute the release script from the root directory.
+
+```bash
+sh ./scripts/release.sh $release_type $release_level
+```
+
+Replace the `$release_type` and `$release_level` with the corresponding
+values.
+
+#### Examples
+
+1. Major release - From 1.9 to 2.0
+
+
+
+```bash
+sh ./scripts/release.sh major final
+```
+
+2. Minor release - From 1.1.x to 1.2
+
+
+
+```bash
+sh ./scripts/release.sh minor final
+```
+
+3. Patch release - From 1.1.3 to 1.1.4
+
+
+
+```bash
+sh ./scripts/release.sh patch final
+```
+
+4. Major Alpha release - From 1.9.2 to 1.0a0
+
+
+
+```bash
+sh ./scripts/release.sh major alpha
+```
+
+6. Release next beta - From 0.1b2 to 0.1b3
+
+
+
+```bash
+sh ./scripts/release.sh prenext beta
+```
diff --git a/docs/VERSIONING.md b/docs/VERSIONING.md
new file mode 100644
index 0000000..fa0a4c6
--- /dev/null
+++ b/docs/VERSIONING.md
@@ -0,0 +1,33 @@
+# Versioning Guidelines
+
+Please follow the following
+[PEP0440](https://www.python.org/dev/peps/pep-0440/) release version
+standard.
+
+## Final Releases
+
+ X(.Y)*
+
+ Ex: 0.9
+ 0.9.1
+ 0.9.2
+
+## Pre-releases
+
+ X.YaN # Alpha release
+ X.YbN # Beta release
+ X.YrcN # Release Candidate
+ X.Y.Z # For bug-fix releases
+
+## Post-releases
+
+ X.YaN.postM # Post-release of an alpha release
+ X.YbN.postM # Post-release of a beta release
+ X.YrcN.postM # Post-release of a release candidate
+
+## Developmental releases
+
+ X.YaN.devM # Developmental release of an alpha release
+ X.YbN.devM # Developmental release of a beta release
+ X.YrcN.devM # Developmental release of a release candidate
+ X.Y.postN.devM # Developmental release of a post-release
diff --git a/docs/logos/cssi-logo square-pixel.png b/docs/logo/cssi-logo square-pixel.png
similarity index 100%
rename from docs/logos/cssi-logo square-pixel.png
rename to docs/logo/cssi-logo square-pixel.png
diff --git a/docs/logos/cssi-logo-black.svg b/docs/logo/cssi-logo-black.svg
similarity index 100%
rename from docs/logos/cssi-logo-black.svg
rename to docs/logo/cssi-logo-black.svg
diff --git a/docs/logos/cssi-logo-core.png b/docs/logo/cssi-logo-core.png
similarity index 100%
rename from docs/logos/cssi-logo-core.png
rename to docs/logo/cssi-logo-core.png
diff --git a/docs/logos/cssi-logo-dashboard-text-only-white.svg b/docs/logo/cssi-logo-dashboard-text-only-white.svg
similarity index 100%
rename from docs/logos/cssi-logo-dashboard-text-only-white.svg
rename to docs/logo/cssi-logo-dashboard-text-only-white.svg
diff --git a/docs/logos/cssi-logo-dashboard.png b/docs/logo/cssi-logo-dashboard.png
similarity index 100%
rename from docs/logos/cssi-logo-dashboard.png
rename to docs/logo/cssi-logo-dashboard.png
diff --git a/docs/logos/cssi-logo-dashboard.svg b/docs/logo/cssi-logo-dashboard.svg
similarity index 100%
rename from docs/logos/cssi-logo-dashboard.svg
rename to docs/logo/cssi-logo-dashboard.svg
diff --git a/docs/logos/cssi-logo-outline.svg b/docs/logo/cssi-logo-outline.svg
similarity index 100%
rename from docs/logos/cssi-logo-outline.svg
rename to docs/logo/cssi-logo-outline.svg
diff --git a/docs/logos/cssi-logo-rest-api.png b/docs/logo/cssi-logo-rest-api.png
similarity index 100%
rename from docs/logos/cssi-logo-rest-api.png
rename to docs/logo/cssi-logo-rest-api.png
diff --git a/docs/logos/cssi-logo-rest-api.svg b/docs/logo/cssi-logo-rest-api.svg
similarity index 100%
rename from docs/logos/cssi-logo-rest-api.svg
rename to docs/logo/cssi-logo-rest-api.svg
diff --git a/docs/logos/cssi-logo-square.png b/docs/logo/cssi-logo-square.png
similarity index 100%
rename from docs/logos/cssi-logo-square.png
rename to docs/logo/cssi-logo-square.png
diff --git a/docs/logos/cssi-logo-square.svg b/docs/logo/cssi-logo-square.svg
similarity index 100%
rename from docs/logos/cssi-logo-square.svg
rename to docs/logo/cssi-logo-square.svg
diff --git a/docs/logos/cssi-logo-text-only.png b/docs/logo/cssi-logo-text-only.png
similarity index 100%
rename from docs/logos/cssi-logo-text-only.png
rename to docs/logo/cssi-logo-text-only.png
diff --git a/docs/logos/cssi-logo-white.svg b/docs/logo/cssi-logo-white.svg
similarity index 100%
rename from docs/logos/cssi-logo-white.svg
rename to docs/logo/cssi-logo-white.svg
diff --git a/docs/logos/cssi-logo.png b/docs/logo/cssi-logo.png
similarity index 100%
rename from docs/logos/cssi-logo.png
rename to docs/logo/cssi-logo.png
diff --git a/docs/logos/cssi-logo.svg b/docs/logo/cssi-logo.svg
similarity index 100%
rename from docs/logos/cssi-logo.svg
rename to docs/logo/cssi-logo.svg
diff --git a/docs/technologies/celery.png b/docs/readme-resources/technologies/celery.png
similarity index 100%
rename from docs/technologies/celery.png
rename to docs/readme-resources/technologies/celery.png
diff --git a/docs/technologies/flask-socketio.png b/docs/readme-resources/technologies/flask-socketio.png
similarity index 100%
rename from docs/technologies/flask-socketio.png
rename to docs/readme-resources/technologies/flask-socketio.png
diff --git a/docs/technologies/flask-sqlalchemy.png b/docs/readme-resources/technologies/flask-sqlalchemy.png
similarity index 100%
rename from docs/technologies/flask-sqlalchemy.png
rename to docs/readme-resources/technologies/flask-sqlalchemy.png
diff --git a/docs/technologies/flask.svg b/docs/readme-resources/technologies/flask.svg
similarity index 100%
rename from docs/technologies/flask.svg
rename to docs/readme-resources/technologies/flask.svg
diff --git a/docs/technologies/marshmallow.png b/docs/readme-resources/technologies/marshmallow.png
similarity index 100%
rename from docs/technologies/marshmallow.png
rename to docs/readme-resources/technologies/marshmallow.png
diff --git a/docs/technologies/mysql.svg b/docs/readme-resources/technologies/mysql.svg
similarity index 100%
rename from docs/technologies/mysql.svg
rename to docs/readme-resources/technologies/mysql.svg
diff --git a/docs/technologies/python.svg b/docs/readme-resources/technologies/python.svg
similarity index 100%
rename from docs/technologies/python.svg
rename to docs/readme-resources/technologies/python.svg
diff --git a/docs/technologies/redis.png b/docs/readme-resources/technologies/redis.png
similarity index 100%
rename from docs/technologies/redis.png
rename to docs/readme-resources/technologies/redis.png
diff --git a/manage.py b/manage.py
index ee12068..5076bee 100644
--- a/manage.py
+++ b/manage.py
@@ -1,15 +1,17 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# (c) Copyright 2019 Brion Mario.
+# (c) Copyright 2019 CSSI.
# (c) This file is part of the CSSI REST API and is made available under MIT license.
-# (c) For more information, see https://github.com/brionmario/cssi-api/blob/master/LICENSE.txt
-# (c) Please forward any queries to the given email address. email: brion@apareciumlabs.com
+# (c) For more information, see https://github.com/project-cssi/cssi-api/blob/master/LICENSE.md
+# (c) Please forward any queries to the given email address. email: opensource@apareciumlabs.com
"""
Brief: REST API for the CSSI library
-Author: Brion Mario
+Authors:
+ Brion Mario
+
"""
import os
diff --git a/requirements.txt b/requirements.txt
index 83b48ad..6985d6a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -13,4 +13,5 @@ flask-socketio==3.3.2
PyMySQL==0.9.3
redis==3.2.1
Pillow
-numpy>=1.16.2
\ No newline at end of file
+numpy>=1.16.2
+pytest==4.5.0
diff --git a/scripts/release.sh b/scripts/release.sh
new file mode 100644
index 0000000..be64f57
--- /dev/null
+++ b/scripts/release.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+set -u -e -o pipefail
+
+# Used for production releases.
+# Args: release_type: ["major", "minor", "patch", "premajor", "preminor", "prepatch", "prenext", "dev", "post"]
+# release_level: ["alpha", "beta", "candidate", "final"]
+
+RELEASE_TYPE=$1
+RELEASE_LEVEL=$2
+
+echo "======================================================"
+echo " Releasing CSSI API for Production\n"
+echo " Release Type: $RELEASE_TYPE"
+echo " Release Level: $RELEASE_LEVEL"
+echo "======================================================"
+
+# Construct the new version by executing the `construct_release_version()` function
+# in `version.py` script inside the `cssi` package.
+NEW_VERSION=$(python -c "from version import construct_release_version; print(construct_release_version('$RELEASE_TYPE', '$RELEASE_LEVEL'))")
+
+# Tag the release
+git tag -a ${NEW_VERSION} -m "release: cut the v$NEW_VERSION release"
+git push origin ${NEW_VERSION}
+
+# Generate the changelog
+# Format -o = output file
+# -s = commit style {angular,atom,basic}
+# -t = template {angular, keepachangelog}
+# REPOSITORY = directory that contains the .git folder
+git-changelog -o CHANGELOG.md -s angular -t angular .
+
+# Stage and create a release commit with CHANGELOG.md and VERSION.txt files
+git add CHANGELOG.md cssi/VERSION.txt
+git commit -m "release: cut the $NEW_VERSION release :tada:"
+
+echo "Successfully released a new version of CSSI: v$NEW_VERSION"
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/__init__.py
@@ -0,0 +1 @@
+
diff --git a/tests/api_test.py b/tests/api_test.py
new file mode 100644
index 0000000..4c2869c
--- /dev/null
+++ b/tests/api_test.py
@@ -0,0 +1,5 @@
+import pytest
+
+class TestCSSIAPI(object):
+ def test_init(self):
+ pass
diff --git a/version.py b/version.py
new file mode 100644
index 0000000..b6df04b
--- /dev/null
+++ b/version.py
@@ -0,0 +1,124 @@
+# PEP0440 compatible formatted version, see:
+# https://www.python.org/dev/peps/pep-0440/
+#
+# Final Releases:
+# X(.Y)*
+# Ex: 0.9
+# 0.9.1
+# 0.9.2
+# Pre-releases
+# X.YaN # Alpha release
+# X.YbN # Beta release
+# X.YrcN # Release Candidate
+# X.Y.Z # For bug-fix releases
+#
+# Post-releases:
+# X.YaN.postM # Post-release of an alpha release
+# X.YbN.postM # Post-release of a beta release
+# X.YrcN.postM # Post-release of a release candidate
+#
+# Developmental releases
+# X.YaN.devM # Developmental release of an alpha release
+# X.YbN.devM # Developmental release of a beta release
+# X.YrcN.devM # Developmental release of a release candidate
+# X.Y.postN.devM # Developmental release of a post-release
+
+import os
+
+VERSION_FILE_NAME = "VERSION.txt"
+VERSION_FILE_PATH = os.path.join(os.path.split(__file__)[0], VERSION_FILE_NAME)
+
+# Read the VERSION.txt file and extract the version number
+# Version number is saved in the following format
+# (major, minor, patch, level, pre_identifier, dev_identifier, post_identifier)
+try:
+ with open(VERSION_FILE_PATH) as vf:
+ _version = tuple(
+ vf.read().strip().split(","))
+ VERSION = (int(_version[0]), int(_version[1]), int(_version[2]), _version[3], int(
+ _version[4]), int(_version[5]), int(_version[6]))
+except IOError:
+ raise RuntimeError(
+ "Unable to read version file on path : {0}".format(VERSION_FILE_PATH))
+
+
+def _construct_version(major, minor, patch, level, pre_identifier, dev_identifier, post_identifier):
+ """Construct a PEP0440 compatible version number to be set to __version__"""
+ assert level in ["alpha", "beta", "candidate", "final"]
+
+ version = "{0}.{1}".format(major, minor)
+ if patch:
+ version += ".{0}".format(patch)
+
+ if level == "final":
+ if post_identifier:
+ version += ".{0}{1}".format("post", post_identifier)
+ if dev_identifier:
+ version += ".{0}{1}".format("dev", dev_identifier)
+ else:
+ level_short = {"alpha": "a", "beta": "b", "candidate": "rc"}[level]
+ version += "{0}{1}".format(level_short, pre_identifier)
+ if post_identifier:
+ version += ".{0}{1}".format("post", post_identifier)
+ if dev_identifier:
+ version += ".{0}{1}".format("dev", dev_identifier)
+ return version
+
+
+def construct_release_version(release_type, release_level="final"):
+ """Constructs the version number based on the release type and level."""
+ assert release_type in ["major", "minor", "patch", "premajor",
+ "preminor", "prepatch", "prenext", "dev", "post"]
+ assert release_level in ["alpha", "beta", "candidate", "final"]
+
+ # Extract the version sub parts from VERSION
+ major, minor, patch, level, pre_identifier, dev_identifier, post_identifier = VERSION
+
+ version = "{0}.{1}".format(major, minor)
+ if release_type == "major":
+ major += 1
+ version = (major, 0, 0, release_level, 0, 0, 0)
+ elif release_type == "minor":
+ minor += 1
+ version = (major, minor, 0, release_level, 0, 0, 0)
+ elif release_type == "patch":
+ patch += 1
+ version = (major, minor, patch, release_level, 0, 0, 0)
+ elif release_type == "premajor":
+ major += 1
+ version = (major, 0, 0, release_level, 1, 0, 0)
+ elif release_type == "preminor":
+ minor += 1
+ version = (major, minor, 0, release_level, 1, 0, 0)
+ elif release_type == "prepatch":
+ patch += 1
+ version = (major, minor, patch, release_level, 1, 0, 0)
+ elif release_type == "prenext":
+ pre_identifier += 1
+ version = (major, minor, patch, release_level, pre_identifier, 0, 0)
+ elif release_type == "dev":
+ dev_identifier += 1
+ version = (major, minor, patch, release_level,
+ pre_identifier, dev_identifier, post_identifier)
+ elif release_type == "post":
+ post_identifier += 1
+ version = (major, minor, patch, release_level,
+ pre_identifier, dev_identifier, post_identifier)
+
+ # Update the version file
+ update_version_file(version)
+
+ return _construct_version(*version)
+
+
+def update_version_file(version):
+ """Updates the version number in VERSION.txt file."""
+ try:
+ with open(VERSION_FILE_PATH, "w") as f:
+ f.write(','.join(str(v) for v in version))
+ except IOError:
+ raise RuntimeError(
+ "Unable to write to version file on path : {0}".format(VERSION_FILE_PATH))
+
+
+__version__ = _construct_version(*VERSION)