diff --git a/.config/jupyter/jupyter_server_config.py b/.config/jupyter/jupyter_server_config.py index c0d9af828..14c07a224 100644 --- a/.config/jupyter/jupyter_server_config.py +++ b/.config/jupyter/jupyter_server_config.py @@ -1,10 +1,10 @@ # Configuration file for jupyter-server. -c = get_config() #noqa +c = get_config() # noqa -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Application(SingletonConfigurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## This is an application. ## The date format used by logging formatters for %(asctime)s @@ -21,32 +21,32 @@ # c.Application.log_level = 30 ## Configure additional log handlers. -# +# # The default stderr logs handler is configured by the log_level, log_datefmt # and log_format settings. -# +# # This configuration can be used to configure additional handlers (e.g. to # output the log to a file) or for finer control over the default handlers. -# +# # If provided this should be a logging configuration dictionary, for more # information see: # https://docs.python.org/3/library/logging.config.html#logging-config- # dictschema -# +# # This dictionary is merged with the base logging configuration which defines # the following: -# +# # * A logging formatter intended for interactive use called # ``console``. # * A logging handler that writes to stderr called # ``console`` which uses the formatter ``console``. # * A logger with the name of this application set to ``DEBUG`` # level. -# +# # This example adds a new handler that writes to a file: -# +# # .. code-block:: python -# +# # c.Application.logging_config = { # 'handlers': { # 'file': { @@ -75,9 +75,9 @@ # Default: False # c.Application.show_config_json = False -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # JupyterApp(Application) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## Base class for Jupyter applications ## Answer yes to any prompts. @@ -108,7 +108,7 @@ # See also: Application.log_level # c.JupyterApp.log_level = 30 -## +## # See also: Application.logging_config # c.JupyterApp.logging_config = {} @@ -120,9 +120,9 @@ # See also: Application.show_config_json # c.JupyterApp.show_config_json = False -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # ServerApp(JupyterApp) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## The Jupyter Server application class. ## Set the Access-Control-Allow-Credentials: true header @@ -130,21 +130,21 @@ # c.ServerApp.allow_credentials = False ## Set the Access-Control-Allow-Origin header -# +# # Use '*' to allow any origin to access your server. -# +# # Takes precedence over allow_origin_pat. # Default: '' # c.ServerApp.allow_origin = '' ## Use a regular expression for the Access-Control-Allow-Origin header -# +# # Requests from an origin matching the expression will get replies with: -# +# # Access-Control-Allow-Origin: origin -# +# # where `origin` is the origin of the request. -# +# # Ignored if allow_origin is set. # Default: '' # c.ServerApp.allow_origin_pat = '' @@ -154,15 +154,15 @@ # c.ServerApp.allow_password_change = True ## Allow requests where the Host header doesn't point to a local server -# +# # By default, requests get a 403 forbidden response if the 'Host' header # shows that the browser thinks it's on a non-local domain. # Setting this option to True disables this check. -# +# # This protects against 'DNS rebinding' attacks, where a remote web server # serves you a page and then changes its DNS to send later requests to a # local IP, bypassing same-origin checks. -# +# # Local IP addresses (such as 127.0.0.1 and ::1) are allowed as local, # along with hostnames configured in local_hostnames. # Default: False @@ -190,7 +190,7 @@ # c.ServerApp.autoreload = False ## The base URL for the Jupyter server. -# +# # Leading and trailing slashes can be omitted, # and will automatically be added. # Default: '/' @@ -236,7 +236,7 @@ ## The random bytes used to secure cookies. # By default this is a new random number every time you start the server. # Set it to a value in a config file to enable logins to persist across server sessions. -# +# # Note: Cookie secrets should be kept private, do not share config files with # cookie_secret stored in plaintext (you can read the value from a file). # Default: b'' @@ -247,12 +247,12 @@ # c.ServerApp.cookie_secret_file = '' ## Override URL shown to users. -# +# # Replace actual URL, including protocol, address, port and base URL, # with the given value when displaying URL to the users. Do not change # the actual connection URL. If authentication token is enabled, the # token is added to the custom URL automatically. -# +# # This option is intended to be used when the URL to display to the user # cannot be determined reliably by the Jupyter server (proxified # or containerized setups for example). @@ -264,13 +264,13 @@ # c.ServerApp.default_url = '/' ## Disable cross-site-request-forgery protection -# +# # Jupyter server includes protection from cross-site request forgeries, # requiring API requests to either: -# +# # - originate from pages served by this server (validated with XSRF cookie and token), or # - authenticate with a token -# +# # Some anonymous compute resources still desire the ability to run code, # completely without authentication. # These services can disable all authentication and security checks, @@ -283,14 +283,14 @@ # c.ServerApp.extra_services = [] ## Extra paths to search for serving static files. -# +# # This allows adding javascript/css to be available from the Jupyter server machine, # or overriding individual files in the IPython # Default: [] # c.ServerApp.extra_static_paths = [] ## Extra paths to search for serving jinja templates. -# +# # Can be used to override templates from jupyter_server.templates. # Default: [] # c.ServerApp.extra_template_paths = [] @@ -347,7 +347,7 @@ ## The kernel spec manager class to use. Should be a subclass of # `jupyter_client.kernelspec.KernelSpecManager`. -# +# # The Api of KernelSpecManager is provisional and might change without warning # between this version of Jupyter and the next stable one. # Default: 'builtins.object' @@ -370,7 +370,7 @@ # c.ServerApp.limit_rate = False ## Hostnames to allow as local when allow_remote_access is False. -# +# # Local IP addresses (such as 127.0.0.1 and ::1) are automatically accepted # as local as well. # Default: ['localhost'] @@ -388,7 +388,7 @@ # See also: Application.log_level # c.ServerApp.log_level = 30 -## +## # See also: Application.logging_config # c.ServerApp.logging_config = {} @@ -403,7 +403,7 @@ ## Sets the maximum allowed size of the client request body, specified in the # Content-Length request header field. If the size in a request exceeds the # configured value, a malformed HTTP message is returned to the client. -# +# # Note: max_body_size is applied even in streaming mode. # Default: 536870912 # c.ServerApp.max_body_size = 536870912 @@ -507,7 +507,7 @@ # c.ServerApp.ssl_options = {} ## Paths to set up static files as immutable. -# +# # This allow setting up the cache control of static files as immutable. It # should be used for static file named with a hash for instance. # Default: [] @@ -518,10 +518,10 @@ # c.ServerApp.terminado_settings = {} ## Set to False to disable terminals. -# +# # This does *not* make the server more secure by itself. # Anything the user can in a terminal, they can also do in a notebook. -# +# # Terminals may also be automatically disabled if the terminado package # is not available. # Default: False @@ -550,7 +550,7 @@ # launching a browser using a redirect file can lead the browser failing to load. # This is because of the difference in file structures/paths between the runtime and # the browser. -# +# # Disabling this setting to False will disable this behavior, allowing the browser # to launch by using a URL and visible token (as before). # Default: True @@ -560,39 +560,39 @@ # `new` argument passed to the standard library method `webbrowser.open`. # The behaviour is not guaranteed, but depends on browser support. Valid # values are: -# +# # - 2 opens a new tab, # - 1 opens a new window, # - 0 opens in an existing window. -# +# # See the `webbrowser.open` documentation for details. # Default: 2 # c.ServerApp.webbrowser_open_new = 2 ## Set the tornado compression options for websocket connections. -# +# # This value will be returned from # :meth:`WebSocketHandler.get_compression_options`. None (default) will disable # compression. A dict (even an empty one) will enable compression. -# +# # See the tornado docs for WebSocketHandler.get_compression_options for details. # Default: None # c.ServerApp.websocket_compression_options = None ## The base URL for websockets, # if it differs from the HTTP server (hint: it almost certainly doesn't). -# +# # Should be in the form of an HTTP origin: ws[s]://hostname[:port] # Default: '' # c.ServerApp.websocket_url = '' -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # ConnectionFileMixin(LoggingConfigurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## Mixin for configurable classes that work with connection files ## JSON file in which to store connection info [default: kernel-.json] -# +# # This file will contain the IP, ports, and authentication key needed to connect # clients to this kernel. By default, this file will be created in the security dir # of the current profile, but can be specified by absolute path. @@ -630,11 +630,11 @@ # Default: 'tcp' # c.ConnectionFileMixin.transport = 'tcp' -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # KernelManager(ConnectionFileMixin) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## Manages a single kernel in a subprocess on this host. -# +# # This version starts kernels with Popen. ## Should we autorestart the kernel if it dies. @@ -683,33 +683,33 @@ # See also: ConnectionFileMixin.transport # c.KernelManager.transport = 'tcp' -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Session(Configurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## Object for handling serialization and sending of messages. -# +# # The Session object handles building messages and sending them # with ZMQ sockets or ZMQStream objects. Objects can communicate with each # other over the network via Session objects, and only need to work with the # dict-based IPython message spec. The Session will handle # serialization/deserialization, security, and metadata. -# +# # Sessions support configurable serialization via packer/unpacker traits, # and signing with HMAC digests via the key/keyfile traits. -# +# # Parameters # ---------- -# +# # debug : bool # whether to trigger extra debugging statements # packer/unpacker : str : 'json', 'pickle' or import_string # importstrings for methods to serialize message parts. If just # 'json' or 'pickle', predefined JSON and pickle packers will be used. # Otherwise, the entire importstring must be used. -# +# # The functions must accept at least valid JSON input, and output # *bytes*. -# +# # For example, to use msgpack: # packer = 'msgpack.packb', unpacker='msgpack.unpackb' # pack/unpack : callables @@ -731,7 +731,7 @@ # c.Session.buffer_threshold = 1024 ## Whether to check PID to protect against calls after fork. -# +# # This check can be disabled if fork-safety is handled elsewhere. # Default: True # c.Session.check_pid = True @@ -745,7 +745,7 @@ # c.Session.debug = False ## The maximum number of digests to remember. -# +# # The digest history will be culled when it exceeds this value. # Default: 65536 # c.Session.digest_history_size = 65536 @@ -792,9 +792,9 @@ # Default: 'username' # c.Session.username = 'username' -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # MultiKernelManager(LoggingConfigurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## A class for managing multiple kernels. ## The name of the default kernel to start @@ -810,9 +810,9 @@ # Default: True # c.MultiKernelManager.shared_context = True -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # MappingKernelManager(MultiKernelManager) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## A KernelManager that handles # - File mapping # - HTTP error handling @@ -829,10 +829,10 @@ ## Whether messages from kernels whose frontends have disconnected should be # buffered in-memory. -# +# # When True (default), messages are buffered and replayed on reconnect, # avoiding lost messages due to interrupted connectivity. -# +# # Disable if long-running kernels will produce too much output while # no frontends are connected. # Default: True @@ -864,7 +864,7 @@ # c.MappingKernelManager.default_kernel_name = 'python3' ## Timeout for giving up on a kernel (in seconds). -# +# # On starting and restarting kernels, we check whether the # kernel is running and responsive by sending kernel_info_requests. # This sets the timeout in seconds for how long the kernel can take @@ -889,13 +889,13 @@ # Default: 'An exception occurred at runtime, which is not shown due to security reasons.' # c.MappingKernelManager.traceback_replacement_message = 'An exception occurred at runtime, which is not shown due to security reasons.' -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # KernelSpecManager(LoggingConfigurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## A manager for kernel specs. ## List of allowed kernel names. -# +# # By default, all installed kernels are allowed. # Default: set() # c.KernelSpecManager.allowed_kernelspecs = set() @@ -914,9 +914,9 @@ # Default: set() # c.KernelSpecManager.whitelist = set() -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # AsyncMultiKernelManager(MultiKernelManager) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## The name of the default kernel to start # See also: MultiKernelManager.default_kernel_name # c.AsyncMultiKernelManager.default_kernel_name = 'python3' @@ -935,9 +935,9 @@ # Default: False # c.AsyncMultiKernelManager.use_pending_kernels = False -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # AsyncMappingKernelManager(MappingKernelManager, AsyncMultiKernelManager) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## An asynchronous mapping kernel manager. ## Whether to send tracebacks to clients on exceptions. @@ -998,19 +998,19 @@ # See also: AsyncMultiKernelManager.use_pending_kernels # c.AsyncMappingKernelManager.use_pending_kernels = False -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # ContentsManager(LoggingConfigurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## Base class for serving files and directories. -# +# # This serves any text or binary file, # as well as directories, # with special handling for JSON notebook documents. -# +# # Most APIs take a path argument, # which is always an API-style unicode path, # and always refers to a directory. -# +# # - unicode, not url-escaped # - '/'-separated # - leading and trailing '/' will be stripped @@ -1034,19 +1034,19 @@ # c.ContentsManager.event_logger = None ## handler class to use when serving raw file requests. -# +# # Default is a fallback that talks to the ContentsManager API, # which may be inefficient, especially for large files. -# +# # Local files-based ContentsManagers can use a StaticFileHandler subclass, # which will be much more efficient. -# +# # Access to these files should be Authenticated. # Default: 'jupyter_server.files.handlers.FilesHandler' # c.ContentsManager.files_handler_class = 'jupyter_server.files.handlers.FilesHandler' ## Extra parameters to pass to files_handler_class. -# +# # For example, StaticFileHandlers generally expect a `path` argument # specifying the root directory from which to serve files. # Default: {} @@ -1057,16 +1057,16 @@ # c.ContentsManager.hide_globs = ['__pycache__', '*.pyc', '*.pyo', '.DS_Store', '*.so', '*.dylib', '*~'] ## Python callable or importstring thereof -# +# # to be called on the path of a file just saved. -# +# # This can be used to process the file on disk, # such as converting the notebook to a script or HTML via nbconvert. -# +# # It will be called as (all arguments passed by keyword):: -# +# # hook(os_path=os_path, model=model, contents_manager=instance) -# +# # - path: the filesystem path to the file just written # - model: the model representing the file # - contents_manager: this ContentsManager instance @@ -1074,17 +1074,17 @@ # c.ContentsManager.post_save_hook = None ## Python callable or importstring thereof -# +# # To be called on a contents model prior to save. -# +# # This can be used to process the structure, # such as removing notebook outputs or other side effects that # should not be saved. -# +# # It will be called as (all arguments passed by keyword):: -# +# # hook(path=path, model=model, contents_manager=self) -# +# # - model: the model to be saved. Includes file contents. # Modifying this dict will affect the file that is stored. # - path: the API path of the save destination @@ -1112,20 +1112,20 @@ # Default: 'Untitled' # c.ContentsManager.untitled_notebook = 'Untitled' -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # FileManagerMixin(Configurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## Mixin for ContentsAPI classes that interact with the filesystem. -# +# # Provides facilities for reading, writing, and copying files. -# +# # Shared by FileContentsManager and FileCheckpoints. -# +# # Note ---- Classes using this mixin must provide the following attributes: -# +# # root_dir : unicode # A directory against against which API-style paths are to be resolved. -# +# # log : logging.Logger ## By default notebooks are saved on disk on a temporary file and then if succefully written, it replaces the old ones. @@ -1134,9 +1134,9 @@ # Default: True # c.FileManagerMixin.use_atomic_writing = True -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # FileContentsManager(FileManagerMixin, ContentsManager) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## A file contents manager. ## Allow access to hidden files @@ -1177,7 +1177,7 @@ # See also: ContentsManager.files_handler_params # c.FileContentsManager.files_handler_params = {} -## +## # See also: ContentsManager.hide_globs # c.FileContentsManager.hide_globs = ['__pycache__', '*.pyc', '*.pyo', '.DS_Store', '*.so', '*.dylib', '*~'] @@ -1218,9 +1218,9 @@ # See also: FileManagerMixin.use_atomic_writing # c.FileContentsManager.use_atomic_writing = True -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # AsyncContentsManager(ContentsManager) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## Base class for serving files and directories asynchronously. ## Allow access to hidden files @@ -1247,7 +1247,7 @@ # See also: ContentsManager.files_handler_params # c.AsyncContentsManager.files_handler_params = {} -## +## # See also: ContentsManager.hide_globs # c.AsyncContentsManager.hide_globs = ['__pycache__', '*.pyc', '*.pyo', '.DS_Store', '*.so', '*.dylib', '*~'] @@ -1279,9 +1279,9 @@ # See also: ContentsManager.untitled_notebook # c.AsyncContentsManager.untitled_notebook = 'Untitled' -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # AsyncFileManagerMixin(FileManagerMixin) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## Mixin for ContentsAPI classes that interact with the filesystem # asynchronously. @@ -1290,9 +1290,9 @@ # See also: FileManagerMixin.use_atomic_writing # c.AsyncFileManagerMixin.use_atomic_writing = True -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # AsyncFileContentsManager(FileContentsManager, AsyncFileManagerMixin, AsyncContentsManager) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## An async file contents manager. ## Allow access to hidden files @@ -1327,7 +1327,7 @@ # See also: ContentsManager.files_handler_params # c.AsyncFileContentsManager.files_handler_params = {} -## +## # See also: ContentsManager.hide_globs # c.AsyncFileContentsManager.hide_globs = ['__pycache__', '*.pyc', '*.pyo', '.DS_Store', '*.so', '*.dylib', '*~'] @@ -1368,9 +1368,9 @@ # See also: FileManagerMixin.use_atomic_writing # c.AsyncFileContentsManager.use_atomic_writing = True -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # NotebookNotary(LoggingConfigurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## A class for computing and verifying notebook signatures. ## The hashing algorithm used to sign notebooks. @@ -1401,9 +1401,9 @@ # Default: traitlets.Undefined # c.NotebookNotary.store_factory = traitlets.Undefined -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # GatewayMappingKernelManager(AsyncMappingKernelManager) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## Kernel manager that supports remote kernels hosted by Jupyter Kernel or # Enterprise Gateway. @@ -1465,9 +1465,9 @@ # See also: AsyncMultiKernelManager.use_pending_kernels # c.GatewayMappingKernelManager.use_pending_kernels = False -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # GatewayKernelSpecManager(KernelSpecManager) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## A gateway kernel spec manager. ## List of allowed kernel names. @@ -1486,9 +1486,9 @@ # See also: KernelSpecManager.whitelist # c.GatewayKernelSpecManager.whitelist = set() -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # SessionManager(LoggingConfigurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## A session manager. ## The filesystem path to SQLite Database file (e.g. @@ -1498,9 +1498,9 @@ # Default: ':memory:' # c.SessionManager.database_filepath = ':memory:' -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # GatewaySessionManager(SessionManager) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## A gateway session manager. ## The filesystem path to SQLite Database file (e.g. @@ -1510,9 +1510,9 @@ # See also: SessionManager.database_filepath # c.GatewaySessionManager.database_filepath = ':memory:' -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # BaseKernelWebsocketConnection(LoggingConfigurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## A configurable base class for connecting Kernel WebSockets to ZMQ sockets. ## Preferred kernel message protocol over websocket to use (default: None). If an @@ -1525,9 +1525,9 @@ # Default: None # c.BaseKernelWebsocketConnection.session = None -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # GatewayWebSocketConnection(BaseKernelWebsocketConnection) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## Web socket connection that proxies to a kernel/enterprise gateway. ## Preferred kernel message protocol over websocket to use (default: None). If an @@ -1540,9 +1540,9 @@ # See also: BaseKernelWebsocketConnection.session # c.GatewayWebSocketConnection.session = None -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # GatewayClient(SingletonConfigurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## This class manages the configuration. It's its own singleton class so # that we can share these values across all objects. It also contains some # options. @@ -1564,13 +1564,13 @@ ## The authorization header's key name (typically 'Authorization') used in the # HTTP headers. The header will be formatted as:: -# +# # {'{auth_header_key}': '{auth_scheme} {auth_token}'} -# +# # If the authorization header key takes a single value, `auth_scheme` should be # set to None and 'auth_token' should be configured to use the appropriate # value. -# +# # (JUPYTER_GATEWAY_AUTH_HEADER_KEY env var) # Default: '' # c.GatewayClient.auth_header_key = '' @@ -1582,9 +1582,9 @@ ## The authorization token used in the HTTP headers. The header will be formatted # as:: -# +# # {'{auth_header_key}': '{auth_scheme} {auth_token}'} -# +# # (JUPYTER_GATEWAY_AUTH_TOKEN env var) # Default: None # c.GatewayClient.auth_token = None @@ -1694,24 +1694,24 @@ # Default: None # c.GatewayClient.ws_url = None -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # EventLogger(LoggingConfigurable) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## An Event logger for emitting structured events. -# +# # Event schemas must be registered with the EventLogger using the # `register_schema` or `register_schema_file` methods. Every schema will be # validated against Jupyter Event's metaschema. ## A list of logging.Handler instances to send events to. -# +# # When set to None (the default), all events are discarded. # Default: None # c.EventLogger.handlers = None -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # ZMQChannelsWebsocketConnection(BaseKernelWebsocketConnection) configuration -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ ## A Jupyter Server Websocket Connection ## (bytes/sec) diff --git a/docs/conf.py b/docs/conf.py index 548638b24..e359d9428 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -21,9 +21,10 @@ import shutil import sys from distutils.dir_util import copy_tree -import sphinx_autosummary_accessors from pathlib import Path +import sphinx_autosummary_accessors + # This is not needed sys.path.insert(0, os.path.abspath("..")) import ra2ce diff --git a/examples/hackathons/20240326_hackathon/user_question_1/convert_floodmaps_to_wgs84.py b/examples/hackathons/20240326_hackathon/user_question_1/convert_floodmaps_to_wgs84.py index e3d25880c..71ac5531f 100644 --- a/examples/hackathons/20240326_hackathon/user_question_1/convert_floodmaps_to_wgs84.py +++ b/examples/hackathons/20240326_hackathon/user_question_1/convert_floodmaps_to_wgs84.py @@ -1,8 +1,8 @@ -import sys import gc -import xarray as xr +import sys from pathlib import Path +import xarray as xr # Input and output folder paths _input_folder = Path(sys.argv[0]) diff --git a/examples/hackathons/20240326_hackathon/user_question_1/post_processing.py b/examples/hackathons/20240326_hackathon/user_question_1/post_processing.py index 6c2e418ed..201112686 100644 --- a/examples/hackathons/20240326_hackathon/user_question_1/post_processing.py +++ b/examples/hackathons/20240326_hackathon/user_question_1/post_processing.py @@ -1,19 +1,18 @@ from pathlib import Path -import pandas as pd + import geopandas as gpd +import pandas as pd # set the required parameters -cloud_output_folder = Path('/data') +cloud_output_folder = Path("/data") -event_names = [folder.stem for folder in cloud_output_folder.iterdir() if folder.is_dir()] +event_names = [ + folder.stem for folder in cloud_output_folder.iterdir() if folder.is_dir() +] # save as a .py script aggregate_wl = "max" # this we should get from network_config or analysis_config -aggregate_wls = { - "max": "ma", - "mean": "me", - "min": "mi" -} +aggregate_wls = {"max": "ma", "mean": "me", "min": "mi"} aggregate_wl_column = aggregate_wls[aggregate_wl] event_wl_column = "EV1_" + aggregate_wl_column @@ -21,18 +20,29 @@ fid_column = "rfid" for i, event_name in enumerate(event_names): - overlay_output_path = cloud_output_folder / event_name / "static" / "output_graph" / "base_graph_hazard_edges.gpkg" + overlay_output_path = ( + cloud_output_folder + / event_name + / "static" + / "output_graph" + / "base_graph_hazard_edges.gpkg" + ) overlay_output_gdf = gpd.read_file(overlay_output_path) - + # Define the mapping of EV1_ column names to event_name - column_mapping = {event_wl_column: f"{event_name}_" + aggregate_wl_column, event_fraction_column: f"{event_name}_fr"} + column_mapping = { + event_wl_column: f"{event_name}_" + aggregate_wl_column, + event_fraction_column: f"{event_name}_fr", + } overlay_output_gdf = overlay_output_gdf.rename(columns=column_mapping) if i == 0: # create the base gdf that aggregate all results result_gdf = overlay_output_gdf else: - filtered_overlay_output_gdf = overlay_output_gdf[[fid_column, f"{event_name}_" + aggregate_wl_column, f"{event_name}_fr"]] + filtered_overlay_output_gdf = overlay_output_gdf[ + [fid_column, f"{event_name}_" + aggregate_wl_column, f"{event_name}_fr"] + ] result_gdf = pd.merge( result_gdf, filtered_overlay_output_gdf, @@ -42,5 +52,5 @@ gdf = result_gdf -gdf.to_file('/output/result_gdf.geojson', driver="GeoJSON") -gdf.to_feather('/output/result_gdf.feather') \ No newline at end of file +gdf.to_file("/output/result_gdf.geojson", driver="GeoJSON") +gdf.to_feather("/output/result_gdf.feather") diff --git a/examples/hackathons/20240326_hackathon/user_question_2/post_processing.py b/examples/hackathons/20240326_hackathon/user_question_2/post_processing.py index 48946c337..bafbfb361 100644 --- a/examples/hackathons/20240326_hackathon/user_question_2/post_processing.py +++ b/examples/hackathons/20240326_hackathon/user_question_2/post_processing.py @@ -1,6 +1,7 @@ from pathlib import Path -import pandas as pd + import geopandas as gpd +import pandas as pd # set the required parameters cloud_output_folder = Path("/data") diff --git a/infra/workflow/run_argo.py b/infra/workflow/run_argo.py index a4495d58d..c0abc0e7e 100644 --- a/infra/workflow/run_argo.py +++ b/infra/workflow/run_argo.py @@ -1,28 +1,38 @@ ## This script can be used as a template to create Argo workflows using Python code (instead of a YAML file) +import os + from hera import Task, Workflow, WorkflowService, WorkflowStatus from hera.global_config import GlobalConfig -import os GlobalConfig.host = "" GlobalConfig.verify_ssl = False GlobalConfig.token = "" GlobalConfig.namespace = "argo" -class Argo: +class Argo: def __init__(self, name): pass def submit_single_job(model): - with Workflow(model.name.replace('_', '-'), generate_name=True, workflow_template_ref="race-workflow") as w: - Task("ra2ce-argo", image="containers.deltares.nl/ra2ce/ra2ce:latest", command=["/bin/bash", "-c", "--"], args= ["python", "/scripts/run_race.py"]) + with Workflow( + model.name.replace("_", "-"), + generate_name=True, + workflow_template_ref="race-workflow", + ) as w: + Task( + "ra2ce-argo", + image="containers.deltares.nl/ra2ce/ra2ce:latest", + command=["/bin/bash", "-c", "--"], + args=["python", "/scripts/run_race.py"], + ) return w.create() def get_task_status(workflow): status = workflow.get_status() - + if status == WorkflowStatus.Succeeded: return True diff --git a/scripts/make_exe.py b/scripts/make_exe.py index bf66eeba7..603ed2605 100644 --- a/scripts/make_exe.py +++ b/scripts/make_exe.py @@ -1,10 +1,12 @@ +from datetime import datetime +from os import environ from pathlib import Path + import PyInstaller.__main__ +from pyinstaller_versionfile import create_versionfile + from ra2ce import __main__ as cli_module from ra2ce import __version__ -from os import environ -from pyinstaller_versionfile import create_versionfile -from datetime import datetime _conda_env = Path(environ["CONDA_PREFIX"]) _root_dir = Path(__file__).parent.parent