primitive 0.1.76__tar.gz → 0.1.78__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {primitive-0.1.76 → primitive-0.1.78}/PKG-INFO +4 -13
- {primitive-0.1.76 → primitive-0.1.78}/README.md +3 -12
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/__about__.py +1 -1
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/agent/process.py +25 -1
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/agent/runner.py +24 -29
- {primitive-0.1.76 → primitive-0.1.78}/uv.lock +1 -1
- {primitive-0.1.76 → primitive-0.1.78}/.git-hooks/pre-commit +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/.gitattributes +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/.github/workflows/lint.yml +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/.github/workflows/publish.yml +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/.gitignore +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/.vscode/settings.json +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/LICENSE.txt +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/Makefile +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/linux setup.md +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/pyproject.toml +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/agent/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/agent/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/agent/commands.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/agent/provision.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/agent/uploader.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/auth/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/auth/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/auth/commands.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/auth/graphql/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/auth/graphql/queries.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/cli.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/client.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/daemons/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/daemons/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/daemons/commands.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/daemons/launch_agents.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/daemons/launch_service.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/exec/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/exec/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/exec/commands.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/exec/interactive.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/files/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/files/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/files/commands.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/files/graphql/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/files/graphql/fragments.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/files/graphql/mutations.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/files/graphql/queries.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/git/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/git/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/git/commands.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/git/graphql/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/git/graphql/queries.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/graphql/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/graphql/relay.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/graphql/sdk.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/graphql/utility_fragments.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/hardware/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/hardware/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/hardware/commands.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/hardware/graphql/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/hardware/graphql/fragments.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/hardware/graphql/mutations.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/hardware/graphql/queries.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/jobs/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/jobs/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/jobs/commands.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/jobs/graphql/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/jobs/graphql/fragments.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/jobs/graphql/mutations.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/jobs/graphql/queries.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/organizations/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/organizations/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/organizations/commands.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/organizations/graphql/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/organizations/graphql/fragments.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/organizations/graphql/mutations.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/organizations/graphql/queries.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/projects/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/projects/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/projects/commands.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/projects/graphql/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/projects/graphql/fragments.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/projects/graphql/mutations.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/projects/graphql/queries.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/provisioning/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/provisioning/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/provisioning/graphql/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/provisioning/graphql/queries.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/reservations/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/reservations/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/reservations/commands.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/reservations/graphql/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/reservations/graphql/fragments.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/reservations/graphql/mutations.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/reservations/graphql/queries.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/__init__.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/actions.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/auth.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/cache.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/chunk_size.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/config.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/files.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/git.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/memory_size.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/printer.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/shell.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/src/primitive/utils/verible.py +0 -0
- {primitive-0.1.76 → primitive-0.1.78}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: primitive
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.78
|
4
4
|
Project-URL: Documentation, https://github.com//primitivecorp/primitive-cli#readme
|
5
5
|
Project-URL: Issues, https://github.com//primitivecorp/primitive-cli/issues
|
6
6
|
Project-URL: Source, https://github.com//primitivecorp/primitive-cli
|
@@ -98,19 +98,10 @@ git config --global user.name “<firstName lastName>”
|
|
98
98
|
brew install make
|
99
99
|
fish_add_path /opt/homebrew/opt/make/libexec/gnubin
|
100
100
|
|
101
|
-
# install pyenv (python version manager)
|
102
|
-
brew install pyenv
|
103
|
-
set -Ux PYENV_ROOT $HOME/.pyenv
|
104
|
-
fish_add_path $PYENV_ROOT/bin
|
105
|
-
echo 'pyenv init - | source' >> ~/.config/fish/config.fish
|
106
|
-
|
107
|
-
# install the latest version of python
|
108
|
-
pyenv install 3.12.2
|
109
|
-
pyenv global 3.12.2
|
110
|
-
pip install --upgrade pip
|
111
|
-
|
112
101
|
# install uv
|
113
|
-
|
102
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
103
|
+
uv python install
|
104
|
+
fish_add_path "$(uv python dir)/bin"
|
114
105
|
```
|
115
106
|
|
116
107
|
### Repository Setup
|
@@ -69,19 +69,10 @@ git config --global user.name “<firstName lastName>”
|
|
69
69
|
brew install make
|
70
70
|
fish_add_path /opt/homebrew/opt/make/libexec/gnubin
|
71
71
|
|
72
|
-
# install pyenv (python version manager)
|
73
|
-
brew install pyenv
|
74
|
-
set -Ux PYENV_ROOT $HOME/.pyenv
|
75
|
-
fish_add_path $PYENV_ROOT/bin
|
76
|
-
echo 'pyenv init - | source' >> ~/.config/fish/config.fish
|
77
|
-
|
78
|
-
# install the latest version of python
|
79
|
-
pyenv install 3.12.2
|
80
|
-
pyenv global 3.12.2
|
81
|
-
pip install --upgrade pip
|
82
|
-
|
83
72
|
# install uv
|
84
|
-
|
73
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
74
|
+
uv python install
|
75
|
+
fish_add_path "$(uv python dir)/bin"
|
85
76
|
```
|
86
77
|
|
87
78
|
### Repository Setup
|
@@ -1,7 +1,11 @@
|
|
1
|
+
from typing import List
|
2
|
+
from pathlib import Path
|
1
3
|
from subprocess import Popen, PIPE
|
2
4
|
import shlex
|
5
|
+
import glob
|
3
6
|
import selectors
|
4
7
|
from loguru import logger
|
8
|
+
from abc import abstractmethod
|
5
9
|
|
6
10
|
|
7
11
|
class Process:
|
@@ -11,7 +15,9 @@ class Process:
|
|
11
15
|
env,
|
12
16
|
workdir: str = ".",
|
13
17
|
):
|
14
|
-
self.cmd =
|
18
|
+
self.cmd = Process.expand_glob_in_cmd(
|
19
|
+
cmd_parts=shlex.split(cmd), workdir=workdir
|
20
|
+
)
|
15
21
|
self.env = env
|
16
22
|
self.workdir = workdir
|
17
23
|
self.process = None
|
@@ -90,6 +96,24 @@ class Process:
|
|
90
96
|
if self.process:
|
91
97
|
self.process.kill()
|
92
98
|
|
99
|
+
@abstractmethod
|
100
|
+
def expand_glob_in_cmd(cmd_parts: List[str], workdir: Path):
|
101
|
+
# Characters that indicate a glob pattern
|
102
|
+
glob_chars = {"*", "?", "[", "]", "{", "}"}
|
103
|
+
expanded_cmd = []
|
104
|
+
for part in cmd_parts:
|
105
|
+
if any(c in part for c in glob_chars):
|
106
|
+
matches = glob.glob(str(workdir / part))
|
107
|
+
if matches:
|
108
|
+
expanded_cmd.extend(
|
109
|
+
[str(Path(match).relative_to(workdir)) for match in matches]
|
110
|
+
)
|
111
|
+
else:
|
112
|
+
expanded_cmd.append(part)
|
113
|
+
else:
|
114
|
+
expanded_cmd.append(part)
|
115
|
+
return expanded_cmd
|
116
|
+
|
93
117
|
@property
|
94
118
|
def errors(self) -> int:
|
95
119
|
return self._errors
|
@@ -48,7 +48,6 @@ class AgentRunner:
|
|
48
48
|
job_slug: str,
|
49
49
|
max_log_size: int = 10 * 1024 * 1024,
|
50
50
|
log_to_file: bool = True,
|
51
|
-
job: Optional[JobDescription] = None,
|
52
51
|
) -> None:
|
53
52
|
self.primitive = primitive
|
54
53
|
self.source_dir = source_dir
|
@@ -69,37 +68,33 @@ class AgentRunner:
|
|
69
68
|
format=AgentRunner.log_serializer(),
|
70
69
|
)
|
71
70
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
yaml_file = Path(self.source_dir / ".primitive" / f"{self.job_slug}.yaml")
|
76
|
-
yml_file = Path(self.source_dir / ".primitive" / f"{self.job_slug}.yml")
|
71
|
+
logger.info(f"Scanning directory for job file {self.job_slug}")
|
72
|
+
yaml_file = Path(self.source_dir / ".primitive" / f"{self.job_slug}.yaml")
|
73
|
+
yml_file = Path(self.source_dir / ".primitive" / f"{self.job_slug}.yml")
|
77
74
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
if yaml_file.exists():
|
88
|
-
self.job = yaml.load(open(yaml_file, "r"), Loader=Loader)
|
89
|
-
elif yml_file.exists():
|
90
|
-
self.job = yaml.load(open(yml_file, "r"), Loader=Loader)
|
91
|
-
else:
|
92
|
-
logger.error(
|
93
|
-
f"No job description with matching slug '{self.job_slug}' found"
|
94
|
-
)
|
95
|
-
self.primitive.jobs.job_run_update(
|
96
|
-
self.job_id, status="request_completed", conclusion="failure"
|
97
|
-
)
|
98
|
-
raise FileNotFoundError
|
75
|
+
if yaml_file.exists() and yml_file.exists():
|
76
|
+
logger.error(
|
77
|
+
f"Found two job descriptions with the same slug: {self.job_slug}"
|
78
|
+
)
|
79
|
+
self.primitive.jobs.job_run_update(
|
80
|
+
self.job_id, status="request_completed", conclusion="failure"
|
81
|
+
)
|
82
|
+
raise FileExistsError
|
99
83
|
|
100
|
-
|
84
|
+
if yaml_file.exists():
|
85
|
+
self.job = yaml.load(open(yaml_file, "r"), Loader=Loader)
|
86
|
+
elif yml_file.exists():
|
87
|
+
self.job = yaml.load(open(yml_file, "r"), Loader=Loader)
|
101
88
|
else:
|
102
|
-
|
89
|
+
logger.error(
|
90
|
+
f"No job description with matching slug '{self.job_slug}' found"
|
91
|
+
)
|
92
|
+
self.primitive.jobs.job_run_update(
|
93
|
+
self.job_id, status="request_completed", conclusion="failure"
|
94
|
+
)
|
95
|
+
raise FileNotFoundError
|
96
|
+
|
97
|
+
logger.info(f"Found job description for {self.job_slug}")
|
103
98
|
|
104
99
|
@staticmethod
|
105
100
|
def log_serializer() -> Callable:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|