Skip to content

Commit cc99dcf

Browse files
committed
test python
Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
1 parent a715b52 commit cc99dcf

11 files changed

Lines changed: 843 additions & 212 deletions

File tree

.gitattributes

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
/dagger.gen.go linguist-generated
2-
/internal/dagger/** linguist-generated
3-
/internal/querybuilder/** linguist-generated
4-
/internal/telemetry/** linguist-generated
1+
/sdk/** linguist-generated

.github/workflows/dagger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
with:
1616
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
1717
verb: call
18-
args: test --dir .
18+
args: verify-directory-file-caching --directory .

.gitignore

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,4 @@
1-
# If you prefer the allow list template instead of the deny list, see community template:
2-
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3-
#
4-
# Binaries for programs and plugins
5-
*.exe
6-
*.exe~
7-
*.dll
8-
*.so
9-
*.dylib
10-
11-
# Test binary, built with `go test -c`
12-
*.test
13-
14-
# Output of the go coverage tool, specifically when used with LiteIDE
15-
*.out
16-
17-
# Dependency directories (remove the comment below to include it)
18-
# vendor/
19-
20-
# Go workspace file
21-
go.work
22-
go.work.sum
23-
24-
# env file
25-
.env
26-
/dagger.gen.go
27-
/internal/dagger
28-
/internal/querybuilder
29-
/internal/telemetry
1+
/.venv
2+
/**/__pycache__
3+
/sdk
4+
/.env

dagger.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "sam-dev",
33
"engineVersion": "v0.19.8",
44
"sdk": {
5-
"source": "go"
5+
"source": "python"
66
}
77
}

go.mod

Lines changed: 0 additions & 50 deletions
This file was deleted.

go.sum

Lines changed: 0 additions & 89 deletions
This file was deleted.

main.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[project]
2+
name = "sam-dev"
3+
version = "0.1.0"
4+
requires-python = ">=3.13"
5+
dependencies = ["dagger-io"]
6+
7+
[build-system]
8+
requires = ["uv_build>=0.8.4,<0.9.0"]
9+
build-backend = "uv_build"
10+
11+
[tool.uv.sources]
12+
dagger-io = { path = "sdk", editable = true }

src/sam_dev/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""A generated module for SamDev functions
2+
3+
This module has been generated via dagger init and serves as a reference to
4+
basic module structure as you get started with Dagger.
5+
6+
Two functions have been pre-created. You can modify, delete, or add to them,
7+
as needed. They demonstrate usage of arguments and return types using simple
8+
echo and grep commands. The functions can be called from the dagger CLI or
9+
from one of the SDKs.
10+
11+
The first line in this comment block is a short description line and the
12+
rest is a long description with more detail on the module's purpose or usage,
13+
if appropriate. All modules should have a short description.
14+
"""
15+
16+
from .main import SamDev as SamDev

src/sam_dev/main.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from typing import Annotated
2+
3+
import dagger
4+
from dagger import dag, function, object_type
5+
6+
7+
@object_type
8+
class SamDev:
9+
rootDir: Annotated[
10+
dagger.Directory,
11+
dagger.DefaultPath("."),
12+
]
13+
14+
@function(cache="never")
15+
async def verify_directory_file_caching(
16+
self,
17+
directory: Annotated[
18+
dagger.Directory,
19+
dagger.Ignore(
20+
[
21+
".env",
22+
".git",
23+
"**/.venv",
24+
"**__pycache__**",
25+
".dagger/sdk",
26+
"**/.pytest_cache",
27+
"**/.ruff_cache",
28+
"**/node_modules",
29+
"**/.evidence",
30+
]
31+
),
32+
dagger.DefaultPath("."),
33+
],
34+
) -> str:
35+
"""Verifies that a file is cached"""
36+
return (
37+
await dag.container()
38+
.from_("alpine")
39+
.with_file("/file", directory.file("dagger.json"))
40+
.with_exec(["cat", "/file"])
41+
.stdout()
42+
)

0 commit comments

Comments
 (0)