From 648d2ce55f9954195ce3358d23f01426892ecd3b Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 13 Jun 2023 10:00:06 -0700 Subject: [PATCH] re-adding dummy modules option for pdoc --- .efrocachemap | 56 ++++++++++++++--------------- CHANGELOG.md | 2 +- src/assets/ba_data/python/baenv.py | 2 +- src/ballistica/shared/ballistica.cc | 2 +- tools/batools/apprun.py | 18 +++++----- tools/batools/docs.py | 49 +++++++++++++++++++++---- tools/efro/util.py | 3 ++ 7 files changed, 85 insertions(+), 47 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index a15ccf8f..108993be 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4072,26 +4072,26 @@ "build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/18/4b/787a9267e17be3c49966072581a5", "build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/20/f6/4ce9bc3c1f3732f6adf8237fbe9b", "build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/a5/30/9058181df0b1255bf6950cbc7813", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1d/7b/7253826637a9bf6d9bfbc8605676", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/91/eb/eaec773bf6e4a832ba9c87c33d54", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/9f/4b/ba62963d78b77786d9aeefb49c7d", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/06/fb/8cf21337918d6930e4b261cfe2ed", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/f7/61/c817cfd272e7ad401b3e3d17ad2b", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/5b/c6/92d0ba8ca612e475b72260a19e98", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b7/bd/b8ac02a5e68a1069e8f95e694878", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7d/79/e42dfe45c7b2c1a50d10b4e09efe", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d1/7e/03c15e0c5b879b095733fca14071", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ad/ce/473c60a90b856145b0cf587cda4c", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/29/2f/2de408c8e852b8097c7dff9d7497", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/6a/8a/b5db085b0e7c302592339e71bb7e", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1b/ad/fe521e7f9d4abd716692f2f6b8dc", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ca/80/8f44943b05b5fb9cb4e1c1c5763d", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e1/53/ad81f611dc356441086c98f25e56", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/48/e9/cbc79d892e48a419fb06201b664b", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/94/47/9502d77c36eb6d299c601c69247d", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/6b/cc/dd472ee104f5c0945b19eb5d24ff", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/e9/f4/316f483ea3ae6d39302b0eccf33d", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/68/5c/ea58c6d8768257189f66ec1ee3e8", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/62/cd/d08e770b38acf623b5b1bb127e5d", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/0e/99/b778ee89d825ad437afd5e985d74", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/37/19/e96634dcf5cf0b82d43f1452c310", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/89/89/670aab098a12f83e7e60db87c028", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/89/29/7a6e474273dff5d5155c8dc76780", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/1a/50/eba589fe6c27bbecb717c644ae52", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ae/6d/3a40474aa8072a124a0487267e23", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/32/1c/e4e8cbff499975e12c73a43986a3", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/5a/48/1823ce966086d9db6aeecd434fce", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/9f/9e/68acd514f01a55e750aaf9870136", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ec/cd/6883d013c07be8c7116601b8480b", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3f/b0/c3301e6d30b7ef398bb53a6318c8", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d4/4b/6b2bf7e37b24c8279c697e98ca12", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/8a/72/269f9f0f1f2d0429866be5d76db5", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/22/fa/43eb0ed9388165d5ddac79fc9c8d", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e1/7a/2ca64e3b1ef1e4a83c565ee30185", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/9f/77/cdd3caf8b07452fa84a93ef5d54d", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/50/35/2abd0ba2c01c51cac45ca25d154f", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/65/b9/4e1ebf0753fad9e3adec9a598efc", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/59/c2/82922c6bb43000f60e146d89ffff", "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/29/dc/e5b08aae2dbe3222082aaa1e90e7", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ce/bb/5796a83ce9d1c9cf58e08f3ff351", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/31/65/014221e46f7974f40aa84c8922dc", @@ -4108,14 +4108,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/14/4b/68a0ece3c1f191183b695cf45a4d", "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/1f/3f/d899a46cc0dc8bc4f1b38f9318a5", "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/de/99/95fdcb3f614a7b83ada148bca38d", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/6c/b8/b42d90e0c991233dadb0fa498b95", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/fa/f7/3004bba599e26a7e73ec19aebdd6", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/dc/f2/a2433e98d01e78ecc16fb230a141", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/ba/c3/e0248843a4a2bc53fc222552f487", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/f7/5f/a946415a64079e34971647f8da5e", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/ab/b9/72bbf123dae81cbe7881fcce16bf", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/78/03/1439e8e2d1958f03f7308192d7d2", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/94/89/d698837eecc38a98160bd8e3cc1c", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/4f/6b/ebfab34748dfdeda9a9336c3d208", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/60/70/928f79ea56be618d2c2a8f041848", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/30/3b/ebb3771011b506c2162eac0cc70f", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/9b/7f/226e61a4f0fab3d66415451441c1", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/ac/ea/7af50be6464252224a4a9878dd9b", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/88/92/349325fffda0d6f6cedfc462b997", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/13/a2/a0a0457431a0219f2b6c665bbe4f", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/70/e5/42300dcb5257494588f140d2a3d9", "src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa", "src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1", "src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/ea/6a/6a4721b144e5e297b542d2a0eea2", diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fe5a733..1a634746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.20 (build 21093, api 8, 2023-06-12) +### 1.7.20 (build 21094, api 8, 2023-06-13) - This seems like a good time for a `refactoring` release in anticipation of changes coming in 1.8. Basically this means that a lot of things will be diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 268823fb..daefbc57 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -28,7 +28,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21093 +TARGET_BALLISTICA_BUILD = 21094 TARGET_BALLISTICA_VERSION = '1.7.20' _g_env_config: EnvConfig | None = None diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index f6f64900..9e987414 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21093; +const int kEngineBuildNumber = 21094; const char* kEngineVersion = "1.7.20"; auto MonolithicMain(const core::CoreConfig& core_config) -> int { diff --git a/tools/batools/apprun.py b/tools/batools/apprun.py index da012835..23ca4dde 100755 --- a/tools/batools/apprun.py +++ b/tools/batools/apprun.py @@ -15,7 +15,7 @@ import os from efro.terminal import Clr if TYPE_CHECKING: - pass + from typing import Mapping def test_runs_disabled() -> bool: @@ -41,7 +41,10 @@ def acquire_binary_for_python_command(purpose: str) -> str: def python_command( - cmd: str, purpose: str, include_project_tools: bool = False + cmd: str, + purpose: str, + include_project_tools: bool = False, + env: Mapping[str, str] | None = None, ) -> None: """Run a cmd with a built bin and PYTHONPATH set to its scripts.""" @@ -60,15 +63,12 @@ def python_command( # Make our tools dir available if asked. tools_path_extra = ':tools' if include_project_tools else '' + env_final = {} if env is None else dict(env) + env_final['PYTHONPATH'] = f'{pydir}:{pysitedir}{tools_path_extra}' + cmdargs = [binpath, '--command', cmd] print(f"apprun: Running with Python command: '{cmdargs}'...", flush=True) - subprocess.run( - cmdargs, - env=dict( - os.environ, PYTHONPATH=f'{pydir}:{pysitedir}{tools_path_extra}' - ), - check=True, - ) + subprocess.run(cmdargs, env=env_final, check=True) def acquire_binary(assets: bool, purpose: str) -> str: diff --git a/tools/batools/docs.py b/tools/batools/docs.py index 34ed5aba..f8e85d80 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -80,14 +80,50 @@ def generate_pdoc(projroot: str) -> None: del projroot # Unused. # Assemble and launch an app and do our docs generation from there. - apprun.python_command( - 'import batools.docs; batools.docs._run_pdoc_in_engine()', - purpose='pdocs generation', - include_project_tools=True, - ) + # Note: we set EFRO_SUPPRESS_SET_CANONICAL_MODULE_NAMES because pdoc + # spits out lots of "UserWarning: cannot determine where FOO was + # taken from" warnings if not. Haven't actually seen what difference + # it makes in the output though. Basically the canonical names stuff + # makes things like bascenev1._actor.Actor show up as + # bascenev1.Actor instead. + if bool(True): + # Gen docs from the engine. + apprun.python_command( + 'import batools.docs; batools.docs._run_pdoc_in_engine()', + purpose='pdocs generation', + include_project_tools=True, + env=dict(os.environ, EFRO_SUPPRESS_SET_CANONICAL_MODULE_NAMES='1'), + ) + else: + # Gen docs using dummy modules. + _run_pdoc_with_dummy_modules() + + +def _run_pdoc_with_dummy_modules() -> None: + """Generate docs outside of the engine using our dummy modules. + + Dummy modules stand in for native engine modules, and should be + just intact enough for us to spit out docs from. The upside is + that they have full typing information about arguments/etc. so our + docs will be more complete than if we talk to the live engine. + """ + raise RuntimeError('UNDER CONSTRUCTION') def _run_pdoc_in_engine() -> None: + """Generate docs from within the running engine. + + The upside of this way is we have all built-in native modules + available. The downside is that we don't have typing information for + those modules aside from what's embedded in their docstrings (which + is not parsed by pdoc). So we get lots of 'unknown' arg types in + docs/etc. + + The ideal solution might be to start writing .pyi files for our + native modules to provide their type information instead of or in + addition to our dummy-module approach. Just need to see how that + works with our pipeline. + """ import time import pdoc @@ -95,8 +131,7 @@ def _run_pdoc_in_engine() -> None: starttime = time.monotonic() - # Tell pdoc to go through all the modules we've got in - # ba_data/python. + # Tell pdoc to go through all the modules in ba_data/python. modulenames = sorted( n.removesuffix('.py') for n in os.listdir('src/assets/ba_data/python') diff --git a/tools/efro/util.py b/tools/efro/util.py index 3f77498f..c00916c3 100644 --- a/tools/efro/util.py +++ b/tools/efro/util.py @@ -708,6 +708,9 @@ def unchanging_hostname() -> str: def set_canonical_module_names(module_globals: dict[str, Any]) -> None: """Do the thing.""" + if os.environ.get('EFRO_SUPPRESS_SET_CANONICAL_MODULE_NAMES') == '1': + return + modulename = module_globals.get('__name__') if not isinstance(modulename, str): raise RuntimeError('Unable to get module name.')