neuracore-types 1.0.0__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.
@@ -0,0 +1,18 @@
1
+ [bumpversion]
2
+ current_version = 1.0.0
3
+ commit = True
4
+ tag = True
5
+ tag_name = v{new_version}
6
+ message = Bump version to {new_version} [skip ci]
7
+
8
+ [bumpversion:file:pyproject.toml]
9
+ search = version = "{current_version}"
10
+ replace = version = "{new_version}"
11
+
12
+ [bumpversion:file:package.json]
13
+ search = "version": "{current_version}"
14
+ replace = "version": "{new_version}"
15
+
16
+ [bumpversion:file:neuracore_types/__init__.py]
17
+ search = __version__ = "{current_version}"
18
+ replace = __version__ = "{new_version}"
@@ -0,0 +1,39 @@
1
+ name: Check Label
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ check-version-label:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Check for version label
14
+ uses: actions/github-script@v7
15
+ with:
16
+ script: |
17
+ const pr = context.payload.pull_request;
18
+ const labels = pr.labels.map(label => label.name);
19
+
20
+ console.log('PR Labels:', labels);
21
+
22
+ // Define valid version labels
23
+ const versionLabels = [
24
+ 'version:major',
25
+ 'version:minor',
26
+ 'version:patch',
27
+ 'version:none'
28
+ ];
29
+
30
+ // Check for only one and return success or fail
31
+ const versionLabelCount = labels.filter(label => versionLabels.includes(label)).length;
32
+
33
+ if (versionLabelCount === 0) {
34
+ core.setFailed('PR is missing a version label. Please add one of: version:major, version:minor, version:patch, or version:none');
35
+ } else if (versionLabelCount > 1) {
36
+ core.setFailed('PR has multiple version labels. Please keep only one: version:major, version:minor, version:patch, or version:none');
37
+ } else {
38
+ console.log('✅ PR has a valid version label:', labels.filter(l => versionLabels.includes(l)));
39
+ }
@@ -0,0 +1,267 @@
1
+ name: Generate Types and Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ generate-types:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Checkout code
14
+ uses: actions/checkout@v4
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: '3.11'
20
+
21
+ - name: Set up Node.js
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version: '20'
25
+ registry-url: 'https://registry.npmjs.org'
26
+
27
+ - name: Install Python dependencies
28
+ run: |
29
+ pip install --upgrade pip
30
+ pip install -e ".[dev]"
31
+
32
+ - name: Install Node dependencies
33
+ run: npm install
34
+
35
+ - name: Generate TypeScript types
36
+ run: python scripts/generate_types.py
37
+
38
+ - name: Build TypeScript
39
+ run: npm run build
40
+
41
+ - name: Upload TypeScript artifacts
42
+ uses: actions/upload-artifact@v4
43
+ with:
44
+ name: typescript-types
45
+ path: dist/
46
+
47
+ check-version-bump:
48
+ needs: generate-types
49
+ runs-on: ubuntu-latest
50
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
51
+ permissions:
52
+ contents: read
53
+ pull-requests: read
54
+ outputs:
55
+ should_release: ${{ steps.check.outputs.should_release }}
56
+ bump_type: ${{ steps.check.outputs.bump_type }}
57
+ pr_number: ${{ steps.check.outputs.pr_number }}
58
+
59
+ steps:
60
+ - name: Checkout code
61
+ uses: actions/checkout@v4
62
+ with:
63
+ fetch-depth: 0
64
+
65
+ - name: Get merged PR labels
66
+ id: pr_labels
67
+ uses: actions/github-script@v7
68
+ with:
69
+ script: |
70
+ const commit = context.sha;
71
+
72
+ // Find the PR associated with this merge commit
73
+ const prs = await github.rest.repos.listPullRequestsAssociatedWithCommit({
74
+ owner: context.repo.owner,
75
+ repo: context.repo.repo,
76
+ commit_sha: commit
77
+ });
78
+
79
+ if (prs.data.length === 0) {
80
+ console.log('No PR found for this commit');
81
+ return { bump_type: 'none' };
82
+ }
83
+
84
+ // Define valid version labels
85
+ const versionLabels = [
86
+ 'version:major',
87
+ 'version:minor',
88
+ 'version:patch',
89
+ 'version:none'
90
+ ];
91
+
92
+ const pr = prs.data[0];
93
+ const firstLabel = pr.labels[0]?.name;
94
+ let bump_type = firstLabel.split(':')[1];
95
+ return { bump_type, pr_number: pr.number };
96
+
97
+ - name: Check if release needed
98
+ id: check
99
+ run: |
100
+ BUMP_TYPE="${{ fromJSON(steps.pr_labels.outputs.result).bump_type }}"
101
+ PR_NUMBER="${{ fromJSON(steps.pr_labels.outputs.result).pr_number }}"
102
+
103
+ if [ "$BUMP_TYPE" = "none" ] || [ -z "$BUMP_TYPE" ]; then
104
+ echo "No version bump label found - skipping release"
105
+ echo "should_release=false" >> $GITHUB_OUTPUT
106
+ echo "bump_type=none" >> $GITHUB_OUTPUT
107
+ else
108
+ echo "Version bump type: $BUMP_TYPE"
109
+ echo "should_release=true" >> $GITHUB_OUTPUT
110
+ echo "bump_type=$BUMP_TYPE" >> $GITHUB_OUTPUT
111
+ echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
112
+ fi
113
+
114
+ version-bump:
115
+ needs: check-version-bump
116
+ runs-on: ubuntu-latest
117
+ if: needs.check-version-bump.outputs.should_release == 'true'
118
+ permissions:
119
+ contents: write
120
+ pull-requests: read
121
+ outputs:
122
+ new_version: ${{ steps.bump.outputs.new_version }}
123
+
124
+ steps:
125
+ - name: Checkout code
126
+ uses: actions/checkout@v4
127
+ with:
128
+ fetch-depth: 0
129
+
130
+ - name: Set up Python
131
+ uses: actions/setup-python@v5
132
+ with:
133
+ python-version: '3.11'
134
+
135
+ - name: Set up Node.js
136
+ uses: actions/setup-node@v4
137
+ with:
138
+ node-version: '20'
139
+
140
+ - name: Install dependencies
141
+ run: |
142
+ pip install bump2version
143
+ npm install -g json
144
+
145
+ - name: Bump version
146
+ id: bump
147
+ run: |
148
+ BUMP_TYPE="${{ needs.check-version-bump.outputs.bump_type }}"
149
+
150
+ echo "Bumping $BUMP_TYPE version"
151
+
152
+ # Configure git
153
+ git config user.email "github-actions[bot]@users.noreply.github.com"
154
+ git config user.name "github-actions[bot]"
155
+
156
+ # Use bump2version to bump the version
157
+ bump2version $BUMP_TYPE --allow-dirty
158
+ NEW_VERSION=$(grep -m 1 'version = ' pyproject.toml | cut -d'"' -f2)
159
+
160
+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
161
+
162
+ git push origin main --tags
163
+
164
+ publish-python:
165
+ needs: version-bump
166
+ runs-on: ubuntu-latest
167
+
168
+ steps:
169
+ - name: Checkout code
170
+ uses: actions/checkout@v4
171
+ with:
172
+ ref: main
173
+ fetch-depth: 0
174
+
175
+ - name: Pull latest changes
176
+ run: |
177
+ git pull --tags
178
+
179
+ - name: Set up Python
180
+ uses: actions/setup-python@v5
181
+ with:
182
+ python-version: '3.11'
183
+
184
+ - name: Install build tools
185
+ run: |
186
+ pip install --upgrade pip
187
+ pip install build twine
188
+
189
+ - name: Build Python package
190
+ run: python -m build
191
+
192
+ - name: Publish to PyPI
193
+ env:
194
+ TWINE_USERNAME: __token__
195
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
196
+ run: twine upload dist/*
197
+
198
+ publish-npm:
199
+ needs: [version-bump, generate-types]
200
+ runs-on: ubuntu-latest
201
+
202
+ steps:
203
+ - name: Checkout code
204
+ uses: actions/checkout@v4
205
+ with:
206
+ ref: main
207
+ fetch-depth: 0
208
+
209
+ - name: Pull latest changes
210
+ run: |
211
+ git pull --tags
212
+
213
+ - name: Set up Node.js
214
+ uses: actions/setup-node@v4
215
+ with:
216
+ node-version: '20'
217
+ registry-url: 'https://registry.npmjs.org'
218
+
219
+ - name: Download TypeScript artifacts
220
+ uses: actions/download-artifact@v4
221
+ with:
222
+ name: typescript-types
223
+ path: dist/
224
+
225
+ - name: Publish to NPM
226
+ env:
227
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
228
+ run: npm publish
229
+
230
+ create-release:
231
+ needs: [version-bump, publish-python, publish-npm]
232
+ runs-on: ubuntu-latest
233
+
234
+ steps:
235
+ - name: Checkout code
236
+ uses: actions/checkout@v4
237
+ with:
238
+ ref: main
239
+ fetch-depth: 0
240
+
241
+ - name: Pull latest changes
242
+ run: |
243
+ git pull --tags
244
+
245
+ - name: Create GitHub Release
246
+ uses: actions/github-script@v7
247
+ with:
248
+ script: |
249
+ const version = '${{ needs.version-bump.outputs.new_version }}';
250
+
251
+ await github.rest.repos.createRelease({
252
+ owner: context.repo.owner,
253
+ repo: context.repo.repo,
254
+ tag_name: `v${version}`,
255
+ name: `Release v${version}`,
256
+ body: `## Release v${version}\n\n` +
257
+ `Published to:\n` +
258
+ `- PyPI: https://pypi.org/project/neuracore-types/${version}/\n` +
259
+ `- NPM: https://www.npmjs.com/package/@neuracore/types/v/${version}\n\n` +
260
+ `### Installation\n` +
261
+ `\`\`\`bash\n` +
262
+ `pip install neuracore-types==${version}\n` +
263
+ `npm install @neuracore/types@${version}\n` +
264
+ `\`\`\``,
265
+ draft: false,
266
+ prerelease: false
267
+ });
@@ -0,0 +1,41 @@
1
+ name: Pre-Commit Checks
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ push:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ pre-commit:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v4
17
+ with:
18
+ ref: ${{ github.event.inputs.ref || github.ref }}
19
+ - name: Setup Python
20
+ uses: actions/setup-python@v4
21
+ with:
22
+ python-version: '3.10'
23
+ - name: Pre-Commit
24
+ uses: pre-commit/action@v3.0.1
25
+
26
+ - name: Set up Node.js
27
+ uses: actions/setup-node@v4
28
+ with:
29
+ node-version: '20'
30
+ registry-url: 'https://registry.npmjs.org'
31
+
32
+ - name: Install Python dependencies
33
+ run: |
34
+ pip install --upgrade pip
35
+ pip install -e ".[dev]"
36
+
37
+ - name: Install Node dependencies
38
+ run: npm install
39
+
40
+ - name: Valide that we can generate TypeScript types
41
+ run: python scripts/generate_types.py
@@ -0,0 +1,55 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+ .pytest_cache/
24
+ .coverage
25
+ htmlcov/
26
+ .tox/
27
+ .venv
28
+ venv/
29
+ ENV/
30
+ env/
31
+
32
+ # Node
33
+ node_modules/
34
+ npm-debug.log*
35
+ yarn-debug.log*
36
+ yarn-error.log*
37
+ package-lock.json
38
+ yarn.lock
39
+ pnpm-lock.yaml
40
+
41
+ # TypeScript
42
+ dist/
43
+ *.tsbuildinfo
44
+
45
+ # IDEs
46
+ .vscode/
47
+ .idea/
48
+ *.swp
49
+ *.swo
50
+ *~
51
+ .DS_Store
52
+
53
+ # Generated files
54
+ typescript/neuracore_types.ts
55
+ typescript/index.ts
@@ -0,0 +1,20 @@
1
+ # Source files
2
+ typescript/
3
+ neuracore_types/
4
+ scripts/
5
+
6
+ # Python files
7
+ *.py
8
+ pyproject.toml
9
+ MANIFEST.in
10
+
11
+ # Config files
12
+ tsconfig.json
13
+ .github/
14
+
15
+ # Development
16
+ node_modules/
17
+ *.log
18
+
19
+ # Keep only dist
20
+ !dist/
@@ -0,0 +1,53 @@
1
+ default_install_hook_types: [pre-commit]
2
+ default_stages: [commit]
3
+
4
+ repos:
5
+ - repo: https://github.com/pycqa/isort
6
+ rev: 5.13.2
7
+ hooks:
8
+ - id: isort
9
+ args: ["--profile", "black", "--filter-files"]
10
+
11
+ - repo: https://github.com/psf/black
12
+ rev: 24.1.1
13
+ hooks:
14
+ - id: black
15
+ language_version: python3
16
+ args: [--line-length=88, --preview]
17
+
18
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
19
+ rev: v0.0.272
20
+ hooks:
21
+ - id: ruff
22
+ # Ignoring unused imports within __init__.py files.
23
+ args: [--per-file-ignores, "*__init__.py:F401", --fix]
24
+
25
+ - repo: https://github.com/pycqa/pydocstyle
26
+ rev: 6.3.0
27
+ hooks:
28
+ - id: pydocstyle
29
+ files: neuracore_types/
30
+ args: ["--convention=google"]
31
+
32
+ - repo: https://github.com/pre-commit/mirrors-mypy
33
+ rev: ""
34
+ hooks:
35
+ - id: mypy
36
+ files: neuracore_types/
37
+ args: ["--disallow-untyped-defs", "--ignore-missing-imports"]
38
+ additional_dependencies: [types-requests]
39
+
40
+ - repo: https://github.com/streetsidesoftware/cspell-cli
41
+ rev: v9.2.0
42
+ hooks:
43
+ - id: cspell # Spell check changed files
44
+ - id: cspell # Spell check the commit message
45
+ name: check commit message spelling
46
+ args:
47
+ - --no-must-find-files
48
+ - --no-progress
49
+ - --no-summary
50
+ - --files
51
+ - .git/COMMIT_EDITMSG
52
+ stages: [commit-msg]
53
+ always_run: true
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Neuracore
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: neuracore-types
3
+ Version: 1.0.0
4
+ Summary: Shared type definitions for Neuracore.
5
+ Author: Neuracore
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.10
9
+ Requires-Dist: numpy>=1.24.0
10
+ Requires-Dist: pydantic>=2.0.0
11
+ Provides-Extra: dev
12
+ Requires-Dist: pre-commit; extra == 'dev'
13
+ Requires-Dist: pydantic-to-typescript2>=1.0.0; extra == 'dev'
14
+ Description-Content-Type: text/markdown
15
+
16
+ # Neuracore Types
17
+
18
+ Shared type definitions for the Neuracore platform. This package maintains a single source of truth for data types in Python (Pydantic models) and automatically generates TypeScript types.
19
+
20
+ ## Overview
21
+
22
+ - **Python Package**: `neuracore-types` - Pydantic models for Python backend
23
+ - **NPM Package**: `@neuracore/types` - TypeScript types for frontend
24
+
25
+ ## Installation
26
+
27
+ ### Python
28
+
29
+ ```bash
30
+ pip install neuracore-types
31
+ ```
32
+
33
+ ### TypeScript/JavaScript
34
+
35
+ ```bash
36
+ npm install @neuracore/types
37
+ # or
38
+ yarn add @neuracore/types
39
+ # or
40
+ pnpm add @neuracore/types
41
+ ```
42
+
43
+ ## Development
44
+
45
+ ### Setup
46
+
47
+ ```bash
48
+ # Clone the repository
49
+ git clone https://github.com/neuracoreai/neuracore_types.git
50
+ cd neuracore_types
51
+
52
+ # Install Python dependencies
53
+ pip install -e ".[dev]"
54
+
55
+ # Install Node dependencies
56
+ npm install
57
+ ```
58
+
59
+ ### Generate TypeScript Types
60
+
61
+ The TypeScript types are automatically generated from the Python Pydantic models:
62
+
63
+ ```bash
64
+ npm install json-schema-to-typescript
65
+ python scripts/generate_types.py
66
+ ```
67
+
68
+ This will:
69
+ 1. Read the Pydantic models from `neuracore_types/neuracore_types.py`
70
+ 2. Generate TypeScript definitions in `typescript/neuracore_types.ts`
71
+ 3. Create an index file at `typescript/index.ts`
72
+
73
+ ### Build TypeScript Package
74
+
75
+ ```bash
76
+ npm run build
77
+ ```
78
+
79
+ This compiles the TypeScript files to JavaScript and generates type declarations in the `dist/` directory.
80
+
81
+ ## CI/CD
82
+
83
+ The repository includes GitHub Actions workflows that:
84
+
85
+ 1. **On every push to `main` or PR**:
86
+ - Automatically generates TypeScript types from Python models
87
+ - Builds and validates both packages
88
+ - Publishes Python package to PyPI
89
+ - Publishes NPM package to npm registry
@@ -0,0 +1,74 @@
1
+ # Neuracore Types
2
+
3
+ Shared type definitions for the Neuracore platform. This package maintains a single source of truth for data types in Python (Pydantic models) and automatically generates TypeScript types.
4
+
5
+ ## Overview
6
+
7
+ - **Python Package**: `neuracore-types` - Pydantic models for Python backend
8
+ - **NPM Package**: `@neuracore/types` - TypeScript types for frontend
9
+
10
+ ## Installation
11
+
12
+ ### Python
13
+
14
+ ```bash
15
+ pip install neuracore-types
16
+ ```
17
+
18
+ ### TypeScript/JavaScript
19
+
20
+ ```bash
21
+ npm install @neuracore/types
22
+ # or
23
+ yarn add @neuracore/types
24
+ # or
25
+ pnpm add @neuracore/types
26
+ ```
27
+
28
+ ## Development
29
+
30
+ ### Setup
31
+
32
+ ```bash
33
+ # Clone the repository
34
+ git clone https://github.com/neuracoreai/neuracore_types.git
35
+ cd neuracore_types
36
+
37
+ # Install Python dependencies
38
+ pip install -e ".[dev]"
39
+
40
+ # Install Node dependencies
41
+ npm install
42
+ ```
43
+
44
+ ### Generate TypeScript Types
45
+
46
+ The TypeScript types are automatically generated from the Python Pydantic models:
47
+
48
+ ```bash
49
+ npm install json-schema-to-typescript
50
+ python scripts/generate_types.py
51
+ ```
52
+
53
+ This will:
54
+ 1. Read the Pydantic models from `neuracore_types/neuracore_types.py`
55
+ 2. Generate TypeScript definitions in `typescript/neuracore_types.ts`
56
+ 3. Create an index file at `typescript/index.ts`
57
+
58
+ ### Build TypeScript Package
59
+
60
+ ```bash
61
+ npm run build
62
+ ```
63
+
64
+ This compiles the TypeScript files to JavaScript and generates type declarations in the `dist/` directory.
65
+
66
+ ## CI/CD
67
+
68
+ The repository includes GitHub Actions workflows that:
69
+
70
+ 1. **On every push to `main` or PR**:
71
+ - Automatically generates TypeScript types from Python models
72
+ - Builds and validates both packages
73
+ - Publishes Python package to PyPI
74
+ - Publishes NPM package to npm registry
@@ -0,0 +1,22 @@
1
+ {
2
+ "ignorePaths": [
3
+ "cSpell.json",
4
+ ".*",
5
+ "*.Dockerfile",
6
+ "docker-compose.yml",
7
+ "requirements*.txt",
8
+ "*.sh"
9
+ ],
10
+ "dictionaryDefinitions": [
11
+ {
12
+ "name": "neuracore-dictionary",
13
+ "path": "./neuracore-dictionary.txt",
14
+ "addWords": true
15
+ }
16
+ ],
17
+ "language": "en,en-GB",
18
+ "dictionaries": [
19
+ "neuracore-dictionary"
20
+ ],
21
+ "words": []
22
+ }