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
34 changes: 34 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: On pull request

on:
pull_request:
branches: [ main ]

jobs:
build_python:
runs-on: ubuntu-latest

steps:
- name: Get current time
uses: gerred/actions/current-time@master
id: current-time

- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel build

- name: Build package
run: |
set -e
set -x
export PYPI_MOMENTO_WIRE_TYPE_VERSION=0.0.devBuild
python -m build
shell: bash
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Compiled python modules.
src/*.pyc

# Setuptools distribution folder.
/dist/

# Python egg metadata, regenerated from source files by setuptools.
src/*.egg-info

# Don't checkin the virtual environemnt
client_sdk_python_env
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# client-sdk-python
Python SDK for Momento

# Requirements
* Python 3
* [Virual environment setup](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#installing-virtualenv)

# Setup pre-requisites
`./prepare_local_dev_env.sh`
The script creates a python virtual environment and installs dependencies

## Setting up IDE
### Visual Studio Code
Use `Cmd` + `Shift` + `P` to search for `Python: Interpreter` and select:
`./client_sdk_python_env/bin/python`
3 changes: 3 additions & 0 deletions prepare_local_dev_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python3 -m venv client_sdk_python_env
source client_sdk_python_env/bin/activate
pip install -e . --extra-index-url https://momento.jfrog.io/artifactory/api/pypi/pypi-public/simple
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# requirements.txt is required to debug/run sdk locally. Pip needs requirements
# that must be installed to proceed.
#
# Since, SDK will be distributed via PyPi it is needed to provide installation
# requirements in setup.cfg.
#
# Instead of maintaining two different requirements, use setup.cfg as the
# primary source. Hence a '.' is provided here which signals pip to use
# dependencies from setup.cfg
.
15 changes: 15 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[metadata]
name = momento-sdk

[options]
package_dir =
= src
packages = find:
python_requires = >=3.6
install_requires =
momento-wire-types==0.3.0
build
setuptools

[options.packages.find]
where = src
13 changes: 13 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import setuptools
import os
import time

version = os.getenv("PYPI_MOMENTO_WIRE_TYPE_VERSION")

if [version == None]:
version = '0.0.dev'

# version is the only dynamic configuration
setuptools.setup(
version=version,
)
Empty file added src/momento_sdk/__init__.py
Empty file.
13 changes: 13 additions & 0 deletions src/momento_sdk/momento.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import momento_wire_types.controlclient_pb2 as control_client

class Momento:
def __init__(self, auth_token, endpoint_override=None):
self._auth_token__ = auth_token
self._endpoint_override = endpoint_override

def create_cache(self, cache_name):
print("hello")


def init(auth_token):
return Momento(auth_token=auth_token)