icpp-pro 3.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.
Files changed (88) hide show
  1. icpp-pro-3.0.0/LICENSE +21 -0
  2. icpp-pro-3.0.0/PKG-INFO +57 -0
  3. icpp-pro-3.0.0/README.md +35 -0
  4. icpp-pro-3.0.0/pyproject.toml +22 -0
  5. icpp-pro-3.0.0/setup.cfg +4 -0
  6. icpp-pro-3.0.0/setup.py +241 -0
  7. icpp-pro-3.0.0/src/icpp/__init__.py +26 -0
  8. icpp-pro-3.0.0/src/icpp/__main__.py +38 -0
  9. icpp-pro-3.0.0/src/icpp/canisters/greet/README.md +3 -0
  10. icpp-pro-3.0.0/src/icpp/canisters/greet/demo.ps1 +91 -0
  11. icpp-pro-3.0.0/src/icpp/canisters/greet/demo.sh +67 -0
  12. icpp-pro-3.0.0/src/icpp/canisters/greet/dfx.json +16 -0
  13. icpp-pro-3.0.0/src/icpp/canisters/greet/icpp.toml +18 -0
  14. icpp-pro-3.0.0/src/icpp/canisters/greet/native/main.cpp +72 -0
  15. icpp-pro-3.0.0/src/icpp/canisters/greet/native/main.h +2 -0
  16. icpp-pro-3.0.0/src/icpp/canisters/greet/src/greet.cpp +172 -0
  17. icpp-pro-3.0.0/src/icpp/canisters/greet/src/greet.did +18 -0
  18. icpp-pro-3.0.0/src/icpp/canisters/greet/src/greet.h +10 -0
  19. icpp-pro-3.0.0/src/icpp/canisters/greet/test/__init__.py +0 -0
  20. icpp-pro-3.0.0/src/icpp/canisters/greet/test/conftest.py +8 -0
  21. icpp-pro-3.0.0/src/icpp/canisters/greet/test/test_apis.py +114 -0
  22. icpp-pro-3.0.0/src/icpp/commands_build_native.py +212 -0
  23. icpp-pro-3.0.0/src/icpp/commands_build_wasm.py +210 -0
  24. icpp-pro-3.0.0/src/icpp/commands_get.py +50 -0
  25. icpp-pro-3.0.0/src/icpp/commands_init.py +28 -0
  26. icpp-pro-3.0.0/src/icpp/commands_install_wasi_sdk.py +137 -0
  27. icpp-pro-3.0.0/src/icpp/config_default.py +190 -0
  28. icpp-pro-3.0.0/src/icpp/conftest_base.py +89 -0
  29. icpp-pro-3.0.0/src/icpp/decorators.py +116 -0
  30. icpp-pro-3.0.0/src/icpp/ic/canister/canister.h +44 -0
  31. icpp-pro-3.0.0/src/icpp/ic/canister/canister_base.cpp +17 -0
  32. icpp-pro-3.0.0/src/icpp/ic/canister/canister_base.h +40 -0
  33. icpp-pro-3.0.0/src/icpp/ic/canister/canister_cleanup_callback.cpp +8 -0
  34. icpp-pro-3.0.0/src/icpp/ic/canister/canister_cleanup_callback.h +11 -0
  35. icpp-pro-3.0.0/src/icpp/ic/canister/canister_global_timer.cpp +8 -0
  36. icpp-pro-3.0.0/src/icpp/ic/canister/canister_global_timer.h +11 -0
  37. icpp-pro-3.0.0/src/icpp/ic/canister/canister_heartbeat.cpp +8 -0
  38. icpp-pro-3.0.0/src/icpp/ic/canister/canister_heartbeat.h +11 -0
  39. icpp-pro-3.0.0/src/icpp/ic/canister/canister_init.cpp +8 -0
  40. icpp-pro-3.0.0/src/icpp/ic/canister/canister_init.h +11 -0
  41. icpp-pro-3.0.0/src/icpp/ic/canister/canister_inspect_message.cpp +8 -0
  42. icpp-pro-3.0.0/src/icpp/ic/canister/canister_inspect_message.h +11 -0
  43. icpp-pro-3.0.0/src/icpp/ic/canister/canister_post_upgrade.cpp +8 -0
  44. icpp-pro-3.0.0/src/icpp/ic/canister/canister_post_upgrade.h +11 -0
  45. icpp-pro-3.0.0/src/icpp/ic/canister/canister_pre_upgrade.cpp +8 -0
  46. icpp-pro-3.0.0/src/icpp/ic/canister/canister_pre_upgrade.h +11 -0
  47. icpp-pro-3.0.0/src/icpp/ic/canister/canister_query.cpp +8 -0
  48. icpp-pro-3.0.0/src/icpp/ic/canister/canister_query.h +11 -0
  49. icpp-pro-3.0.0/src/icpp/ic/canister/canister_reject_callback.cpp +8 -0
  50. icpp-pro-3.0.0/src/icpp/ic/canister/canister_reject_callback.h +11 -0
  51. icpp-pro-3.0.0/src/icpp/ic/canister/canister_reply_callback.cpp +8 -0
  52. icpp-pro-3.0.0/src/icpp/ic/canister/canister_reply_callback.h +11 -0
  53. icpp-pro-3.0.0/src/icpp/ic/canister/canister_start.cpp +8 -0
  54. icpp-pro-3.0.0/src/icpp/ic/canister/canister_start.h +11 -0
  55. icpp-pro-3.0.0/src/icpp/ic/canister/canister_update.cpp +8 -0
  56. icpp-pro-3.0.0/src/icpp/ic/canister/canister_update.h +11 -0
  57. icpp-pro-3.0.0/src/icpp/ic/ic0/ic0.h +97 -0
  58. icpp-pro-3.0.0/src/icpp/ic/ic0mock/global.h +7 -0
  59. icpp-pro-3.0.0/src/icpp/ic/ic0mock/ic0.cpp +250 -0
  60. icpp-pro-3.0.0/src/icpp/ic/ic0mock/ic0.h +77 -0
  61. icpp-pro-3.0.0/src/icpp/ic/ic0mock/mock_ic.cpp +145 -0
  62. icpp-pro-3.0.0/src/icpp/ic/ic0mock/mock_ic.h +6 -0
  63. icpp-pro-3.0.0/src/icpp/ic/ic0mock/mock_ic_.h +54 -0
  64. icpp-pro-3.0.0/src/icpp/ic/icapi/ic_api.cpp +226 -0
  65. icpp-pro-3.0.0/src/icpp/ic/icapi/ic_api.h +251 -0
  66. icpp-pro-3.0.0/src/icpp/ic/icapi/wasm_symbol.h +10 -0
  67. icpp-pro-3.0.0/src/icpp/ic/pro/pro.cpp +30 -0
  68. icpp-pro-3.0.0/src/icpp/ic/pro/pro.h +20 -0
  69. icpp-pro-3.0.0/src/icpp/ic/wasi_sdk_traps/__wasilibc_initialize_environ.c +40 -0
  70. icpp-pro-3.0.0/src/icpp/ic/wasi_sdk_traps/ic_trap.c +17 -0
  71. icpp-pro-3.0.0/src/icpp/ic/wasi_sdk_traps/ic_trap.h +3 -0
  72. icpp-pro-3.0.0/src/icpp/ic/wasi_sdk_traps/posix.c +189 -0
  73. icpp-pro-3.0.0/src/icpp/ic/wasi_sdk_traps/unreachable.c +384 -0
  74. icpp-pro-3.0.0/src/icpp/icpp_toml.py +121 -0
  75. icpp-pro-3.0.0/src/icpp/options_build.py +23 -0
  76. icpp-pro-3.0.0/src/icpp/options_main.py +31 -0
  77. icpp-pro-3.0.0/src/icpp/pro.py +30 -0
  78. icpp-pro-3.0.0/src/icpp/py.typed +1 -0
  79. icpp-pro-3.0.0/src/icpp/run_shell_cmd.py +164 -0
  80. icpp-pro-3.0.0/src/icpp/smoketest.py +174 -0
  81. icpp-pro-3.0.0/src/icpp/version.py +12 -0
  82. icpp-pro-3.0.0/src/icpp/version_wasi_sdk.py +8 -0
  83. icpp-pro-3.0.0/src/icpp_pro.egg-info/PKG-INFO +57 -0
  84. icpp-pro-3.0.0/src/icpp_pro.egg-info/SOURCES.txt +86 -0
  85. icpp-pro-3.0.0/src/icpp_pro.egg-info/dependency_links.txt +1 -0
  86. icpp-pro-3.0.0/src/icpp_pro.egg-info/entry_points.txt +2 -0
  87. icpp-pro-3.0.0/src/icpp_pro.egg-info/requires.txt +15 -0
  88. icpp-pro-3.0.0/src/icpp_pro.egg-info/top_level.txt +1 -0
icpp-pro-3.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 icppWorld
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,57 @@
1
+ Metadata-Version: 2.1
2
+ Name: icpp-pro
3
+ Version: 3.0.0
4
+ Summary: C++ Canister Development Kit (CDK) for the Internet Computer
5
+ Home-page: https://docs.icpp.world/
6
+ Author: icpp team
7
+ Author-email: icpp@icpp.world
8
+ License: MIT
9
+ Keywords: Internet Computer,C++,Canister Development Kit,CDK,Smart Contracts,blockchain
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: License :: OSI Approved :: MIT License
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 :: Only
18
+ Requires-Python: >=3.8
19
+ Description-Content-Type: text/markdown
20
+ Provides-Extra: dev
21
+ License-File: LICENSE
22
+
23
+ [![icpp-pro](https://github.com/icppWorld/icpp-pro/actions/workflows/cicd.yml/badge.svg)](https://github.com/icppWorld/icpp-pro/actions/workflows/cicd.yml)
24
+
25
+ # C++ Canister Development Kit
26
+
27
+ icpp is a cdk to develop C++ smart contracts for the [Internet Computer](https://internetcomputer.org/):
28
+
29
+ ## Donations welcome
30
+
31
+ Thank you for being part of our community.
32
+
33
+ It will be highly appreciated if you are able to support our project by donating tokens to the icpp treasury account.
34
+
35
+ All donations will go towards the icpp project. With your support we will be able to implement new features at high velocity. And the faster we can go, the faster the IC C++ community will grow and eventually become an SNS governed DAO.
36
+
37
+ | Token | Account |
38
+ | ------------------------------------------------------------ | ------------------------------------------------------------ |
39
+ | ICP | 96a1e58115f7bf2a067a7da8e6d058b23e085591ab838bc300ab9676de6af0d4 |
40
+ | SNS Tokens:<br>- ckBTC<br>- SNS1<br>- CHAT<br>- KINIC<br>- HOT | v437w-ruphh-5q2ms-55iqi-55lso-uasrq-nprl7-v4egy-6jpye-rhox4-vqe |
41
+
42
+ ## Installation
43
+
44
+ `icpp-pro` is available via PyPI:
45
+
46
+ ```bash
47
+ # For Linux, Mac or Windows
48
+ pip install icpp-pro
49
+
50
+ # verify
51
+ $ icpp --version
52
+ icpp-pro version: x.y.z
53
+ wasi-sdk version: wasi-sdk-X.Y
54
+ ```
55
+
56
+ ## [Documentation](https://docs.icpp.world)
57
+
@@ -0,0 +1,35 @@
1
+ [![icpp-pro](https://github.com/icppWorld/icpp-pro/actions/workflows/cicd.yml/badge.svg)](https://github.com/icppWorld/icpp-pro/actions/workflows/cicd.yml)
2
+
3
+ # C++ Canister Development Kit
4
+
5
+ icpp is a cdk to develop C++ smart contracts for the [Internet Computer](https://internetcomputer.org/):
6
+
7
+ ## Donations welcome
8
+
9
+ Thank you for being part of our community.
10
+
11
+ It will be highly appreciated if you are able to support our project by donating tokens to the icpp treasury account.
12
+
13
+ All donations will go towards the icpp project. With your support we will be able to implement new features at high velocity. And the faster we can go, the faster the IC C++ community will grow and eventually become an SNS governed DAO.
14
+
15
+ | Token | Account |
16
+ | ------------------------------------------------------------ | ------------------------------------------------------------ |
17
+ | ICP | 96a1e58115f7bf2a067a7da8e6d058b23e085591ab838bc300ab9676de6af0d4 |
18
+ | SNS Tokens:<br>- ckBTC<br>- SNS1<br>- CHAT<br>- KINIC<br>- HOT | v437w-ruphh-5q2ms-55iqi-55lso-uasrq-nprl7-v4egy-6jpye-rhox4-vqe |
19
+
20
+ ## Installation
21
+
22
+ `icpp-pro` is available via PyPI:
23
+
24
+ ```bash
25
+ # For Linux, Mac or Windows
26
+ pip install icpp-pro
27
+
28
+ # verify
29
+ $ icpp --version
30
+ icpp-pro version: x.y.z
31
+ wasi-sdk version: wasi-sdk-X.Y
32
+ ```
33
+
34
+ ## [Documentation](https://docs.icpp.world)
35
+
@@ -0,0 +1,22 @@
1
+ # Declare python project metadata
2
+ # https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
3
+
4
+ [build-system]
5
+ requires = ["setuptools>=61.0"]
6
+ build-backend = "setuptools.build_meta"
7
+
8
+ [project]
9
+ name = "icpp-pro"
10
+ dynamic = [
11
+ "version",
12
+ "description",
13
+ "authors",
14
+ "readme",
15
+ "requires-python",
16
+ "classifiers",
17
+ "keywords",
18
+ "urls",
19
+ "entry-points",
20
+ "dependencies",
21
+ "optional-dependencies"
22
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,241 @@
1
+ """A setuptools based setup module.
2
+
3
+ See:
4
+ https://packaging.python.org/guides/distributing-packages-using-setuptools/
5
+ https://github.com/pypa/sampleproject
6
+ """
7
+ import sys
8
+ import pathlib
9
+ from setuptools import setup, find_packages # type: ignore
10
+
11
+ here = pathlib.Path(__file__).parent.resolve()
12
+
13
+ # Get the long description from the README file
14
+ long_description = (here / "README.md").read_text(encoding="utf-8")
15
+
16
+ # Get the version number
17
+ # pylint: disable = wrong-import-position, no-member
18
+ sys.path.append(str(here / "src/icpp"))
19
+ import version # type: ignore
20
+
21
+ setup(
22
+ # This is the name of your project. The first time you publish this
23
+ # package, this name will be registered for you. It will determine how
24
+ # users can install this project, e.g.:
25
+ #
26
+ # $ pip install icpp-pro
27
+ #
28
+ # And where it will live on PyPI: https://pypi.org/project/icpp-pro/
29
+ #
30
+ # There are some restrictions on what makes a valid project name
31
+ # specification here:
32
+ # https://packaging.python.org/specifications/core-metadata/#name
33
+ name="icpp-pro", # Required
34
+ #
35
+ # Versions should comply with PEP 440:
36
+ # https://www.python.org/dev/peps/pep-0440/
37
+ #
38
+ # For a discussion on single-sourcing the version across setup.py and the
39
+ # project code, see
40
+ # https://packaging.python.org/en/latest/single_source_version.html
41
+ version=version.__version__, # Required
42
+ #
43
+ # This is a one-line description or tagline of what your project does. This
44
+ # corresponds to the "Summary" metadata field:
45
+ # https://packaging.python.org/specifications/core-metadata/#summary
46
+ description="C++ Canister Development Kit (CDK) for the Internet Computer", # Optional
47
+ #
48
+ # This is an optional longer description of your project that represents
49
+ # the body of text which users will see when they visit PyPI.
50
+ #
51
+ # Often, this is the same as your README, so you can just read it in from
52
+ # that file directly (as we have already done above)
53
+ #
54
+ # This field corresponds to the "Description" metadata field:
55
+ # https://packaging.python.org/specifications/core-metadata/#description-optional
56
+ long_description=long_description, # Optional
57
+ #
58
+ # Denotes that our long_description is in Markdown; valid values are
59
+ # text/plain, text/x-rst, and text/markdown
60
+ #
61
+ # Optional if long_description is written in reStructuredText (rst) but
62
+ # required for plain-text or Markdown; if unspecified, "applications should
63
+ # attempt to render [the long_description] as text/x-rst; charset=UTF-8 and
64
+ # fall back to text/plain if it is not valid rst" (see link below)
65
+ #
66
+ # This field corresponds to the "Description-Content-Type" metadata field:
67
+ # https://packaging.python.org/specifications/core-metadata/#description-content-type-optional
68
+ long_description_content_type="text/markdown", # Optional (see note above)
69
+ #
70
+ # This should be a valid link to your project's main homepage.
71
+ #
72
+ # This field corresponds to the "Home-Page" metadata field:
73
+ # https://packaging.python.org/specifications/core-metadata/#home-page-optional
74
+ url="https://docs.icpp.world/", # Optional
75
+ #
76
+ # This should be your name or the name of the organization which owns the project.
77
+ author="icpp team", # Optional
78
+ #
79
+ # This should be a valid email address corresponding to the author listed above.
80
+ author_email="icpp@icpp.world", # Optional
81
+ #
82
+ # Classifiers help users find your project by categorizing it.
83
+ #
84
+ # For a list of valid classifiers, see https://pypi.org/classifiers/
85
+ classifiers=[ # Optional
86
+ # How mature is this project? Common values are
87
+ # 1 - Planning
88
+ # 2 - Pre-Alpha
89
+ # 3 - Alpha
90
+ # 4 - Beta
91
+ # 5 - Production/Stable
92
+ "Development Status :: 4 - Beta",
93
+ # Pick your license as you wish
94
+ "License :: OSI Approved :: MIT License",
95
+ # Specify the Python versions you support here. In particular, ensure
96
+ # that you indicate you support Python 3. These classifiers are *not*
97
+ # checked by 'pip install'. See instead 'python_requires' below.
98
+ "Programming Language :: Python :: 3",
99
+ "Programming Language :: Python :: 3.8",
100
+ "Programming Language :: Python :: 3.9",
101
+ "Programming Language :: Python :: 3.10",
102
+ "Programming Language :: Python :: 3.11",
103
+ "Programming Language :: Python :: 3 :: Only",
104
+ ],
105
+ #
106
+ # This field adds a description to the metatada in PKG-INFO.
107
+ # It is not used by PyPI
108
+ license="MIT",
109
+ #
110
+ # This field adds keywords for your project which will appear on the
111
+ # project page. What does your project relate to?
112
+ #
113
+ # Note that this is a list of additional keywords, separated
114
+ # by commas, to be used to assist searching for the distribution in a
115
+ # larger catalog.
116
+ keywords="Internet Computer, C++, Canister Development Kit, CDK, Smart Contracts, blockchain", # Optional
117
+ #
118
+ # When your source code is in a subdirectory under the project root, e.g.
119
+ # `src/`, it is necessary to specify the `package_dir` argument.
120
+ package_dir={"": "src"}, # Optional
121
+ #
122
+ # You can just specify package directories manually here if your project is
123
+ # simple. Or you can use find_packages().
124
+ #
125
+ # Alternatively, if you just want to distribute a single Python file, use
126
+ # the `py_modules` argument instead as follows, which will expect a file
127
+ # called `my_module.py` to exist:
128
+ #
129
+ # py_modules=["my_module"],
130
+ #
131
+ packages=find_packages(where="src"), # Required
132
+ #
133
+ # Specify which Python versions you support. In contrast to the
134
+ # 'Programming Language' classifiers above, 'pip install' will check this
135
+ # and refuse to install the project if the version does not match. See
136
+ # https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
137
+ python_requires=">=3.8",
138
+ #
139
+ # This field lists other packages that your project depends on to run.
140
+ # Any package you put here will be installed by pip when your project is
141
+ # installed, so they must be valid existing projects.
142
+ #
143
+ # For an analysis of "install_requires" vs pip's requirements files see:
144
+ # https://packaging.python.org/en/latest/requirements.html
145
+ install_requires=[
146
+ f"icpp-candid=={version.__version__}",
147
+ "typer[all]>=0.9.0",
148
+ "tomli",
149
+ "requests",
150
+ "enlighten",
151
+ "pytest",
152
+ ], # Optional
153
+ #
154
+ # List additional groups of dependencies here (e.g. development
155
+ # dependencies). Users will be able to install these using the "extras"
156
+ # syntax, for example:
157
+ #
158
+ # $ pip install "sampleproject[dev]"
159
+ #
160
+ # Similar to `install_requires` above, these must be valid existing
161
+ # projects.
162
+ extras_require={ # Optional
163
+ "dev": [
164
+ "black",
165
+ "pylint==2.13.9",
166
+ "mypy",
167
+ "build",
168
+ "twine",
169
+ "mkdocs",
170
+ "types-requests",
171
+ ],
172
+ },
173
+ #
174
+ # If there are data files included in your packages that need to be
175
+ # installed, specify them here.
176
+ # https://setuptools.pypa.io/en/latest/userguide/datafiles.html#package-data
177
+ #
178
+ # (-) add 'py.typed', to play nice with mypy
179
+ # https://mypy.readthedocs.io/en/latest/installed_packages.html
180
+ # #making-pep-561-compatible-packages
181
+ # (-) add 'ic/' , which contains the C++ & Header files of the API
182
+ # (-) add 'native/', which contains the C++ & Header files for a native build,
183
+ # with a mock IC, allowing interactive debugging.
184
+ #
185
+ package_data={ # Optional
186
+ "icpp": [
187
+ "canisters/greet/native/*",
188
+ "canisters/greet/src/*",
189
+ "canisters/greet/test/*",
190
+ "canisters/greet/dfx.json",
191
+ "canisters/greet/icpp.toml",
192
+ "canisters/greet/README.md",
193
+ "canisters/greet/demo.sh",
194
+ "canisters/greet/demo.ps1",
195
+ "ic/*/*.c",
196
+ "ic/*/*.cpp",
197
+ "ic/*/*.h",
198
+ "ic/*/*.hpp",
199
+ "py.typed",
200
+ ],
201
+ },
202
+ #
203
+ # Although 'package_data' is the preferred approach, in some case you may
204
+ # need to place data files outside of your packages. See:
205
+ # http://docs.python.org/distutils/setupscript.html#installing-additional-files
206
+ #
207
+ # In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
208
+ ## data_files=[('my_data', ['data/data_file'])], # Optional
209
+ #
210
+ # To provide executable scripts, use entry points in preference to the
211
+ # "scripts" keyword. Entry points provide cross-platform support and allow
212
+ # `pip` to create the appropriate form of executable for the target
213
+ # platform.
214
+ #
215
+ # For example, the following would provide a command called `icpp` which
216
+ # executes the function `main` from this package when invoked:
217
+ # NOTE: you can create multiple entry_points, for example, when distributing
218
+ # more than one packages, you can create an entry_point for each package
219
+ entry_points={ # Optional
220
+ "console_scripts": [
221
+ "icpp=icpp.__main__:main",
222
+ ],
223
+ },
224
+ #
225
+ # List additional URLs that are relevant to your project as a dict.
226
+ #
227
+ # This field corresponds to the "Project-URL" metadata fields:
228
+ # https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use
229
+ #
230
+ # Examples listed include a pattern for specifying where the package tracks
231
+ # issues, where the source is hosted, where to say thanks to the package
232
+ # maintainers, and where to support the project financially. The key is
233
+ # what's used to render the link text on PyPI.
234
+ ## project_urls={ # Optional
235
+ ## 'Bug Reports': 'https://github.com/pypa/sampleproject/issues',
236
+ ## 'Funding': 'https://donate.pypi.org',
237
+ ## 'Say Thanks!': 'http://saythanks.io/to/example',
238
+ ## 'Source': 'https://github.com/pypa/sampleproject/',
239
+ ## },
240
+ #
241
+ )
@@ -0,0 +1,26 @@
1
+ """
2
+ __init__.py.
3
+ The double underscores in the filename tell us that this is a special file.
4
+ __init__.py represents the root of your package.
5
+ It should usually be kept quite simple, but it’s a good place to put package constants,
6
+ documentation, and so on.
7
+
8
+ The special variable __version__ is a convention in Python for adding version numbers
9
+ to your package.
10
+
11
+ Variables defined in __init__.py become available as variables in the package namespace:
12
+ ```
13
+ import icpp
14
+ icpp.__version__
15
+ ```
16
+
17
+ reference: https://realpython.com/pypi-publish-python-package/
18
+ """
19
+ import icpp.version
20
+ import icpp.version_wasi_sdk
21
+
22
+ # Version of package
23
+ __version__ = icpp.version.__version__
24
+
25
+ # Version of wasi-sdk
26
+ __version_wasi_sdk__ = icpp.version_wasi_sdk.__version__
@@ -0,0 +1,38 @@
1
+ """__main__.py
2
+ The double underscores indicate that this file has a special meaning in Python.
3
+ When running a package (!) as a script with -m, 'python -m icpp', Python
4
+ executes the contents of the __main__.py file.
5
+
6
+ In other words, __main__.py acts as the entry point of our program and takes care of
7
+ the main flow, calling other parts as needed
8
+
9
+ reference: https://realpython.com/pypi-publish-python-package/
10
+ """
11
+ import typer
12
+
13
+
14
+ # Instantiate the Typer app globally with app = typer.Typer().
15
+ # That way, we can decorate any function we want to call from the command line,
16
+ # using the @app.command() decorator.
17
+ app = typer.Typer()
18
+
19
+ # do some stuff with app
20
+ # pylint: disable = wrong-import-position unused-import
21
+ from icpp import options_main
22
+ from icpp import commands_get
23
+ from icpp import commands_init
24
+ from icpp import commands_build_wasm
25
+ from icpp import commands_build_native
26
+ from icpp import commands_install_wasi_sdk
27
+
28
+
29
+ def main() -> None:
30
+ """Entry point of program"""
31
+ app(prog_name="icpp")
32
+
33
+
34
+ #
35
+ # Always start it up or debug as a module:
36
+ # python -m icpp.__main__
37
+ #
38
+ main()
@@ -0,0 +1,3 @@
1
+ # `greet`
2
+
3
+ See the [Getting Started tutorial](https://docs.icpp.world/getting-started.html).
@@ -0,0 +1,91 @@
1
+ #######################################################################
2
+ # This is a Windows PowerShell script
3
+ #
4
+ # (-) Install icpp-pro or icpp-free in a python environment on windows
5
+ # (-) Install dfx in wsl
6
+ # (-) In a Windows PowerShell (*):
7
+ #
8
+ # .\demo.ps1
9
+ #
10
+ # (*) The Miniconda Powershell is highly recommended
11
+ #
12
+ #######################################################################
13
+ Write-Host " "
14
+ Write-Host "--------------------------------------------------"
15
+ Write-Host "Stopping the local network in wsl"
16
+ wsl dfx stop
17
+
18
+ Write-Host " "
19
+ Write-Host "--------------------------------------------------"
20
+ Write-Host "Starting the local network in wsl as a PowerShell background job"
21
+ $jobName = "greet"
22
+
23
+ # Stop the job if it already exist
24
+ # Get a list of all the background jobs with a specific name
25
+ $jobs = Get-Job -Name $jobName -ErrorAction SilentlyContinue
26
+
27
+ # Stop all the jobs
28
+ $jobs | Remove-Job
29
+
30
+ # Start the local network with redirecting error messages to output stream
31
+ $job = Start-Job -ScriptBlock { wsl dfx start --clean 2>&1 } -Name $jobName
32
+
33
+ # Display the details of the job
34
+ $job | Format-Table
35
+
36
+ # Wait for 10 seconds
37
+ Write-Host " "
38
+ Write-Host "Waiting for 10 seconds to allow the local network to start..."
39
+ Start-Sleep -Seconds 10
40
+
41
+ # Get the output of the job
42
+ $output = Receive-Job -Job $job
43
+ Write-Host $output -ForegroundColor Green
44
+
45
+ #######################################################################
46
+ Write-Host " "
47
+ Write-Host "--------------------------------------------------"
48
+ Write-Host "Building the wasm with wasi-sdk"
49
+ icpp build-wasm --to-compile all
50
+ # icpp build-wasm --to-compile mine
51
+
52
+ #######################################################################
53
+ Write-Host " "
54
+ Write-Host "--------------------------------------------------"
55
+ Write-Host "Deploying the wasm to a canister on the local network"
56
+ wsl --% dfx deploy
57
+
58
+ #######################################################################
59
+ Write-Host " "
60
+ Write-Host "--------------------------------------------------"
61
+ Write-Host "Running some manual tests with dfx"
62
+ wsl --% dfx canister call greet greet_0
63
+ wsl --% dfx canister call greet greet_1
64
+ wsl --% dfx canister call greet greet_2 '("C++ Developer")'
65
+ wsl --% dfx canister call greet greet_3 '(record { "icpp version" = 1 : int; OS = "Linux" : text })'
66
+ wsl --% dfx canister call greet greet_4 '(record { 6 = 42 : int; 9 = 43 : int }, record { 7 = 44 : int; 10 = 45 : int })'
67
+
68
+ #######################################################################
69
+ Write-Host " "
70
+ Write-Host "--------------------------------------------------"
71
+ Write-Host "Running the full smoketests with pytest"
72
+ pytest --network=local
73
+
74
+ #######################################################################
75
+ Write-Host " "
76
+ Write-Host "--------------------------------------------------"
77
+ Write-Host "Stopping the local network in wsl"
78
+ wsl dfx stop
79
+
80
+ #######################################################################
81
+ Write-Host " "
82
+ Write-Host "--------------------------------------------------"
83
+ Write-Host "Building the Windows native debug executable with clang++"
84
+ icpp build-native --to-compile all
85
+ # icpp build-native --to-compile mine
86
+
87
+ #######################################################################
88
+ Write-Host " "
89
+ Write-Host "--------------------------------------------------"
90
+ Write-Host "Running the Windows native debug executable"
91
+ .\build-native\mockic.exe
@@ -0,0 +1,67 @@
1
+ #!/bin/sh
2
+
3
+ #######################################################################
4
+ # This is a Linux & Mac shell script
5
+ #
6
+ # (-) Install icpp-pro or icpp-free in a python environment
7
+ # (-) Install dfx
8
+ # (-) In a terminal:
9
+ #
10
+ # ./demo.sh
11
+ #
12
+ #######################################################################
13
+ echo " "
14
+ echo "--------------------------------------------------"
15
+ echo "Stopping the local network"
16
+ dfx stop
17
+
18
+ echo " "
19
+ echo "--------------------------------------------------"
20
+ echo "Starting the local network as a background process"
21
+ dfx start --clean --background
22
+
23
+ #######################################################################
24
+ echo "--------------------------------------------------"
25
+ echo "Building the wasm with wasi-sdk"
26
+ icpp build-wasm --to-compile all
27
+ # icpp build-wasm --to-compile mine
28
+
29
+ #######################################################################
30
+ echo " "
31
+ echo "--------------------------------------------------"
32
+ echo "Deploying the wasm to a canister on the local network"
33
+ dfx deploy
34
+
35
+ #######################################################################
36
+ echo " "
37
+ echo "--------------------------------------------------"
38
+ echo "Running some manual tests with dfx"
39
+ dfx canister call greet greet_0
40
+ dfx canister call greet greet_1
41
+ dfx canister call greet greet_2 '("C++ Developer")'
42
+ dfx canister call greet greet_3 '(record { "icpp version" = 1 : int; OS = "Linux" : text })'
43
+ dfx canister call greet greet_4 '(record { 6 = 42 : int; 9 = 43 : int }, record { 7 = 44 : int; 10 = 45 : int })'
44
+
45
+ #######################################################################
46
+ echo " "
47
+ echo "--------------------------------------------------"
48
+ echo "Running the full smoketests with pytest"
49
+ pytest --network=local
50
+
51
+ #######################################################################
52
+ echo "--------------------------------------------------"
53
+ echo "Stopping the local network"
54
+ dfx stop
55
+
56
+ #######################################################################
57
+ echo " "
58
+ echo "--------------------------------------------------"
59
+ echo "Building the OS native debug executable with clang++"
60
+ icpp build-native --to-compile all
61
+ # icpp build-native --to-compile mine
62
+
63
+ #######################################################################
64
+ echo " "
65
+ echo "--------------------------------------------------"
66
+ echo "Running the OS native debug executable"
67
+ ./build-native/mockic.exe
@@ -0,0 +1,16 @@
1
+ {
2
+ "version": 1,
3
+ "canisters": {
4
+ "greet": {
5
+ "type": "custom",
6
+ "candid": "src/greet.did",
7
+ "wasm": "build/greet.wasm"
8
+ }
9
+ },
10
+ "defaults": {
11
+ "build": {
12
+ "args": "",
13
+ "packtool": ""
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,18 @@
1
+ [build-wasm]
2
+ canister = "greet"
3
+ did_path = "src/greet.did"
4
+ cpp_paths = ["src/greet.cpp"]
5
+ cpp_header_paths = ["src/greet.h"]
6
+ cpp_compile_flags = []
7
+ cpp_link_flags = []
8
+ c_paths = []
9
+ c_header_paths = []
10
+ c_compile_flags = []
11
+ [build-native]
12
+ cpp_paths = ["native/main.cpp"]
13
+ cpp_header_paths = ["native/main.h"]
14
+ cpp_compile_flags = []
15
+ cpp_link_flags = []
16
+ c_paths = []
17
+ c_header_paths = []
18
+ c_compile_flags = []