Skip to content

Commit 859ce30

Browse files
Merge pull request #15 from Spherre-Labs/feat/setup-backend-application
Setup backend application
2 parents 2a50f7e + af10af8 commit 859ce30

File tree

14 files changed

+325
-1
lines changed

14 files changed

+325
-1
lines changed

.github/workflows/backend_lint.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Backend Lint and Code Formatting Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
pull_request:
9+
branches:
10+
- main
11+
- dev
12+
13+
jobs:
14+
frontend-lint-and-format:
15+
runs-on: ubuntu-latest
16+
steps:
17+
# Step 1: Check out the code
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
21+
# Step 2: Set up Node.js
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: "3.12"
26+
27+
# Step 3: Install dependencies
28+
- name: Install dependencies
29+
run: |
30+
pip install -r requirements.txt
31+
working-directory: backend
32+
33+
# Step 4: Run Ruff Lint
34+
- name: Run Ruff Lint
35+
run: |
36+
ruff check .
37+
working-directory: backend
38+
39+
# Step 5: Run Ruff for formatting
40+
- name: Run Ruff for formatting
41+
run: ruff format --check .
42+
working-directory: backend

backend/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DB_CONNECTION_STRING=sqlite:///db.sqlite3
2+
SECRET_KEY=spherregonnabegreat25

backend/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
env/
2+
.env
3+
.ruff_cache/
4+
instance/
5+
.webassets-cache
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class

backend/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
build:
2+
pip install -r requirements.txt
3+
4+
format:
5+
ruff format .
6+
ruff check . --fix --select I
7+
8+
lint:
9+
ruff check .
10+
11+
start:
12+
python spherre/wsgi.py

backend/README.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,63 @@
1-
## Spherre Backend
1+
## Spherre Backend
2+
This is the official backend for the spherre multisig
3+
4+
## Installation
5+
6+
### Prerequisites
7+
8+
- Python 3.8 or higher
9+
- Make
10+
11+
### Steps
12+
1. **Clone the repository**:
13+
```bash
14+
git clone https://github.com/your-username/spherre-dapp.git
15+
cd spherre-dapp/backend/
16+
```
17+
3. **Create a virtual environment and initialize it**
18+
```bash
19+
virtualenv env
20+
source env/bin/activate # for linux
21+
```
22+
2. **Install dependencies**:
23+
```bash
24+
make build
25+
```
26+
3. **Start the Application**:
27+
```bash
28+
make install
29+
```
30+
31+
## Contributing
32+
1. Fork this repository
33+
2. Create a new branch:
34+
```bash
35+
git checkout -b feature/your-feature-name
36+
```
37+
or
38+
```bash
39+
git checkout -b fix/issue-number
40+
```
41+
42+
43+
3. Make your changes
44+
45+
4. Commit your changes:
46+
```bash
47+
git commit -m "feat: Description of changes"
48+
```
49+
50+
### Linting and Formatting
51+
Before submitting your changes, ensure:
52+
53+
1. Code is linted:
54+
55+
```bash
56+
make lint
57+
```
58+
59+
2. Code is formatted:
60+
61+
```bash
62+
make format
63+
```

backend/pyproject.toml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
[tool.pytest.ini_options]
2+
DJANGO_SETTINGS_MODULE = "learnbestia.settings"
3+
pythonpath = ["src", "tests"]
4+
python_files = [
5+
"test_*.py",
6+
"*_test.py",
7+
"testing/python/*.py"
8+
]
9+
norecursedirs = [
10+
"scripts",
11+
"node_modules",
12+
"py-requirements",
13+
"webpack",
14+
".*",
15+
"{args}"
16+
]
17+
18+
19+
[tool.ruff]
20+
# Exclude a variety of commonly ignored directories.
21+
exclude = [
22+
".bzr",
23+
".direnv",
24+
".eggs",
25+
".git",
26+
".git-rewrite",
27+
".hg",
28+
".mypy_cache",
29+
".nox",
30+
".pants.d",
31+
".pytype",
32+
".ruff_cache",
33+
".svn",
34+
".tox",
35+
".venv",
36+
"__pypackages__",
37+
"_build",
38+
"buck-out",
39+
"build",
40+
"dist",
41+
"node_modules",
42+
"venv",
43+
"migrations",
44+
"env",
45+
]
46+
47+
line-length = 88
48+
target-version = "py312"
49+
50+
[tool.ruff.lint]
51+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
52+
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
53+
# McCabe complexity (`C901`) by default.
54+
select = ["E", "E4", "E7", "E9", "F", "I001"]
55+
56+
# Allow fix for all enabled rules (when `--fix`) is provided.
57+
fixable = ["ALL"]
58+
59+
# Allow unused variables when underscore-prefixed.
60+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
61+
62+
[tool.ruff.format]
63+
quote-style = "double"
64+
indent-style = "space"
65+
skip-magic-trailing-comma = false
66+
line-ending = "auto"
67+
docstring-code-format = false
68+
docstring-code-line-length = "dynamic"
69+
70+
[tool.poetry]
71+
name = "spherre"
72+
version = "0.1.0"
73+
description = "API for spherre"
74+
authors = ["codebestia"]
75+
readme = "README.md"
76+
package-mode = false

backend/requirements.txt

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
aiohappyeyeballs==2.6.1
2+
aiohttp==3.11.13
3+
aiosignal==1.3.2
4+
aniso8601==10.0.0
5+
anyio==4.8.0
6+
apibara==0.8.0
7+
asgiref==3.8.1
8+
attrs==25.3.0
9+
blinker==1.9.0
10+
build==1.2.2.post1
11+
CacheControl==0.14.2
12+
cached-property==2.0.1
13+
certifi==2025.1.31
14+
cffi==1.17.1
15+
charset-normalizer==3.4.1
16+
cleo==2.1.0
17+
click==8.1.8
18+
crashtest==0.4.1
19+
crypto_cpp_py==1.4.5
20+
cryptography==44.0.2
21+
cytoolz==1.0.1
22+
distlib==0.3.9
23+
dulwich==0.22.8
24+
ecdsa==0.18.0
25+
eth-hash==0.7.1
26+
eth-keyfile==0.9.1
27+
eth-keys==0.6.1
28+
eth-typing==5.2.0
29+
eth-utils==5.2.0
30+
fastjsonschema==2.21.1
31+
filelock==3.17.0
32+
findpython==0.6.3
33+
Flask==3.1.0
34+
Flask-RESTful==0.3.10
35+
frozenlist==1.5.0
36+
greenlet==3.1.1
37+
grpcio==1.71.0
38+
h11==0.14.0
39+
httpcore==1.0.7
40+
httpx==0.28.1
41+
idna==3.10
42+
installer==0.7.0
43+
itsdangerous==2.2.0
44+
jaraco.classes==3.4.0
45+
jaraco.context==6.0.1
46+
jaraco.functools==4.1.0
47+
jeepney==0.9.0
48+
Jinja2==3.1.6
49+
keyring==25.6.0
50+
lark==1.2.2
51+
MarkupSafe==3.0.2
52+
marshmallow==3.26.1
53+
marshmallow-oneofschema==3.1.1
54+
marshmallow_dataclass==8.7.1
55+
more-itertools==10.6.0
56+
mpmath==1.3.0
57+
msgpack==1.1.0
58+
multidict==6.1.0
59+
mypy-extensions==1.0.0
60+
packaging==24.2
61+
pbs-installer==2025.3.11
62+
pkginfo==1.12.1.2
63+
platformdirs==4.3.6
64+
poetry-core==2.1.1
65+
poseidon_py==0.1.5
66+
propcache==0.3.0
67+
protobuf==4.25.6
68+
py-ecc==7.0.1
69+
pycparser==2.22
70+
pycryptodome==3.21.0
71+
pyproject_hooks==1.2.0
72+
pytz==2025.1
73+
RapidFuzz==3.12.2
74+
requests==2.32.3
75+
requests-toolbelt==1.0.0
76+
ruff==0.9.10
77+
SecretStorage==3.3.3
78+
shellingham==1.5.4
79+
six==1.17.0
80+
sniffio==1.3.1
81+
SQLAlchemy==2.0.39
82+
starknet-py==0.25.0
83+
sympy==1.12.1
84+
tomlkit==0.13.2
85+
toolz==1.0.0
86+
trove-classifiers==2025.3.3.18
87+
typeguard==4.4.2
88+
typing-inspect==0.9.0
89+
typing_extensions==4.12.2
90+
urllib3==2.3.0
91+
virtualenv==20.29.3
92+
Werkzeug==3.1.3
93+
yarl==1.18.3
94+
zstandard==0.23.0

backend/spherre/__init__.py

Whitespace-only changes.

backend/spherre/app.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from flask_restful import Api, Resource
2+
from settings import app
3+
4+
api = Api(app)
5+
6+
7+
class TestView(Resource):
8+
def get(self):
9+
return {"message": "Hello world"}
10+
11+
12+
api.add_resource(TestView, "/")

backend/spherre/models.py

Whitespace-only changes.

0 commit comments

Comments
 (0)