-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
134 changed files
with
9,253 additions
and
1 deletion.
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,17 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Virtual environments | ||
venv*/ | ||
.venv*/ | ||
|
||
# IDEA Stuff | ||
.idea/ | ||
|
||
# Local stuff | ||
/proto/ | ||
/build/ | ||
/tests/res/build/ | ||
!/tests/res/build/empty.txt |
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,18 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
|
||
## [5.0.0] - 2024-04-15 | ||
|
||
### Changed | ||
|
||
- Moved this entire project over to Github | ||
- Bumped the version in order to not confuse older stuff that doesn't expect | ||
protoplasm to exist in Pypi.org (if we end up migriting this there and | ||
just open-sourcing the whole thing) | ||
- Also in case something changes in the API while migrating, cause I tend | ||
to fiddle with the code and tidy up and refactor when moving stuff |
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022-2024 CCP Games | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -1 +1,48 @@ | ||
# neobuilder | ||
# NeoBuilder | ||
|
||
Builds Neobuf Packages from Protobuf files using Protoplasm! :D | ||
|
||
## Useful info | ||
|
||
Installing this package creates a command line executable called `neobuild` (or | ||
`neobuild.exe` in Windows) in Python's `Scripts` folder so you just run the | ||
`neobuild` command from a console. | ||
|
||
## Usage | ||
|
||
Assuming you've got a package called `sandbox` and you're storing your protobuf | ||
files in a directory called `proto` and you want to spit out the build into the | ||
directory `build` just go: | ||
|
||
``` | ||
neobuild sandbox | ||
``` | ||
|
||
## Versioning Your Package | ||
|
||
If you place a plain text file called `VERSION` in the root of your proto | ||
package (e.g. `/proto/sandbox/VERSION` from the example above) and skip any | ||
versioning parameters (the `--major`, `-m`, `--patch` and `-p` guys) Neobuilder | ||
will use that file for versioning. | ||
|
||
The first line in the file should be the semantic version number `x.y.z.a` | ||
|
||
## More stuff | ||
|
||
``` | ||
usage: neobuild [-h] [-m | -p] [-b [BUILDROOT]] [-v] package [protopath] | ||
Builds neobuf packages with protoplasm. | ||
positional arguments: | ||
package Package name | ||
protopath Path to the root of the protobuf files (default="./proto") | ||
options: | ||
-h, --help show this help message and exit | ||
-m, --major Bump the major version number instead of the minor | ||
-p, --patch Bump the patch version number instead of the minor | ||
-b [BUILDROOT], --buildroot [BUILDROOT] | ||
Path to the root of the output build files (default="./build") | ||
-v, --verbose Spits out DEBUG level logs | ||
``` |
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 @@ | ||
__version__ = '5.0.0-beta.1' |
Empty file.
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,37 @@ | ||
import argparse | ||
|
||
from neobuilder.neobuilder import NeoBuilder | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='Builds neobuf packages with protoplasm.', | ||
epilog=(f'Neobuilder v{NeoBuilder.neobuilder_version()} - ' | ||
f'Protoplasm v{NeoBuilder.protoplasm_version()}')) | ||
version_group = parser.add_mutually_exclusive_group() | ||
version_group.add_argument('-m', '--major', action="store_true", | ||
help='Bump the major version number instead of the minor') | ||
version_group.add_argument('-p', '--patch', action="store_true", | ||
help='Bump the patch version number instead of the minor') | ||
parser.add_argument('package', help='Package name') | ||
parser.add_argument('protopath', help='Path to the root of the protobuf files (default="./proto")', | ||
default='./proto', nargs='?') | ||
parser.add_argument('-b', '--buildroot', help='Path to the root of the output build files (default="./build")', | ||
default='./build', nargs='?') | ||
parser.add_argument('-v', '--verbose', action="store_true", | ||
help='Spits out DEBUG level logs') | ||
|
||
args = parser.parse_args() | ||
|
||
n = NeoBuilder( | ||
package=args.package, | ||
protopath=args.protopath, | ||
build_root=args.buildroot, | ||
major=args.major, | ||
patch=args.patch, | ||
verbose=args.verbose, | ||
) | ||
n.build() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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,12 @@ | ||
{% from 'macros/indentclude.jinja2' import indentclude with context %} | ||
@dataclasses.dataclass | ||
class {{ class_name }}(bases.DataclassBase): | ||
__proto_cls__ = pb2.{{ proto_cls_name }} | ||
|
||
{{ indentclude('parts/_nested_messages.jinja2', 4) }} | ||
|
||
{{ indentclude('parts/_enum_map.jinja2', 4) }} | ||
|
||
{% for pf in field_map %} | ||
{{ pf }} | ||
{% endfor %} |
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,34 @@ | ||
# Auto-Generated file - DO NOT EDIT! | ||
# Source module: {{ module_full_name }} | ||
# Generated at: {{ iso_timestamp }} | ||
from __future__ import annotations | ||
__all__ = [ | ||
{% for a in all_list %} | ||
'{{ a }}', | ||
{% endfor %} | ||
] | ||
import dataclasses | ||
import datetime | ||
import enum | ||
from typing import * | ||
from protoplasm.casting import dictators | ||
from protoplasm import plasm | ||
{{ imports }} | ||
{{ proto_import }} | ||
|
||
import logging | ||
log = logging.getLogger(__name__) | ||
|
||
|
||
{% if enum_list %} | ||
{% for enum in enum_list %} | ||
{{ enum }} | ||
|
||
{% endfor %} | ||
{% endif %} | ||
{% if message_list %} | ||
{% for msg in message_list %} | ||
{{ msg }} | ||
|
||
{% endfor -%} | ||
{%- endif -%} |
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,19 @@ | ||
# Auto-Generated file - DO NOT EDIT! | ||
# Source module: {{ module_full_name }} | ||
# Generated at: {{ iso_timestamp }} | ||
__all__ = [ | ||
{% for a in all_list %} | ||
'{{ a }}', | ||
{% endfor %} | ||
] | ||
from typing import * | ||
from protoplasm import plasm | ||
{{ imports }} | ||
if TYPE_CHECKING: | ||
from grpc import ServicerContext | ||
|
||
import logging | ||
log = logging.getLogger(__name__) | ||
|
||
|
||
{{ services }} |
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,20 @@ | ||
# Auto-Generated file - DO NOT EDIT! | ||
# Source module: {{ module_full_name }} | ||
# Generated at: {{ iso_timestamp }} | ||
from __future__ import annotations | ||
__all__ = [ | ||
{% for a in all_list %} | ||
'{{ a }}', | ||
{% endfor %} | ||
] | ||
from typing import * | ||
from protoplasm import plasm | ||
{{ imports }} | ||
if TYPE_CHECKING: | ||
from grpc import ChannelCredentials | ||
|
||
import logging | ||
log = logging.getLogger(__name__) | ||
|
||
|
||
{{ services }} |
Empty file.
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,22 @@ | ||
{% from 'macros/indentclude.jinja2' import indentclude with context %} | ||
# Auto-Generated file - DO NOT EDIT! | ||
# Source module: {{ module_full_name }} | ||
# Generated at: {{ iso_timestamp }} | ||
__all__ = [ | ||
{% for a in all_clause %} | ||
'{{ a }}', | ||
{% endfor %} | ||
] | ||
import datetime | ||
from typing import * | ||
from protoplasm import plasm | ||
|
||
{% for import_line in import_lines %} | ||
{{ import_line }} | ||
{% endfor %} | ||
|
||
import logging | ||
log = logging.getLogger(__name__) | ||
|
||
|
||
{{ services }} |
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,2 @@ | ||
{%- macro _inc(file_name, this) -%}{% include file_name with context %}{% endmacro %} | ||
{%- macro indentclude(file_name, spaces=4, this={}) -%}{{ _inc(file_name, this)|indent(spaces) }}{%- endmacro -%} |
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 @@ | ||
# ENUMS GO HERE... |
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,2 @@ | ||
def {{ this.method_under_name }}(self{{ this.input_params }}) -> {{ this.return_type_hint }}: | ||
raise plasm.Unimplemented() |
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,6 @@ | ||
{% from 'macros/indentclude.jinja2' import indentclude with context %} | ||
class {{ service_name }}Interface: | ||
{% for method in method_list %} | ||
{{ indentclude('parts/_interface_method.jinja2', (indent_spaces + 4), method) }} | ||
|
||
{% endfor %} |
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 @@ | ||
# NESTED MESSAGES GO HERE... |
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,7 @@ | ||
__version__ = '{{ version }}'{% if version == '' %} # NO VERSION NUMBERS FOUND?!? :({% endif +%} | ||
__protoplasm_version__ = '{{ protoplasm_version }}' | ||
__neobuilder_version__ = '{{ neobuilder_version }}' | ||
|
||
|
||
def load_symbols(): | ||
from {{ package_name }} import __everything__ |
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,2 @@ | ||
from ._field import * | ||
from ._method import * |
Oops, something went wrong.