-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.pixi/ | ||
output/ | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Webserver | ||
|
||
This is a simple web server that runs FastAPI. | ||
|
||
## Run the server | ||
|
||
```bash | ||
rattler-build build -r recipe/recipe.yaml | ||
pixi-pack pack -e prod --platform win-64 --inject output/noarch/my-webserver-*.conda | ||
``` | ||
|
||
> [!NOTE] | ||
> The file `my-webserver-0.1.0-pyh4616a5c_0.conda` is only for testing, in a real scenario it would be in the `output/noarch` directory generated by `rattler-build`. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from fastapi import FastAPI | ||
|
||
app = FastAPI() | ||
|
||
|
||
@app.get("/") | ||
def hello(): | ||
return "Hello, World!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[project] | ||
name = "pixi-docker-example" | ||
channels = ["conda-forge"] | ||
platforms = ["osx-arm64", "linux-64", "linux-aarch64", "win-64"] | ||
|
||
[tasks] | ||
dev = "uvicorn my_project:app --reload" | ||
start = "uvicorn my_project:app --host 0.0.0.0" | ||
|
||
[dependencies] | ||
fastapi = "*" | ||
uvicorn = "*" | ||
|
||
[feature.dev.dependencies] | ||
pytest = "*" | ||
ruff = "*" | ||
mypy = "*" | ||
|
||
[environments] | ||
default = { features = ["dev"], solve-group = "prod" } | ||
prod = { features = [], solve-group = "prod" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "my-webserver" | ||
description = "Example web server" | ||
version = "0.1.0" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.12", | ||
] | ||
requires-python = ">=3.12" | ||
# pixi handles the dependencies | ||
# since we don't want to distribute this to pypi, we don't need to specify them here | ||
dependencies = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json | ||
|
||
package: | ||
name: my-webserver | ||
version: '0.1.0' | ||
|
||
source: | ||
path: ../ | ||
|
||
build: | ||
number: 0 | ||
noarch: python | ||
script: | ||
- python -m pip install . --no-deps --ignore-installed -vv --no-build-isolation --disable-pip-version-check | ||
|
||
requirements: | ||
host: | ||
- python >=3.12 | ||
- pip | ||
- hatchling | ||
run: | ||
- python >=3.12 | ||
- fastapi | ||
|
||
tests: | ||
- python: | ||
imports: | ||
- my_webserver | ||
- package_contents: | ||
site_packages: | ||
- my_webserver/__init__.py |