primitive 0.1.31__py3-none-any.whl → 0.1.32__py3-none-any.whl
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/__about__.py +1 -1
- primitive/sim/actions.py +8 -77
- primitive-0.1.32.dist-info/METADATA +142 -0
- {primitive-0.1.31.dist-info → primitive-0.1.32.dist-info}/RECORD +7 -7
- primitive-0.1.31.dist-info/METADATA +0 -62
- {primitive-0.1.31.dist-info → primitive-0.1.32.dist-info}/WHEEL +0 -0
- {primitive-0.1.31.dist-info → primitive-0.1.32.dist-info}/entry_points.txt +0 -0
- {primitive-0.1.31.dist-info → primitive-0.1.32.dist-info}/licenses/LICENSE.txt +0 -0
primitive/__about__.py
CHANGED
primitive/sim/actions.py
CHANGED
@@ -5,11 +5,9 @@ import subprocess
|
|
5
5
|
from typing import Tuple
|
6
6
|
from ..utils.files import find_files_for_extension
|
7
7
|
import os
|
8
|
-
from .vcd import TokenKind, tokenize
|
9
|
-
import io
|
10
|
-
from collections import defaultdict
|
11
8
|
import json
|
12
9
|
import xml.etree.ElementTree as ET
|
10
|
+
from primitive_pal import process_vcd
|
13
11
|
|
14
12
|
|
15
13
|
class Sim(BaseAction):
|
@@ -50,10 +48,12 @@ class Sim(BaseAction):
|
|
50
48
|
return file_upload_response.json()["data"]["fileUpload"]["id"]
|
51
49
|
|
52
50
|
def collect_artifacts(self, source: Path, job_run_id: str) -> None:
|
53
|
-
# Parse VCD artifacts
|
54
|
-
#
|
55
|
-
#
|
56
|
-
|
51
|
+
# Parse VCD artifacts using rust binding
|
52
|
+
# TODO: eventually make this smarter, only parsing VCDs for failed tests
|
53
|
+
# For now we're uploading the last 10 MB of all VCD files
|
54
|
+
files = find_files_for_extension(source, ".vcd")
|
55
|
+
for file in files:
|
56
|
+
process_vcd(path=file)
|
57
57
|
|
58
58
|
# Parse XML artifacts
|
59
59
|
files = find_files_for_extension(source, "results.xml")
|
@@ -65,7 +65,7 @@ class Sim(BaseAction):
|
|
65
65
|
file_ids = []
|
66
66
|
files = find_files_for_extension(
|
67
67
|
source, # ("results.xml", ".vcd", ".vcd.json", ".xml.json")
|
68
|
-
("results.xml", ".xml.json"),
|
68
|
+
("results.xml", ".xml.json", ".vcd.json", ".vcd.parquet"),
|
69
69
|
)
|
70
70
|
for file_path in files:
|
71
71
|
try:
|
@@ -128,72 +128,3 @@ class Sim(BaseAction):
|
|
128
128
|
data_path = path.parent / f"{path.name}.json"
|
129
129
|
with open(data_path, "w") as f:
|
130
130
|
f.write(json.dumps(parsed_results))
|
131
|
-
|
132
|
-
def parse_vcd(self, path: Path) -> None:
|
133
|
-
logger.debug("Parsing VCD file...")
|
134
|
-
with open(path, "rb") as f:
|
135
|
-
tokens = tokenize(io.BytesIO(f.read()))
|
136
|
-
|
137
|
-
metadata = defaultdict(dict)
|
138
|
-
header = defaultdict(dict)
|
139
|
-
data = defaultdict(list)
|
140
|
-
|
141
|
-
active_scope = header
|
142
|
-
previous_scope = None
|
143
|
-
|
144
|
-
current_time = 0
|
145
|
-
|
146
|
-
for token in tokens:
|
147
|
-
match token.kind:
|
148
|
-
case TokenKind.TIMESCALE:
|
149
|
-
metadata["timescaleUnit"] = token.data.unit.value
|
150
|
-
metadata["timescaleMagnitude"] = token.data.magnitude.value
|
151
|
-
case TokenKind.SCOPE:
|
152
|
-
scope_type = str(token.data.type_)
|
153
|
-
scope_ident = token.data.ident
|
154
|
-
key = f"{scope_type}:{scope_ident}"
|
155
|
-
active_scope[key] = {}
|
156
|
-
|
157
|
-
previous_scope = active_scope
|
158
|
-
active_scope = active_scope[key]
|
159
|
-
case TokenKind.UPSCOPE:
|
160
|
-
active_scope = previous_scope
|
161
|
-
case TokenKind.VAR:
|
162
|
-
active_scope[token.data.id_code] = {
|
163
|
-
"id_code": token.data.id_code,
|
164
|
-
"var_type": str(token.data.type_),
|
165
|
-
"var_size": token.data.size,
|
166
|
-
"reference": token.data.reference,
|
167
|
-
"bit_index": str(token.data.bit_index),
|
168
|
-
}
|
169
|
-
case TokenKind.CHANGE_TIME:
|
170
|
-
current_time = int(token.data)
|
171
|
-
case TokenKind.CHANGE_SCALAR:
|
172
|
-
data[token.data.id_code].append(
|
173
|
-
(str(current_time), str(token.data.value))
|
174
|
-
)
|
175
|
-
case TokenKind.CHANGE_VECTOR:
|
176
|
-
data[token.data.id_code].append(
|
177
|
-
(str(current_time), str(token.data.value))
|
178
|
-
)
|
179
|
-
|
180
|
-
# Add traces and write files
|
181
|
-
logger.debug("Writing traces...")
|
182
|
-
|
183
|
-
# Find name of file for json dumps
|
184
|
-
file_name = path.name.split(".")[0]
|
185
|
-
|
186
|
-
# Write metadata file
|
187
|
-
metadata_path = path.parent / f"{file_name}.metadata.vcd.json"
|
188
|
-
with open(metadata_path, "w") as f:
|
189
|
-
f.write(json.dumps(metadata))
|
190
|
-
|
191
|
-
# Write header file
|
192
|
-
header_path = path.parent / f"{file_name}.header.vcd.json"
|
193
|
-
with open(header_path, "w") as f:
|
194
|
-
f.write(json.dumps(header))
|
195
|
-
|
196
|
-
# Write data file
|
197
|
-
data_path = path.parent / f"{file_name}.data.vcd.json"
|
198
|
-
with open(data_path, "w") as f:
|
199
|
-
f.write(json.dumps(data))
|
@@ -0,0 +1,142 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: primitive
|
3
|
+
Version: 0.1.32
|
4
|
+
Project-URL: Documentation, https://github.com//primitivecorp/primitive-cli#readme
|
5
|
+
Project-URL: Issues, https://github.com//primitivecorp/primitive-cli/issues
|
6
|
+
Project-URL: Source, https://github.com//primitivecorp/primitive-cli
|
7
|
+
Author-email: Dylan Stein <dylan@primitive.tech>, Chase Zimmerman <chase@primitive.tech>
|
8
|
+
License-Expression: MIT
|
9
|
+
License-File: LICENSE.txt
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
11
|
+
Classifier: Programming Language :: Python
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
18
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
20
|
+
Requires-Python: >=3.11
|
21
|
+
Requires-Dist: click
|
22
|
+
Requires-Dist: gql[all]
|
23
|
+
Requires-Dist: loguru
|
24
|
+
Requires-Dist: primitive-pal==0.1.2
|
25
|
+
Requires-Dist: pyyaml
|
26
|
+
Description-Content-Type: text/markdown
|
27
|
+
|
28
|
+
# primitive
|
29
|
+
|
30
|
+
[](https://pypi.org/project/primitive)
|
31
|
+
[](https://pypi.org/project/primitive)
|
32
|
+
|
33
|
+
---
|
34
|
+
|
35
|
+
**Table of Contents**
|
36
|
+
|
37
|
+
- [Installation](#installation)
|
38
|
+
- [Configuration](#configuration)
|
39
|
+
- [License](#license)
|
40
|
+
- [Development Setup](#development-setup)
|
41
|
+
|
42
|
+
## Installation
|
43
|
+
|
44
|
+
```console
|
45
|
+
pip install primitive
|
46
|
+
```
|
47
|
+
|
48
|
+
## Configuration
|
49
|
+
|
50
|
+
### Authenticate
|
51
|
+
|
52
|
+
```console
|
53
|
+
primitive config
|
54
|
+
```
|
55
|
+
|
56
|
+
### Register your Hardware
|
57
|
+
|
58
|
+
```console
|
59
|
+
primitive hardware register
|
60
|
+
```
|
61
|
+
|
62
|
+
## License
|
63
|
+
|
64
|
+
`primitive` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
65
|
+
|
66
|
+
## Development Setup
|
67
|
+
|
68
|
+
For Primitive engineers, you may have these steps completed.
|
69
|
+
|
70
|
+
### Python Setup
|
71
|
+
|
72
|
+
```bash
|
73
|
+
# install required libs for macos
|
74
|
+
xcode-select --install
|
75
|
+
|
76
|
+
# install brew
|
77
|
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
78
|
+
|
79
|
+
# install fish
|
80
|
+
brew install fish
|
81
|
+
echo /usr/local/bin/fish | sudo tee -a /etc/shells
|
82
|
+
chsh -s /usr/local/bin/fish
|
83
|
+
|
84
|
+
# install fisher
|
85
|
+
brew install fisher
|
86
|
+
fisher install jorgebucaran/nvm.fish
|
87
|
+
|
88
|
+
# install git
|
89
|
+
brew install git
|
90
|
+
|
91
|
+
# set global info
|
92
|
+
git config --global user.email "<user@email.com>"
|
93
|
+
git config --global user.name “<firstName lastName>”
|
94
|
+
|
95
|
+
# install make
|
96
|
+
brew install make
|
97
|
+
fish_add_path /opt/homebrew/opt/make/libexec/gnubin
|
98
|
+
|
99
|
+
# install pyenv (python version manager)
|
100
|
+
brew install pyenv
|
101
|
+
set -Ux PYENV_ROOT $HOME/.pyenv
|
102
|
+
fish_add_path $PYENV_ROOT/bin
|
103
|
+
echo 'pyenv init - | source' >> ~/.config/fish/config.fish
|
104
|
+
|
105
|
+
# install the latest version of python
|
106
|
+
pyenv install 3.12.2
|
107
|
+
pyenv global 3.12.2
|
108
|
+
pip install --upgrade pip
|
109
|
+
|
110
|
+
# install uv
|
111
|
+
pip install uv
|
112
|
+
```
|
113
|
+
|
114
|
+
### Repository Setup
|
115
|
+
|
116
|
+
Clone and run setup.
|
117
|
+
|
118
|
+
```bash
|
119
|
+
cd ~/Development/primitivecorp/
|
120
|
+
git clone git@github.com:primitivecorp/primitive-cli.git
|
121
|
+
cd primitive-cli
|
122
|
+
make setup
|
123
|
+
```
|
124
|
+
|
125
|
+
With the backend and frontend development environments running, configure the CLI for local use.
|
126
|
+
|
127
|
+
```bash
|
128
|
+
# bash or zsh
|
129
|
+
source .venv/bin/activate
|
130
|
+
# fish
|
131
|
+
source .venv/bin/activate.fish
|
132
|
+
|
133
|
+
primitive --host localhost:8000 config --transport http
|
134
|
+
Username []: <username> # find this on the frontend app at [http://localhost:3000](http://localhost:3000)
|
135
|
+
You can find or create a Primitive API token at http://localhost:3000/account/tokens
|
136
|
+
Please enter your Primitive API token: # create a token and copy the value here
|
137
|
+
Config created at '/Users/<user>/.config/primitive/credentials.json' for user '<username>' on host 'localhost:8000'
|
138
|
+
|
139
|
+
# verify the configuration worked via
|
140
|
+
primitive --host localhost:8000 whoami
|
141
|
+
Logged in as <username>
|
142
|
+
```
|
@@ -1,4 +1,4 @@
|
|
1
|
-
primitive/__about__.py,sha256=
|
1
|
+
primitive/__about__.py,sha256=pW4XzdTfxu0TxCtn8UZLXalMXeW_jaVura_VZn0-p_0,130
|
2
2
|
primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
|
3
3
|
primitive/cli.py,sha256=VQPSewC6ouGdEG9W1gllawGJTydpOY0Lzg7LURXcqQg,2374
|
4
4
|
primitive/client.py,sha256=SFPG4H2wJao8euGdnYp-l7dk_fDpWeVn2aT2WNJUAqo,2370
|
@@ -30,7 +30,7 @@ primitive/projects/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
30
30
|
primitive/projects/actions.py,sha256=xhebDUMN9DXWvngWJyJkiijghbZwffy-JIPSsOg8agE,2061
|
31
31
|
primitive/projects/commands.py,sha256=Fqqgpi4cm6zOgkHK--0F0hiiIj32BmgZ-h1MydmWwdE,464
|
32
32
|
primitive/sim/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
|
-
primitive/sim/actions.py,sha256=
|
33
|
+
primitive/sim/actions.py,sha256=oU6JT37MU8BQOutyLudtgcyKkGUvDrDdCYLnX5ROsDI,4884
|
34
34
|
primitive/sim/commands.py,sha256=8PaOfL1MO6qxTn7mNVRnBU1X2wa3gk_mlbAhBW6MnI0,591
|
35
35
|
primitive/sim/vcd.py,sha256=mAbGnKWM0qzIUMkuSmO0p3sU25kOqbl31mvCsDSrXeM,22221
|
36
36
|
primitive/utils/actions.py,sha256=HOFrmM3-0A_A3NS84MqrZ6JmQEiiPSoDqEeuu6b_qfQ,196
|
@@ -42,8 +42,8 @@ primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,37
|
|
42
42
|
primitive/utils/shell.py,sha256=-7UjQaBqSGHzEEyX8pNjeYFFP0P3lVnDV0OkgPz1qHU,1050
|
43
43
|
primitive/utils/verible.py,sha256=QYczN1IvxODfj4jeq0nqjFuF0Oi0Zdx-Q32ySOJgcw8,2205
|
44
44
|
primitive/utils/yaml.py,sha256=4UP_9MXHoNb9_SCeUDm9xqYg9sHltqpVhNgsY6GNfb8,527
|
45
|
-
primitive-0.1.
|
46
|
-
primitive-0.1.
|
47
|
-
primitive-0.1.
|
48
|
-
primitive-0.1.
|
49
|
-
primitive-0.1.
|
45
|
+
primitive-0.1.32.dist-info/METADATA,sha256=Uu1RVtKipOgFjR2PyaBrrbnn-BHoP4nkYK8t5M-Ueu4,3782
|
46
|
+
primitive-0.1.32.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
47
|
+
primitive-0.1.32.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
|
48
|
+
primitive-0.1.32.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
|
49
|
+
primitive-0.1.32.dist-info/RECORD,,
|
@@ -1,62 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.3
|
2
|
-
Name: primitive
|
3
|
-
Version: 0.1.31
|
4
|
-
Project-URL: Documentation, https://github.com//primitivecorp/primitive-cli#readme
|
5
|
-
Project-URL: Issues, https://github.com//primitivecorp/primitive-cli/issues
|
6
|
-
Project-URL: Source, https://github.com//primitivecorp/primitive-cli
|
7
|
-
Author-email: Dylan Stein <dylan@primitive.tech>, Chase Zimmerman <chase@primitive.tech>
|
8
|
-
License-Expression: MIT
|
9
|
-
License-File: LICENSE.txt
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
11
|
-
Classifier: Programming Language :: Python
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
13
|
-
Classifier: Programming Language :: Python :: 3.8
|
14
|
-
Classifier: Programming Language :: Python :: 3.9
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
18
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
19
|
-
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
20
|
-
Requires-Python: >=3.11
|
21
|
-
Requires-Dist: click
|
22
|
-
Requires-Dist: gql[all]
|
23
|
-
Requires-Dist: loguru
|
24
|
-
Requires-Dist: pyyaml
|
25
|
-
Description-Content-Type: text/markdown
|
26
|
-
|
27
|
-
# primitive
|
28
|
-
|
29
|
-
[](https://pypi.org/project/primitive-cli)
|
30
|
-
[](https://pypi.org/project/primitive-cli)
|
31
|
-
|
32
|
-
---
|
33
|
-
|
34
|
-
**Table of Contents**
|
35
|
-
|
36
|
-
- [Installation](#installation)
|
37
|
-
- [Configuration](#configuration)
|
38
|
-
- [License](#license)
|
39
|
-
|
40
|
-
## Installation
|
41
|
-
|
42
|
-
```console
|
43
|
-
pip install primitive
|
44
|
-
```
|
45
|
-
|
46
|
-
## Configuration
|
47
|
-
|
48
|
-
### Authenticate
|
49
|
-
|
50
|
-
```console
|
51
|
-
primitive config
|
52
|
-
```
|
53
|
-
|
54
|
-
### Register your Hardware
|
55
|
-
|
56
|
-
```console
|
57
|
-
primitive hardware register
|
58
|
-
```
|
59
|
-
|
60
|
-
## License
|
61
|
-
|
62
|
-
`primitive` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
File without changes
|
File without changes
|
File without changes
|