mirror of
https://github.com/tcsenpai/pensieve.git
synced 2025-06-06 03:05:25 +00:00
init commit
This commit is contained in:
commit
fc72c968d6
45
.github/workflows/release.yml
vendored
Normal file
45
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build dist
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Set up Python 3.10
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.10"
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
pip install setuptools wheel twine
|
||||||
|
python setup.py sdist bdist_wheel
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: build
|
||||||
|
name: Upload release to PyPI
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment:
|
||||||
|
name: pypi
|
||||||
|
url: https://pypi.org/p/memos
|
||||||
|
permissions:
|
||||||
|
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist
|
||||||
|
- name: Publish package distributions to PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.envrc
|
||||||
|
dist/
|
||||||
|
memos.egg-info/
|
||||||
|
build/
|
||||||
|
*.pyc
|
0
memos/__init__.py
Normal file
0
memos/__init__.py
Normal file
19
memos/commands.py
Normal file
19
memos/commands.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import typer
|
||||||
|
import httpx
|
||||||
|
from memos.server import run_server
|
||||||
|
|
||||||
|
app = typer.Typer()
|
||||||
|
|
||||||
|
@app.command()
|
||||||
|
def serve():
|
||||||
|
run_server()
|
||||||
|
|
||||||
|
@app.command()
|
||||||
|
def ls():
|
||||||
|
response = httpx.get("http://localhost:8080/libraries")
|
||||||
|
libraries = response.json()
|
||||||
|
for library in libraries:
|
||||||
|
print(library['name'])
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app()
|
7
memos/main.py
Normal file
7
memos/main.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from fastapi import FastAPI
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
|
@app.get("/libraries")
|
||||||
|
async def get_libraries():
|
||||||
|
return [{"name": "Library1"}, {"name": "Library2"}]
|
4
memos/server.py
Normal file
4
memos/server.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import uvicorn
|
||||||
|
|
||||||
|
def run_server():
|
||||||
|
uvicorn.run("memos.main:app", host="0.0.0.0", port=8080, reload=True)
|
4
requirements.txt
Normal file
4
requirements.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
fastapi
|
||||||
|
uvicorn
|
||||||
|
httpx
|
||||||
|
typer
|
Loading…
x
Reference in New Issue
Block a user