Skip to content

Commit

Permalink
chore: merge branch 'release/v1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Rosenkranz-Costa committed Dec 21, 2022
2 parents 04814d1 + c5f2bab commit 8f11978
Show file tree
Hide file tree
Showing 26 changed files with 2,574 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Build and test

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install mypy flake8 types-termcolor==1.1.6
- name: Type-check
run: |
mypy src/ tests/ examples/
- name: Linter
run: |
flake8 --max-line-length=100
- name: Build package
run: |
python -m build
- uses: actions/upload-artifact@v3
with:
name: cloudproof_py_dist
path: ./dist
retention-days: 1

test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.7
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: cloudproof_py_dist
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install cloudproof_py*.whl
- name: Run tests
run: |
python -m unittest tests/test*.py
55 changes: 55 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Publish

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Release
uses: softprops/action-gh-release@v1

publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.7
- name: Install dependencies and build
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install twine
python -m build
- name: Upload to Pypi
run: twine upload -u "${PYPI_USERNAME}" -p "${PYPI_PASSWORD}" dist/cloudproof_py*.whl
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r docs/requirements.txt
- name: Build package
run: |
python scripts/extract_lib_types.py
cd docs && make html
- uses: actions/upload-artifact@v3
with:
name: html_doc
path: docs/_build/html
retention-days: 60
63 changes: 63 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-byte-order-marker
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
# - id: double-quote-string-fixer
- id: end-of-file-fixer
- id: file-contents-sorter
- id: fix-byte-order-marker
- id: fix-encoding-pragma
- id: mixed-line-ending
args: [--fix=lf]
- id: requirements-txt-fixer
- id: sort-simple-yaml
- id: trailing-whitespace

- repo: https://github.com/compilerla/conventional-pre-commit
rev: v2.1.1
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [] # optional: list of Conventional Commits types to allow e.g. [feat, fix, ci, chore, test]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
hooks:
- id: prettier
types_or: [css, javascript, jsx, markdown, bash, java, sh]

- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: [--max-line-length=100]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.990'
hooks:
- id: mypy
additional_dependencies: [types_termcolor==1.1.6]
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Changelog

All notable changes to this project will be documented in this file.

## [1.0.0] - 2022-12-21

### Documentation

- Add sphinx support for automatic doc generation

### Features

- Add package setup
- Add abstract class around FindexInternal
- Add sqlite example for upsert and search
- Add sub-word graph generation util function for Findex
- Make an interactive cli demo

### Testing

- Add SQLite findex tests
- Add CoverCrypt tests

### Ci

- Add automatic package build in github workflow
- Add automatic package publishing in github workflow

<!-- generated by git-cliff -->
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
<h1>Cloudproof Encryption Python Library</h1>
# Cloudproof Encryption Python Library

![ci status](https://github.com/Cosmian/cloudproof_python/actions/workflows/ci.yml/badge.svg)

The library provides a Python API to the **Cloudproof Encryption** product of the [Cosmian Ubiquitous Encryption platform](https://cosmian.com).

Please [check the online documentation](https://docs.cosmian.com/cloudproof_encryption/use_cases_benefits/) for details on using the CloudProof APIs.

## Build package

```sh
pip install -r requirements.txt
scripts/build.sh [-i] [-t]
```

## Build docs

```sh
pip install -r docs/requirements.txt
scripts/build.sh -d
```

## Demo

An interactive CLI demo combining policy-based encryption with searchable keywords.

Users from `./examples/cli_demo/data.json` are encrypted using CoverCrypt and indexed via Findex.

- Run

```sh
scripts/run_demo.sh
```

## Versions Correspondence

This library depends on [CoverCrypt](https://github.com/Cosmian/cover_crypt) and [Findex](https://github.com/Cosmian/findex).

This table shows the minimum version correspondence between the various components.

| `cloudproof_py` | CoverCrypt | Findex |
| --------------- | ---------- | ------ |
| 1.0.0 | 8.0.1 | 1.0.1 |
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
30 changes: 30 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "CloudProof_Py"
copyright = "2022, Cosmian Tech"
author = "Cosmian Tech"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ["sphinx_rtd_theme", "sphinx.ext.napoleon", "autoapi.extension"]
autoapi_type = "python"
autoapi_dirs = ["../src"]
# Use py interface files in priority
autoapi_file_patterns = ["*.docpy", "*.py"]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "sphinx_rtd_theme"
5 changes: 5 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Welcome to CloudProof Python's documentation
============================================

.. toctree::
:maxdepth: 4
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx-autoapi>=2.0.0
sphinx-rtd-theme>=1.1.1
5 changes: 5 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Examples

This folder contains examples to get started with `Cloudproof Python`:

- Demo combining encryption (CoverCrypt) and search (Findex): [cli_demo](./cli_demo)

0 comments on commit 8f11978

Please sign in to comment.