Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
grydz committed Nov 15, 2024
0 parents commit b284854
Show file tree
Hide file tree
Showing 17 changed files with 963 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Python CI

on: [push]

env:
PYTHON_SRC: "src"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
environment:
name: release
url: https://pypi.org/p/cenclave-lib-crypto
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"
- name: Package metadata
id: metadata
run: |
echo "PACKAGE_VERSION=$(python -c 'import cenclave_lib_crypto; print(cenclave_lib_crypto.__version__)')" >> $GITHUB_OUTPUT
- name: Code format with black
run: |
python -m black --check $PYTHON_SRC
- name: Import check with isort
run: |
python -m isort --check $PYTHON_SRC
- name: Lint check with pylint
run: |
python -m pylint $PYTHON_SRC
- name: Lint check with pycodestyle
run: |
python -m pycodestyle $PYTHON_SRC
- name: Lint check with pydocstyle
run: |
python -m pydocstyle $PYTHON_SRC
- name: Typecheck with MyPy
run: |
python -m mypy $PYTHON_SRC
- name: Test with pytest
run: |
python -m pytest
- name: Build package
if: ${{ startsWith(github.ref, 'refs/tags') && endsWith(github.ref, steps.metadata.outputs.PACKAGE_VERSION) }}
run: python -m build

- name: Publish package to PyPi
if: ${{ startsWith(github.ref, 'refs/tags') && endsWith(github.ref, steps.metadata.outputs.PACKAGE_VERSION) }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: false
142 changes: 142 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
.vscode/
.idea/
.python-version

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Cryptography Library for Cosmian Enclave

## Overview

Python cryptography library for [Cosmian Enclave](https://docs.cosmian.com/compute/cosmian_enclave/overview/) based on [PyNaCl](https://github.com/pyca/pynacl/) (binding to [libsodium](https://github.com/jedisct1/libsodium)) and [cryptography](https://github.com/pyca/cryptography).

## Installation

```console
$ pip install cenclave-lib-crypto
```
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[build-system]
requires = ["setuptools>=68.0.0,<76.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "cenclave-lib-crypto"
authors = [
{ name = "Cosmian Tech", email = "[email protected]" },
]
description = "Cryptography Library for Cosmian Enclave"
readme = "README.md"
requires-python = ">=3.8"
license = { text = "MIT" }
classifiers = [
"Development Status :: 6 - Mature",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: Implementation :: CPython"
]
dependencies = [
"cryptography>=43.0.3,<44.0.0",
"pynacl>=1.5.0,<2.0.0"
]
dynamic = ["version"]

[tool.setuptools.dynamic]
version = { attr = "cenclave_lib_crypto.__version__" }

[project.optional-dependencies]
dev = [
"black>=24.10.0,<25.0.0",
"isort>=5.13.2,<6.0.0",
"pylint>=3.3.1,<4.0.0",
"pycodestyle>=2.12.1,<3.0.0",
"pydocstyle>=6.3.0,<7.0.0",
"mypy>=1.13.0,<2.0.0",
"pytest>=8.3.3,<9.0.0",
"build>=1.2.2,<1.3.0",
"wheel>=0.45.0,<0.50.0"
]

[tool.pylint.MAIN]
disable = [
"C0103", # invalid-name
"R0913", # too-many-arguments
"R0917" # too-many-positional-arguments
]

[tool.isort]
profile = "black"

[tool.pytest]
testpaths = "tests"
pythonpath = "src"
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pycodestyle]
max-line-length = 90
ignore = E203,W503
3 changes: 3 additions & 0 deletions src/cenclave_lib_crypto/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""cenclave_lib_crypto module."""

__version__ = "1.0.0"
Loading

0 comments on commit b284854

Please sign in to comment.