Skip to content

Commit

Permalink
📦 Make server dist comes with the dependencies included
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavst committed Sep 5, 2024
1 parent c81b631 commit f469b7a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- { name: vscode, type: typescript }
- { name: websites, type: typescript }
- { name: jadx, type: pack }
- { name: server, type: pybunch }
- { name: server, type: python }
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.x"
if: matrix.target.type == 'pybunch'
if: matrix.target.type == 'pybunch' || matrix.target.type == 'python'

- name: Install pybunch
run: python -m pip install pybunch
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,8 @@ server:
@echo "Updating the version in pyproject.toml"
sed -i 's/version = "[^"]*"/version = "$(VERSION)"/' server/pyproject.toml
@echo "Building the graffiti Server"
python3 -m pybunch -d server -e graffiti -so -o out/graffiti_v$(VERSION)_server.py
mkdir tmp
python3 -m pip install websockets==10.3.0 --target tmp
cp -R server/graffiti tmp/
python3 -m zipapp tmp -m "graffiti.__main__:main_cli" -p "/usr/bin/env python3" -o out/graffiti_v$(VERSION)_server.pyz
rm -rf tmp
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,9 @@ The server can run it two modes:
- Single user mode - for local user.
- Multi user mode - for domains or multiple users on the same server.

To run the server, first install the single dependency - websockets library:
Then, just run `python3 server.pyz`. If you want to use multi-user mode, add the `--multi-user-mode` flag.

```python
pip3 install websockets==10.3
```

Then, just run `python3 server.py`. If you want to use multi-user mode, add the `--multi-user-mode` flag.

Note: if you want to run the unpacked version from source, run `python3 -m server.graffiti`.
Note: if you want to run the unpacked version from source, run `python3 -m server.graffiti`. Make sure to install the requirements before.

### Backend

Expand Down
3 changes: 1 addition & 2 deletions docs/platforms/Server.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ Graffiti requires a Python server to proxy between the various IDE you use and t
## Single user setup

- Python 3.7+
- `websockets==10.3`
- Run the server: `python3 graffiti_v{version}_server.py`
- Run the server: `python3 graffiti_v{version}_server.pyz`

## Multi user setup

Expand Down
2 changes: 1 addition & 1 deletion frontends/web/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const GRAFFITI_UTILS = [
},
{
name: "Server",
filename: "graffiti_v{}_server.py",
filename: "graffiti_v{}_server.pyz",
icon: "images/platforms/python.svg",
color: "#C9B44C",
},
Expand Down

0 comments on commit f469b7a

Please sign in to comment.