diff --git a/.gitignore b/.gitignore index a0a267b4..67f15e11 100644 --- a/.gitignore +++ b/.gitignore @@ -5,30 +5,36 @@ # Generated docs output. docs/_build/ # Misc python. -__pycache__ +__pycache__/ .coverage .coverage.* -*.egg-info -.ipynb_checkpoints +*.egg-info/ +.ipynb_checkpoints/ +.pytest_cache/ +.ruff_cache/ +.venv/ + +# Redis dumps. +dump.rdb # vim swap files *.sw[a-z] # build output -**/build -/dist +**/build/ +/dist/ # Folder tracking files .DS_Store # Vendored ketcher. -**/ketcher -**/standalone +**/ketcher/ +**/standalone/ # Node stuff. -**/node_modules +**/node_modules/ # React dependencies **/.pnp **/.pnp.js # testing -**/coverage +**/coverage/ # misc **/.DS_Store diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index ee5de473..00000000 --- a/.pylintrc +++ /dev/null @@ -1,509 +0,0 @@ -[MASTER] - -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code. -extension-pkg-whitelist=google.protobuf - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Add files or directories matching the regex patterns to the blacklist. The -# regex matches against base names, not paths. -ignore-patterns=.*_pb2\.py, - .*_test\.py - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the -# number of processors available to use. -jobs=1 - -# Control the amount of potential inferred values when inferring a single -# object. This can help the performance when dealing with large functions or -# complex, nested conditions. -limit-inference-results=100 - -# List of plugins (as comma separated values of python module names) to load, -# usually to register additional checkers. -load-plugins= - -# Pickle collected data for later comparisons. -persistent=yes - -# Specify a configuration file. -#rcfile= - -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode=yes - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED. -confidence= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once). You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use "--disable=all --enable=classes -# --disable=W". -disable=fixme, - logging-fstring-interpolation, - similarities, - too-few-public-methods, - unspecified-encoding - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. -enable=c-extension-no-member - - -[REPORTS] - -# Python expression which should return a score less than or equal to 10. You -# have access to the variables 'error', 'warning', 'refactor', and 'convention' -# which contain the number of messages in each category, as well as 'statement' -# which is the total number of statements analyzed. This score is used by the -# global evaluation report (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details. -#msg-template= - -# Set the output format. Available formats are text, parseable, colorized, json -# and msvs (visual studio). You can also give a reporter class, e.g. -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Tells whether to display a full report or only the messages. -reports=no - -# Activate the evaluation score. -score=yes - - -[REFACTORING] - -# Maximum number of nested blocks for function / method body -max-nested-blocks=5 - -# Complete name of functions that never returns. When checking for -# inconsistent-return-statements if a never returning function is called then -# it will be considered as an explicit return statement and no message will be -# printed. -never-returning-functions=sys.exit - - -[LOGGING] - -# Format style used to check logging format string. `old` means using % -# formatting, `new` is for `{}` formatting,and `fstr` is for f-strings. -logging-format-style=old - -# Logging modules to check that the string format arguments are in logging -# function parameter format. -logging-modules=logging - - -[SPELLING] - -# Limits count of emitted suggestions for spelling mistakes. -max-spelling-suggestions=4 - -# Spelling dictionary name. Available dictionaries: none. To make it work, -# install the python-enchant package. -spelling-dict= - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains the private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to the private dictionary (see the -# --spelling-private-dict-file option) instead of raising a message. -spelling-store-unknown-words=no - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME, - XXX, - TODO - - -[TYPECHECK] - -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators=contextlib.contextmanager - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. -generated-members= - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# Tells whether to warn about missing members when the owner of the attribute -# is inferred to be None. -ignore-none=yes - -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference -# can return multiple potential results while evaluating a Python object, but -# some branches might not be evaluated, which results in partial inference. In -# that case, it might be useful to still emit no-member and other checks for -# the rest of the inferred objects. -ignore-on-opaque-inference=yes - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes=optparse.Values,thread._local,_thread._local - -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis). It -# supports qualified module names, as well as Unix pattern matching. -ignored-modules=*_pb2, - google.protobuf.pyext, - absl.testing, - rdkit.*, - psycopg2.errors - -# Show a hint with possible names when a member name was not found. The aspect -# of finding the hint is based on edit distance. -missing-member-hint=yes - -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. -missing-member-hint-distance=1 - -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. -missing-member-max-choices=1 - -# List of decorators that change the signature of a decorated function. -signature-mutators= - - -[VARIABLES] - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid defining new builtins when possible. -additional-builtins= - -# Tells whether unused global variables should be treated as a violation. -allow-global-unused-variables=yes - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_, - _cb - -# A regular expression matching the name of dummy variables (i.e. expected to -# not be used). -dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore. -ignored-argument-names=_.*|^ignored_|^unused_ - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io - - -[FORMAT] - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - -# Maximum number of characters on a single line. -max-line-length=120 - -# Maximum number of lines in a module. -max-module-lines=1500 - -# Allow the body of a class to be on the same line as the declaration if body -# contains single statement. -single-line-class-stmt=no - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=no - - -[SIMILARITIES] - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - -# Ignore imports when computing similarities. -ignore-imports=no - -# Minimum lines number of a similarity. -min-similarity-lines=10 - - -[BASIC] - -# Naming style matching correct argument names. -argument-naming-style=snake_case - -# Regular expression matching correct argument names. Overrides argument- -# naming-style. -#argument-rgx= - -# Naming style matching correct attribute names. -attr-naming-style=snake_case - -# Regular expression matching correct attribute names. Overrides attr-naming- -# style. -#attr-rgx= - -# Bad variable names which should always be refused, separated by a comma. -bad-names=foo, - bar, - baz, - toto, - tutu, - tata - -# Naming style matching correct class attribute names. -class-attribute-naming-style=any - -# Regular expression matching correct class attribute names. Overrides class- -# attribute-naming-style. -#class-attribute-rgx= - -# Naming style matching correct class names. -class-naming-style=PascalCase - -# Regular expression matching correct class names. Overrides class-naming- -# style. -#class-rgx= - -# Naming style matching correct constant names. -const-naming-style=UPPER_CASE - -# Regular expression matching correct constant names. Overrides const-naming- -# style. -#const-rgx= - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=5 - -# Naming style matching correct function names. -function-naming-style=snake_case - -# Regular expression matching correct function names. Overrides function- -# naming-style. -#function-rgx= - -# Good variable names which should always be accepted, separated by a comma. -good-names=i, - j, - k, - ex, - Run, - _, - f, - db, - df - -# Include a hint for the correct naming format with invalid-name. -include-naming-hint=no - -# Naming style matching correct inline iteration names. -inlinevar-naming-style=any - -# Regular expression matching correct inline iteration names. Overrides -# inlinevar-naming-style. -#inlinevar-rgx= - -# Naming style matching correct method names. -method-naming-style=snake_case - -# Regular expression matching correct method names. Overrides method-naming- -# style. -# Adapted from https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/ci_build/pylintrc -method-rgx=^(?:(?P__[a-z0-9_]+__|next)|(?P_{0,2}[a-z][a-z0-9_]*))|setUp$ - -# Naming style matching correct module names. -module-naming-style=snake_case - -# Regular expression matching correct module names. Overrides module-naming- -# style. -#module-rgx= - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_|^test|.*Test$|^main$|^setUp$ - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -# These decorators are taken in consideration only for invalid-name. -property-classes=abc.abstractproperty - -# Naming style matching correct variable names. -variable-naming-style=snake_case - -# Regular expression matching correct variable names. Overrides variable- -# naming-style. -#variable-rgx= - - -[STRING] - -# This flag controls whether the implicit-str-concat-in-sequence should -# generate a warning on implicit string concatenation in sequences defined over -# several lines. -check-str-concat-over-line-jumps=no - - -[IMPORTS] - -# List of modules that can be imported at any level, not just the top level -# one. -allow-any-import-level= - -# Allow wildcard imports from modules that define __all__. -allow-wildcard-with-all=no - -# Analyse import fallback blocks. This can be used to support both Python 2 and -# 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. -analyse-fallback-blocks=no - -# Deprecated modules which should not be used, separated by a comma. -deprecated-modules=optparse,tkinter.tix - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled). -ext-import-graph= - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled). -import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled). -int-import-graph= - -# Force import order to recognize a module as part of the standard -# compatibility libraries. -known-standard-library= - -# Force import order to recognize a module as part of a third party library. -known-third-party=enchant - -# Couples of modules and preferred modules, separated by a comma. -preferred-modules= - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__, - __new__, - setUp, - __post_init__ - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict, - _fields, - _replace, - _source, - _make - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=cls - - -[DESIGN] - -# Maximum number of arguments for function / method. -max-args=6 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Maximum number of boolean expressions in an if statement (see R0916). -max-bool-expr=5 - -# Maximum number of branch for function / method body. -max-branches=12 - -# Maximum number of locals for function / method body. -max-locals=15 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - -# Maximum number of return / yield for function / method body. -max-returns=6 - -# Maximum number of statements in function / method body. -max-statements=50 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "BaseException, Exception". -overgeneral-exceptions=builtins.BaseException, - builtins.Exception diff --git a/.style.yapf b/.style.yapf deleted file mode 100644 index 5aeda09a..00000000 --- a/.style.yapf +++ /dev/null @@ -1,394 +0,0 @@ -[style] -# Align closing bracket with visual indentation. -align_closing_bracket_with_visual_indent=False - -# Allow dictionary keys to exist on multiple lines. For example: -# -# x = { -# ('this is the first element of a tuple', -# 'this is the second element of a tuple'): -# value, -# } -allow_multiline_dictionary_keys=False - -# Allow lambdas to be formatted on more than one line. -allow_multiline_lambdas=False - -# Allow splitting before a default / named assignment in an argument list. -allow_split_before_default_or_named_assigns=True - -# Allow splits before the dictionary value. -allow_split_before_dict_value=True - -# Let spacing indicate operator precedence. For example: -# -# a = 1 * 2 + 3 / 4 -# b = 1 / 2 - 3 * 4 -# c = (1 + 2) * (3 - 4) -# d = (1 - 2) / (3 + 4) -# e = 1 * 2 - 3 -# f = 1 + 2 + 3 + 4 -# -# will be formatted as follows to indicate precedence: -# -# a = 1*2 + 3/4 -# b = 1/2 - 3*4 -# c = (1+2) * (3-4) -# d = (1-2) / (3+4) -# e = 1*2 - 3 -# f = 1 + 2 + 3 + 4 -# -arithmetic_precedence_indication=False - -# Number of blank lines surrounding top-level function and class -# definitions. -blank_lines_around_top_level_definition=2 - -# Insert a blank line before a class-level docstring. -blank_line_before_class_docstring=False - -# Insert a blank line before a module docstring. -blank_line_before_module_docstring=False - -# Insert a blank line before a 'def' or 'class' immediately nested -# within another 'def' or 'class'. For example: -# -# class Foo: -# # <------ this blank line -# def method(): -# ... -blank_line_before_nested_class_or_def=True - -# Do not split consecutive brackets. Only relevant when -# dedent_closing_brackets is set. For example: -# -# call_func_that_takes_a_dict( -# { -# 'key1': 'value1', -# 'key2': 'value2', -# } -# ) -# -# would reformat to: -# -# call_func_that_takes_a_dict({ -# 'key1': 'value1', -# 'key2': 'value2', -# }) -coalesce_brackets=False - -# The column limit. -column_limit=80 - -# The style for continuation alignment. Possible values are: -# -# - SPACE: Use spaces for continuation alignment. This is default behavior. -# - FIXED: Use fixed number (CONTINUATION_INDENT_WIDTH) of columns -# (ie: CONTINUATION_INDENT_WIDTH/INDENT_WIDTH tabs or -# CONTINUATION_INDENT_WIDTH spaces) for continuation alignment. -# - VALIGN-RIGHT: Vertically align continuation lines to multiple of -# INDENT_WIDTH columns. Slightly right (one tab or a few spaces) if -# cannot vertically align continuation lines with indent characters. -continuation_align_style=SPACE - -# Indent width used for line continuations. -continuation_indent_width=4 - -# Put closing brackets on a separate line, dedented, if the bracketed -# expression can't fit in a single line. Applies to all kinds of brackets, -# including function definitions and calls. For example: -# -# config = { -# 'key1': 'value1', -# 'key2': 'value2', -# } # <--- this bracket is dedented and on a separate line -# -# time_series = self.remote_client.query_entity_counters( -# entity='dev3246.region1', -# key='dns.query_latency_tcp', -# transform=Transformation.AVERAGE(window=timedelta(seconds=60)), -# start_ts=now()-timedelta(days=3), -# end_ts=now(), -# ) # <--- this bracket is dedented and on a separate line -dedent_closing_brackets=False - -# Disable the heuristic which places each list element on a separate line -# if the list is comma-terminated. -disable_ending_comma_heuristic=False - -# Place each dictionary entry onto its own line. -each_dict_entry_on_separate_line=True - -# Require multiline dictionary even if it would normally fit on one line. -# For example: -# -# config = { -# 'key1': 'value1' -# } -force_multiline_dict=False - -# The regex for an i18n comment. The presence of this comment stops -# reformatting of that line, because the comments are required to be -# next to the string they translate. -i18n_comment=#\..* - -# The i18n function call names. The presence of this function stops -# reformattting on that line, because the string it has cannot be moved -# away from the i18n comment. -i18n_function_call=N_, _ - -# Indent blank lines. -indent_blank_lines=False - -# Put closing brackets on a separate line, indented, if the bracketed -# expression can't fit in a single line. Applies to all kinds of brackets, -# including function definitions and calls. For example: -# -# config = { -# 'key1': 'value1', -# 'key2': 'value2', -# } # <--- this bracket is indented and on a separate line -# -# time_series = self.remote_client.query_entity_counters( -# entity='dev3246.region1', -# key='dns.query_latency_tcp', -# transform=Transformation.AVERAGE(window=timedelta(seconds=60)), -# start_ts=now()-timedelta(days=3), -# end_ts=now(), -# ) # <--- this bracket is indented and on a separate line -indent_closing_brackets=False - -# Indent the dictionary value if it cannot fit on the same line as the -# dictionary key. For example: -# -# config = { -# 'key1': -# 'value1', -# 'key2': value1 + -# value2, -# } -indent_dictionary_value=True - -# The number of columns to use for indentation. -indent_width=4 - -# Join short lines into one line. E.g., single line 'if' statements. -join_multiple_lines=False - -# Do not include spaces around selected binary operators. For example: -# -# 1 + 2 * 3 - 4 / 5 -# -# will be formatted as follows when configured with "*,/": -# -# 1 + 2*3 - 4/5 -no_spaces_around_selected_binary_operators= - -# Use spaces around default or named assigns. -spaces_around_default_or_named_assign=False - -# Adds a space after the opening '{' and before the ending '}' dict delimiters. -# -# {1: 2} -# -# will be formatted as: -# -# { 1: 2 } -spaces_around_dict_delimiters=False - -# Adds a space after the opening '[' and before the ending ']' list delimiters. -# -# [1, 2] -# -# will be formatted as: -# -# [ 1, 2 ] -spaces_around_list_delimiters=False - -# Use spaces around the power operator. -spaces_around_power_operator=False - -# Use spaces around the subscript / slice operator. For example: -# -# my_list[1 : 10 : 2] -spaces_around_subscript_colon=False - -# Adds a space after the opening '(' and before the ending ')' tuple delimiters. -# -# (1, 2, 3) -# -# will be formatted as: -# -# ( 1, 2, 3 ) -spaces_around_tuple_delimiters=False - -# The number of spaces required before a trailing comment. -# This can be a single value (representing the number of spaces -# before each trailing comment) or list of values (representing -# alignment column values; trailing comments within a block will -# be aligned to the first column value that is greater than the maximum -# line length within the block). For example: -# -# With spaces_before_comment=5: -# -# 1 + 1 # Adding values -# -# will be formatted as: -# -# 1 + 1 # Adding values <-- 5 spaces between the end of the statement and comment -# -# With spaces_before_comment=15, 20: -# -# 1 + 1 # Adding values -# two + two # More adding -# -# longer_statement # This is a longer statement -# short # This is a shorter statement -# -# a_very_long_statement_that_extends_beyond_the_final_column # Comment -# short # This is a shorter statement -# -# will be formatted as: -# -# 1 + 1 # Adding values <-- end of line comments in block aligned to col 15 -# two + two # More adding -# -# longer_statement # This is a longer statement <-- end of line comments in block aligned to col 20 -# short # This is a shorter statement -# -# a_very_long_statement_that_extends_beyond_the_final_column # Comment <-- the end of line comments are aligned based on the line length -# short # This is a shorter statement -# -spaces_before_comment=2 - -# Insert a space between the ending comma and closing bracket of a list, -# etc. -space_between_ending_comma_and_closing_bracket=False - -# Use spaces inside brackets, braces, and parentheses. For example: -# -# method_call( 1 ) -# my_dict[ 3 ][ 1 ][ get_index( *args, **kwargs ) ] -# my_set = { 1, 2, 3 } -space_inside_brackets=False - -# Split before arguments -split_all_comma_separated_values=False - -# Split before arguments, but do not split all subexpressions recursively -# (unless needed). -split_all_top_level_comma_separated_values=False - -# Split before arguments if the argument list is terminated by a -# comma. -split_arguments_when_comma_terminated=False - -# Set to True to prefer splitting before '+', '-', '*', '/', '//', or '@' -# rather than after. -split_before_arithmetic_operator=False - -# Set to True to prefer splitting before '&', '|' or '^' rather than -# after. -split_before_bitwise_operator=False - -# Split before the closing bracket if a list or dict literal doesn't fit on -# a single line. -split_before_closing_bracket=True - -# Split before a dictionary or set generator (comp_for). For example, note -# the split before the 'for': -# -# foo = { -# variable: 'Hello world, have a nice day!' -# for variable in bar if variable != 42 -# } -split_before_dict_set_generator=False - -# Split before the '.' if we need to split a longer expression: -# -# foo = ('This is a really long string: {}, {}, {}, {}'.format(a, b, c, d)) -# -# would reformat to something like: -# -# foo = ('This is a really long string: {}, {}, {}, {}' -# .format(a, b, c, d)) -split_before_dot=False - -# Split after the opening paren which surrounds an expression if it doesn't -# fit on a single line. -split_before_expression_after_opening_paren=False - -# If an argument / parameter list is going to be split, then split before -# the first argument. -split_before_first_argument=False - -# Set to True to prefer splitting before 'and' or 'or' rather than -# after. -split_before_logical_operator=False - -# Split named assignments onto individual lines. -split_before_named_assigns=True - -# Set to True to split list comprehensions and generators that have -# non-trivial expressions and multiple clauses before each of these -# clauses. For example: -# -# result = [ -# a_long_var + 100 for a_long_var in xrange(1000) -# if a_long_var % 10] -# -# would reformat to something like: -# -# result = [ -# a_long_var + 100 -# for a_long_var in xrange(1000) -# if a_long_var % 10] -split_complex_comprehension=True - -# The penalty for splitting right after the opening bracket. -split_penalty_after_opening_bracket=300 - -# The penalty for splitting the line after a unary operator. -split_penalty_after_unary_operator=10000 - -# The penalty of splitting the line around the '+', '-', '*', '/', '//', -# ``%``, and '@' operators. -split_penalty_arithmetic_operator=300 - -# The penalty for splitting right before an if expression. -split_penalty_before_if_expr=0 - -# The penalty of splitting the line around the '&', '|', and '^' -# operators. -split_penalty_bitwise_operator=300 - -# The penalty for splitting a list comprehension or generator -# expression. -split_penalty_comprehension=2100 - -# The penalty for characters over the column limit. -split_penalty_excess_character=7000 - -# The penalty incurred by adding a line split to the unwrapped line. The -# more line splits added the higher the penalty. -split_penalty_for_added_line_split=30 - -# The penalty of splitting a list of "import as" names. For example: -# -# from a_very_long_or_indented_module_name_yada_yad import (long_argument_1, -# long_argument_2, -# long_argument_3) -# -# would reformat to something like: -# -# from a_very_long_or_indented_module_name_yada_yad import ( -# long_argument_1, long_argument_2, long_argument_3) -split_penalty_import_names=0 - -# The penalty of splitting the line around the 'and' and 'or' -# operators. -split_penalty_logical_operator=300 - -# Use the Tab character for indentation. -use_tabs=False - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 59158b77..12261472 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing to `ord-schema` +# Contributing to `ord-interface` Thanks for helping out! What would you like to do? @@ -8,26 +8,26 @@ Thanks for helping out! What would you like to do? ## Report an issue -Sorry to hear that you're having trouble! Please [file a bug report](https://github.com/Open-Reaction-Database/ord-schema/issues/new?assignees=&labels=bug&template=bug_report.md&title=) to tell us about the problem. +Sorry to hear that you're having trouble! Please [file a bug report](https://github.com/Open-Reaction-Database/ord-interface/issues/new?assignees=&labels=bug&template=bug_report.md&title=) to tell us about the problem. ## Suggest an improvement -Great idea! Please [create a feature request](https://github.com/Open-Reaction-Database/ord-schema/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=) to let us know what you'd like to see. +Great idea! Please [create a feature request](https://github.com/Open-Reaction-Database/ord-interface/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=) to let us know what you'd like to see. ## Make a change Excellent! There are a few steps you'll need to follow to get ready to submit changes for review: -1. Make sure your changes are consistent with the [goals](https://ord-schema.readthedocs.io/en/latest/overview.html#goals) - and [non-goals](https://ord-schema.readthedocs.io/en/latest/overview.html#non-goals) of the database. If your changes - address a long-term need we may ask that it be deferred until sometime in the future. In particular, please avoid - changes that significantly increase the complexity of creating or using the data. +1. Make sure your changes are consistent with the broader Open Reaction Database + [goals](https://ord-schema.readthedocs.io/en/latest/overview.html#goals) and + [non-goals](https://ord-schema.readthedocs.io/en/latest/overview.html#non-goals). If your changes address + a long-term need we may ask that it be deferred until sometime in the future. 1. Make your changes in a [fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-forks) - of the `ord-schema` repository. You can work on GitHub or on your local machine: + of the `ord-interface` repository. You can work on GitHub or on your local machine: ### GitHub - 1. Create a fork of `ord-schema` by clicking the "Fork" button at the top-right of this page. + 1. Create a fork of `ord-interface` by clicking the "Fork" button at the top-right of this page. Note that you only need to do this once---all of your changes can use the same fork. 1. Follow the [GitHub flow](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/github-flow) to make changes and send a pull request to the official repository. While you are making @@ -39,12 +39,12 @@ Excellent! There are a few steps you'll need to follow to get ready to submit ch > :warning: Working on your local machine requires familiarity with > [Git](https://git-scm.com/) or [GitHub Desktop](https://desktop.github.com/). - 1. Create a fork of `ord-schema` (click "Fork" at the top-right of this page) and clone it to your local machine + 1. Create a fork of `ord-interface` (click "Fork" at the top-right of this page) and clone it to your local machine ([instructions](https://help.github.com/en/github/getting-started-with-github/fork-a-repo)). 1. Create a new branch and make your changes. - 1. Test your changes by rebuilding the package (`python setup.py install`) and running the test script provided - in the repo (`./run_tests.sh`). This will be performed automatically when you send a pull request to the - repository, but you can save time by making sure the tests pass locally first. + 1. Test your changes by installing dependencies (`uv sync`) and running the test script provided in the repo + (`./run_tests.sh`). This will be performed automatically when you send a pull request to the repository, + but you can save time by making sure the tests pass locally first. 1. Commit your changes, push them to your fork on GitHub, and send a pull request to the official repository. diff --git a/README.md b/README.md index 04d69832..62da487a 100644 --- a/README.md +++ b/README.md @@ -1,90 +1,80 @@ # ord-interface -Web interface and api for the Open Reaction Database -## Structure -- **/app** - Contains the Vue single page application - - **/public** - Static SPA assets such as index.html - - **/src** - Vue source code that gets compiled - - **/assets** - Images and other static assets - - **/components** - Reusable Vue components that can be included elsewhere - - **/router** - Routing files - - **/styles** - Static .sass files that can be reused throughout the project - - **/utils** - Static helper .js files - - **/views** - Routed Vue components, aka "pages" - - **/browse** - Main browse page of the different reaction sets - - **/reaction-view** - Display of a single reaction from search results - - **/search** - Search interface and results -- **/ord_interface** - Contains the Flask app API and legacy interface - - **/client** - endpoints for the browse and search functionality - - **/editor** - endpoints for the reaction submission functionality - - **/visualization** - helper functions for reaction and molecule visuals - -## Key Caveats / Constraints -- The Vue front end is dependant on the FastAPI server. Both must be running for the frontend to work. -- The test database must be running on port 5432. -- You will need to download the Ketcher interface and extract into appropriate folder (see instructions below) for - parts of the interface to work. -- To run on Windows, you can use WSL (Windows Subsystem for Linux). If using the Docker option, please ensure that Docker is installed and properly enabled for WSL. - -## How to Deploy -...COMING SOON - -## Setup - -### 1. Download and install + +Web interface and FastAPI server for the [Open Reaction Database](https://open-reaction-database.org). + +## Project layout + +- **`app/`** — Vue single-page application (frontend) + - `src/components/` — reusable Vue components + - `src/views/` — routed pages (browse, search, dataset/reaction views) + - `src/router/`, `src/styles/`, `src/utils/`, `src/assets/` +- **`ord_interface/`** — Python backend + - `api/` — FastAPI server (search, view, queries) + - `client/` — utilities for building the Postgres + rdkit-cartridge database + - `visualization/` — Jinja filters and helpers for rendering reactions and molecules + - `editor/` — legacy reaction-submission UI (being removed) + +The Vue frontend talks to the FastAPI server, so both processes need to be running for the UI to work. On Windows, use WSL. + +## Local development + +Prerequisites: [`uv`](https://docs.astral.sh/uv/), Postgres with the [rdkit cartridge](https://www.rdkit.org/docs/Cartridge.html), [`node` + `npm`](https://nodejs.org/). Docker is optional, for the bundled full-stack image. + +### 1. Install Python dependencies ```bash -# you will need git, python, pip, and postgres installed on your computer first git clone https://github.com/open-reaction-database/ord-interface cd ord-interface -# If you are running on Apple silicon, use `conda install postgresql` instead. +# Apple silicon: use `conda install postgresql` instead of the rdkit channel. conda install -c rdkit rdkit-postgresql -pip install -e '.[tests]' +uv sync ``` -### 2. Set up and run the API +### 2. Run the API -#### Option 1: Docker +#### Option A: Docker (bundled Postgres + nginx + gunicorn) ```shell -# you will need Docker installed on your computer first cd ord_interface ./build_test_database.sh -# If you are running on Apple silicon, append `--build-arg="ARCH=aarch_64"` to the next command. +# Apple silicon: append `--build-arg="ARCH=aarch_64"`. docker build --file Dockerfile -t openreactiondatabase/ord-interface .. docker compose up ``` -#### Option 2: Local +`docker compose up` binds Postgres on host port `5432` — stop any local Postgres first. + +#### Option B: FastAPI dev server (in-process testing database) ```shell cd ord_interface/api ORD_INTERFACE_TESTING=TRUE fastapi dev main.py --port=5000 ``` -### 3. Set up and run the Vue SPA - - Download [Ketcher](https://github.com/epam/ketcher/releases/tag/v2.5.1) (Here's a direct link to the [.zip file](https://github.com/epam/ketcher/releases/download/v2.5.1/ketcher-standalone-2.5.1.zip)) and extract the files into `./app/src/ketcher` - - In a new terminal window: - - ```shell - # you will need node.js and npm installed on your computer first - cd ./app - # install node packages - npm i - # run vue spa locally - npm run serve - ``` - - - Open [localhost:8080](http://localhost:8080) to view the Vue ORD interface in your browser. - - The page will reload when you make changes. - - You may also see any lint errors in the console. - -## Updating the Schema - -### Minor changes such as ENUM additions - - The Vue app does not require specific modification to show additional ENUM options within existing message fields. We just have to update the package configuration to use the new ord-schema version. - - Update the ord-schema version number in the [install_requires configuration in ./setup.py](https://github.com/open-reaction-database/ord-interface/blob/aa37f628b176ca241d0701b4df5f6fd7b3079bef/setup.py#L48) - - Update the [code section in ./ord_interface/Dockerfile](https://github.com/open-reaction-database/ord-interface/blob/aa37f628b176ca241d0701b4df5f6fd7b3079bef/ord_interface/Dockerfile#L57C1-L60C38) which handles the ord-schema install - - Contact the ORD site administrator to request upload of the new ord-interface version to the staging environment for testing. - -### Major changes - Where there are more extensive changes to the schema, for example addition of new message types, then the Vue app will need to be modified to show these fields. Please discuss any proposed changes with the ORD team. +### 3. Run the Vue SPA + +Download [Ketcher v2.5.1](https://github.com/epam/ketcher/releases/download/v2.5.1/ketcher-standalone-2.5.1.zip) and extract its contents into `./app/src/ketcher`, then: + +```shell +cd app +npm install +npm run serve +``` + +Open . The page hot-reloads on edit. + +## Deployment + +Production deployment is managed via Pulumi/ECS in the [`ord-infrastructure`](https://github.com/open-reaction-database/ord-infrastructure) repository. + +## Updating ord-schema + +### Minor changes (e.g. enum additions) + +- Update the `ord-schema` specifier in `pyproject.toml` under `[project] dependencies`, then run `uv lock` to refresh `uv.lock`. +- Update the matching version in [`ord_interface/Dockerfile`](./ord_interface/Dockerfile). +- Contact the ORD site administrator to roll out the new version to staging. + +### Major changes (new message types, etc.) + +The Vue app needs to be updated to surface new fields. Please discuss any such proposals with the ORD team before opening a PR. diff --git a/copilot/.workspace b/copilot/.workspace deleted file mode 100644 index c5548e73..00000000 --- a/copilot/.workspace +++ /dev/null @@ -1 +0,0 @@ -application: ord-interface diff --git a/copilot/front-end/manifest.yml b/copilot/front-end/manifest.yml deleted file mode 100644 index c75d486a..00000000 --- a/copilot/front-end/manifest.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2021 Open Reaction Database Project Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# The manifest for the "front-end" service. -# Read the full specification for the "Load Balanced Web Service" type at: -# https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/ - -# Your service name will be used in naming your resources like log groups, ECS services, etc. -name: front-end -type: Load Balanced Web Service - -# Distribute traffic to your service. -http: - # Requests to this path will be forwarded to your service. - # To match all requests you can use the "/" path. - path: '/' - # You can specify a custom health check path. The default is "/". - healthcheck: - path: '/editor/healthcheck' - success_codes: '200,302' - -# Configuration for your containers and service. -image: - build: - dockerfile: ord_interface/Dockerfile - context: . - port: 5001 - -cpu: 1024 # Number of CPU units for the task. -memory: 2048 # Amount of memory in MiB used by the task. -count: # Number of tasks that should be running in your service. - range: - min: 1 - max: 10 - spot_from: 1 - cpu_percentage: 70 - memory_percentage: 80 - requests: 10000 - response_time: 2s - -secrets: - GH_CLIENT_ID: /copilot/ord-editor/secrets/GH_CLIENT_ID - GH_CLIENT_SECRET: /copilot/ord-editor/secrets/GH_CLIENT_SECRET - POSTGRES_HOST: /copilot/ord-interface/secrets/POSTGRES_HOST - POSTGRES_USER: /copilot/ord-interface/secrets/POSTGRES_USER - POSTGRES_PASSWORD: /copilot/ord-interface/secrets/POSTGRES_PASSWORD - POSTGRES_DATABASE: /copilot/ord-interface/secrets/POSTGRES_DATABASE diff --git a/dump.rdb b/dump.rdb deleted file mode 100644 index 5782721c..00000000 Binary files a/dump.rdb and /dev/null differ