Skip to content
Merged

v1 #10

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

on:
push:
tags:
- '*'

jobs:

test:
uses: ./.github/workflows/test.yml
secrets: inherit

build:
name: build framelib dist
needs: test

runs-on: ubuntu-latest

steps:
- name: check out git repository
uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: install python dependencies
run: pip install build

- name: build binary wheel and source tarball
run: python3 -m build

- name: store the dist package
uses: actions/upload-artifact@v4
with:
name: distribution
path: dist/


publish:
name: publish framelib to pypi
needs: build

runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/framelib
permissions:
id-token: write

steps:
- name: get dist package
uses: actions/download-artifact@v4
with:
name: distribution
path: dist/

- name: publish package to pypi
uses: pypa/gh-action-pypi-publish@release/v1
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: test

on:
push:
pull_request:
workflow_call:

jobs:

test:
name: run framelib unit tests
runs-on: ubuntu-latest

steps:
- name: check out git repository
uses: actions/checkout@v4

- name: setup conda env
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: framelib
environment-file: environment.yml
auto-activate-base: false

- name: pytest
shell: bash -l {0}
env:
NEYNAR_KEY: ${{ secrets.NEYNAR_KEY }}
run: pytest -s -v ./test
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
lightweight library for building farcaster frames using python and flask

- easily render frames that conform to the farcaster specification
- configurable frame design
- parse frame action messages
- verify the frame action signatures using neynar
- parse and verify frame action messages using neynar or hubs
- query user profile info from warpcast
- on-chain frame transactions
- eip-712 signatures
- mint tokens


## quickstart
Expand All @@ -27,7 +27,7 @@ app = Flask(__name__)
@app.route('/')
def home():
return frame(
image='https://opengraph.githubassets.com/0x/devinaconley/python-frames',
image='https://framelib.s3.us-east-1.amazonaws.com/framelib_logo.png',
button1='next',
post_url=url_for('second_page', _external=True),
)
Expand All @@ -46,9 +46,10 @@ see [rock paper scissors](https://github.com/devinaconley/rock-paper-scissors)
## roadmap

upcoming features and improvements
- mint actions
- eip 712 signatures
- ~~mint actions~~
- ~~eip 712 signatures~~
- generated library documentation
- dynamic image rendering tools
- ~~dynamic image rendering tools~~
- compatibility with other web frameworks
- state signing
- **frames v2 support**
166 changes: 166 additions & 0 deletions examples/playground/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# 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

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__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/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# custom
package.json
package-lock.json
node_modules/
.vercel
46 changes: 46 additions & 0 deletions examples/playground/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# playground python frame

multi-page farcaster frame built with python, framelib, flask, and vercel

this sample frame demonstrates eip-712 signatures, text inputs, message validation, image rendering, and links

## setup

(optional, but recommended) set up a virtual environment (conda or other)
```
conda create -n frame-example python=3.9
conda activate frame-example
```

install dependencies
```
pip install -r requirements.txt
```

setup vercel
```
npm install vercel
```


## development

run local app
```
npx vercel dev
```

you can run the frame debugger provided by [frames.js](https://github.com/framesjs/frames.js) to test locally


## deployment

make sure your project has been pushed to a github repo

import your project to [vercel](https://vercel.com/) with the flask framework

register with [neynar](https://neynar.com/) to get an api key

define the `NEYNAR_KEY` environment variable in your vercel project settings

deploy!
Loading
Loading