From 32817a979e8d293d4acce4eca399db858280447e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Miko=C5=82ajek?= Date: Wed, 24 Feb 2021 12:59:19 +0100 Subject: [PATCH] Recursively generate all HTML doc files from Enso files. Setup project properly & update CI config. (#13) --- .github/CODEOWNERS | 5 +- .github/settings.yml | 156 +++++++ .github/workflows/docs.yml | 22 + .github/workflows/python-app.yml | 57 ++- .gitignore | 1 + .prettierignore | 7 + .prettierrc.json | 4 + .pylintrc | 590 ++++++++++++++++++++++++++ README.md | 3 +- download_helpers.py | 62 --- index.html | 12 - main.py | 102 ----- mypy.ini | 2 + poetry.lock | 510 ++++++++++++++++++++++ pyproject.toml | 19 + replace_all_occurences_in_file.py | 13 - safe_create_dir.py | 10 - __init__.py => src/__init__.py | 0 src/constants.py | 42 ++ src/copy_file.py | 11 + src/download_helpers.py | 74 ++++ src/downloaders.py | 41 ++ src/index.html | 20 + src/main.py | 62 +++ src/parse.py | 70 +++ src/replace_all_occurences_in_file.py | 21 + src/safe_create_directory.py | 15 + 27 files changed, 1708 insertions(+), 223 deletions(-) create mode 100644 .github/settings.yml create mode 100644 .github/workflows/docs.yml create mode 100644 .prettierignore create mode 100644 .prettierrc.json create mode 100644 .pylintrc delete mode 100644 download_helpers.py delete mode 100644 index.html delete mode 100644 main.py create mode 100644 mypy.ini create mode 100644 poetry.lock create mode 100644 pyproject.toml delete mode 100644 replace_all_occurences_in_file.py delete mode 100644 safe_create_dir.py rename __init__.py => src/__init__.py (100%) create mode 100644 src/constants.py create mode 100644 src/copy_file.py create mode 100644 src/download_helpers.py create mode 100644 src/downloaders.py create mode 100644 src/index.html create mode 100644 src/main.py create mode 100644 src/parse.py create mode 100644 src/replace_all_occurences_in_file.py create mode 100644 src/safe_create_directory.py diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9e29a2ae..bfd86f41 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,4 @@ -* @iamrecursion @BinarySoftware @joenash \ No newline at end of file +* @iamrecursion @BinarySoftware @joenash + +# Repo Configuration +/.github/settings.yml @iamrecursion diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 00000000..05cc6ecb --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,156 @@ +# See https://github.com/probot/settings for all available settings. + +# General Repository Configuration +repository: + name: docs + description: A documentation viewer for Enso's in-language documentation. + homepage: https://enso.org + topics: enso, documentation, viewer + + private: false + + has_issues: true + has_wiki: true + has_projects: true + has_downloads: true + + default_branch: main + + allow_squash_merge: true + allow_merge_commit: false + allow_rebase_merge: false + +# The repository labels configuration +labels: + - name: "Category: Appearance" + color: "#d1f0fd" + description: The appearance of the viewer + - name: "Category: Build" + color: "#d1f0fd" + description: Build and deployment + - name: "Category: Documentation" + color: "#d1f0fd" + description: Project documentation + - name: "Category: Functionality" + color: "#d1f0fd" + description: The viewer functionality + + - name: "Change: Breaking" + color: "#ffdce5" + description: A change that will break a public API or user-facing behaviour + - name: "Change: Non-Breaking" + color: "#ffdce5" + description: + A change that will not break a public API or user-facing behaviour + + - name: "Difficulty: Beginner" + color: "#d1e9c4" + description: Little prior knowledge required + - name: "Difficulty: Core Contributor" + color: "#d1e9c4" + description: Should only be attempted by a core contributor + - name: "Difficulty: Hard" + color: "#d1e9c4" + description: Significant prior knowledge required + - name: "Difficulty: Intermediate" + color: "#d1e9c4" + description: Some prior knowledge required + - name: "Difficulty: Unknown" + color: "#d1e9c4" + description: Unable to estimate difficulty + + - name: "Epic" + color: "#3E4B9E" + description: An epic (should never be assigned manually) + + - name: "Priority: High" + color: "#fff1c1" + description: Should be completed in the next sprint + - name: "Priority: Highest" + color: "#fff1c1" + description: Should be completed ASAP + - name: "Priority: Low" + color: "#fff1c1" + description: Should be completed in the next three months + - name: "Priority: Lowest" + color: "#fff1c1" + description: Should be completed at some point + - name: "Priority: Medium" + color: "#fff1c1" + description: Should be completed in the next few sprints + + - name: "Size: Small" + color: "#ffdfd3" + description: Requires a small time commitment + - name: "Size: Medium" + color: "#ffdfd3" + description: Requires a medium time commitment + - name: "Size: Large" + color: "#ffdfd3" + description: Requires a large time commitment + - name: "Size: Unknown" + color: "#ffdfd3" + description: Requires an unknown time commitment + + - name: "Status: Cannot Reproduce" + color: "#eeeeee" + description: Can't reproduce the issue + - name: "Status: Duplicate" + color: "#eeeeee" + description: A duplicate issue + - name: "Status: Good First Issue" + color: "#eeeeee" + description: A good issue for new contributors + - name: "Status: Help Wanted" + color: "#eeeeee" + description: Help wanted with the task + - name: "Status: Info Needed" + color: "#eeeeee" + description: More information needed from submitter + - name: "Status: Invalid" + color: "#eeeeee" + description: Not valid for some reason + - name: "Status: Research Needed" + color: "#eeeeee" + description: The task will require heavy research to complete + - name: "Status: Wontfix" + color: "#eeeeee" + description: Will not be fixed / not a bug + + - name: "Type: Bug" + color: "#ede2fe" + description: A bug in Enso + - name: "Type: Enhancement" + color: "#ede2fe" + description: An enhancement to Enso + - name: "Type: RFC" + color: "#ede2fe" + description: An RFC proposing a change to Enso + +# Teams configuration +teams: + - name: developers + permission: push + - name: moderators + permission: maintain + +# Branch protection +branches: + - name: main + protection: + required_pull_request_reviews: + required_approving_review_count: 1 + dismiss_stale_reviews: false + require_code_owner_reviews: true + dismissal_restrictions: {} + + required_status_checks: + # Require branches to be up to date before merging. + strict: true + contexts: + - "build" + - "check" + - "lint" + - "license/cla" + enforce_admins: null + restrictions: null diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..8a864add --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,22 @@ +name: Docs + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install Node + uses: actions/setup-node@v1 + with: + node-version: ${{ env.nodeVersion }} + - name: Install Prettier + run: npm install + - name: Check with Prettier + run: npx prettier --check . diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 647e81e3..785cf02a 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -1,35 +1,48 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Python application +name: Documentation Viewer on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: - build: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Set up Poetry + uses: Gr1N/setup-poetry@v4 + - name: Install dependencies + run: poetry install + - name: Run black + run: poetry run black --check . + - name: Run typechecker + run: poetry run mypy src --ignore-missing-imports + - name: Run linter + run: poetry run pylint src + + build: runs-on: ubuntu-latest + needs: lint steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 PyExecJS PyGithub - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Run app - run: | - python main.py --token=${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Set up Poetry + uses: Gr1N/setup-poetry@v4 + - name: Install dependencies + run: poetry install + - name: Run app + run: poetry run python src/main.py ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 051e661d..9bc836a1 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ Thumbs.db ################### .vscode/ distribution/ +gen/ .idea venv __pycache__ \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..9d80f84a --- /dev/null +++ b/.prettierignore @@ -0,0 +1,7 @@ +# Build Artifacts +gen/ +.github/PULL_REQUEST_TEMPLATE.md +.github/ISSUE_TEMPLATE +distribution/ +.mypy_cache/ +venv/ diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..a68a6f42 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,4 @@ +{ + "printWidth": 80, + "proseWrap": "always" +} diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 00000000..75e991c0 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,590 @@ +[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= + +# Specify a score threshold to be exceeded before program exits with error. +fail-under=10.0 + +# 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= + +# 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 + +# 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=print-statement, + parameter-unpacking, + unpacking-in-except, + old-raise-syntax, + backtick, + long-suffix, + old-ne-operator, + old-octal-literal, + import-star-module-level, + non-ascii-bytes-literal, + raw-checker-failed, + bad-inline-option, + locally-disabled, + file-ignored, + suppressed-message, + useless-suppression, + deprecated-pragma, + use-symbolic-message-instead, + apply-builtin, + basestring-builtin, + buffer-builtin, + cmp-builtin, + coerce-builtin, + execfile-builtin, + file-builtin, + long-builtin, + raw_input-builtin, + reduce-builtin, + standarderror-builtin, + unicode-builtin, + xrange-builtin, + coerce-method, + delslice-method, + getslice-method, + setslice-method, + no-absolute-import, + old-division, + dict-iter-method, + dict-view-method, + next-method-called, + metaclass-assignment, + indexing-exception, + raising-string, + reload-builtin, + oct-method, + hex-method, + nonzero-method, + cmp-method, + input-builtin, + round-builtin, + intern-builtin, + unichr-builtin, + map-builtin-not-iterating, + zip-builtin-not-iterating, + range-builtin-not-iterating, + filter-builtin-not-iterating, + using-cmp-argument, + eq-without-hash, + div-method, + idiv-method, + rdiv-method, + exception-message-attribute, + invalid-str-codec, + sys-max-int, + bad-python3-import, + deprecated-string-function, + deprecated-str-translate-call, + deprecated-itertools-function, + deprecated-types-field, + next-method-defined, + dict-items-not-iterating, + dict-keys-not-iterating, + dict-values-not-iterating, + deprecated-operator-function, + deprecated-urllib-function, + xreadlines-attribute, + deprecated-sys-function, + exception-escape, + comprehension-escape, + no-member, + no-name-in-module + +# 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] + +# The type of string formatting that logging methods do. `old` means using % +# formatting, `new` is for `{}` formatting. +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 + +# Regular expression of note tags to take in consideration. +#notes-rgx= + + +[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= + +# 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=100 + +# Maximum number of lines in a module. +max-module-lines=1000 + +# 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=4 + + +[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 + +# Bad variable names regexes, separated by a comma. If names match any regex, +# they will always be refused +bad-names-rgxs= + +# 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=-1 + +# 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, + _ + +# Good variable names regexes, separated by a comma. If names match any regex, +# they will always be accepted +good-names-rgxs= + +# 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. +#method-rgx= + +# 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=^_ + +# 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 inconsistent-quotes generates a warning when the +# character used as a quote delimiter is used inconsistently within a module. +check-quote-consistency=no + +# This flag controls whether the implicit-str-concat 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=5 + +# 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=BaseException, + Exception diff --git a/README.md b/README.md index ef207bef..d965ffb5 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ # Enso Standard Library Documentation This repository contains scripts that generates HTML docs from Enso Std-Lib. -Documentation is drawn from [here](https://github.com/enso-org/enso/tree/main/distribution/std-lib). +Documentation is drawn from +[here](https://github.com/enso-org/enso/tree/main/distribution/std-lib). ### Running diff --git a/download_helpers.py b/download_helpers.py deleted file mode 100644 index 0d404429..00000000 --- a/download_helpers.py +++ /dev/null @@ -1,62 +0,0 @@ -import os -import base64 -import shutil -import requests -from github import Github -from github import GithubException - - -def get_sha_for_tag(repository, tag): - branches = repository.get_branches() - matched_branches = [match for match in branches if match.name == tag] - if matched_branches: - return matched_branches[0].commit.sha - - tags = repository.get_tags() - matched_tags = [match for match in tags if match.name == tag] - if not matched_tags: - raise ValueError('No Tag or Branch exists with that name') - return matched_tags[0].commit.sha - - -def download_directory(repository, sha, server_path): - if os.path.exists(server_path): - shutil.rmtree(server_path) - - os.makedirs(server_path) - contents = repository.get_dir_contents(server_path, ref=sha) - - for content in contents: - print("Downloading: %s" % content.path) - if content.type == 'dir' and not content.path.endswith("THIRD-PARTY"): - os.makedirs(content.path) - download_directory(repository, sha, content.path) - else: - try: - path = content.path - if path.endswith(".enso"): - file_content = repository.get_contents(path, ref=sha) - file_data = base64.b64decode(file_content.content) - file_out = open(content.path, "wb+") - file_out.write(file_data) - file_out.close() - except (GithubException, IOError) as exc: - print('Error processing %s: %s', content.path, exc) - - -def download_from_git(token: str, - org: str, - repo: str, - branch: str, - folder: str): - github = Github(token) - organization = github.get_organization(org) - repository = organization.get_repo(repo) - sha = get_sha_for_tag(repository, branch) - download_directory(repository, sha, folder) - - -def download_from_url(url, to): - r = requests.get(url, allow_redirects=True) - print("Downloading: %s" % url) - open(to, 'wb').write(r.content) diff --git a/index.html b/index.html deleted file mode 100644 index 138f25ac..00000000 --- a/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - -

Enso Docs

-
- -
- - \ No newline at end of file diff --git a/main.py b/main.py deleted file mode 100644 index 1918e0c2..00000000 --- a/main.py +++ /dev/null @@ -1,102 +0,0 @@ -import sys -import getopt -import execjs -from download_helpers import * -from replace_all_occurences_in_file import * -from safe_create_dir import * - -ORGANIZATION = "enso-org" -REPO = "enso" -BRANCH = "main" -DIRECTORY = "distribution/std-lib" -PARSER_COMMIT = "5e309bddcbec33cfbd150fcb8a16b45192cf5189" - - -def main(argv): - download_stdlib(argv) - download_parser() - download_stylesheet() - parser = init_parser() - test_parse(parser) - - -def test_parse(parser): - """ - Test if generating docs work. - To be removed when created method to recursively generate all docfiles. - """ - example = open('distribution/std-lib/Base/src/Math.enso', 'r').read() - parsed = parser.call("$e_doc_parser_generate_html_source", example) - out_dir = 'distribution/gen' - safe_create_directory(out_dir) - html_file = open(out_dir + '/Math.html', 'w') - html_file.write('' + parsed) - html_file.close() - - example = open('distribution/std-lib/Base/src/Meta.enso', 'r').read() - parsed = parser.call("$e_doc_parser_generate_html_source", example) - html_file = open(out_dir + '/Meta.html', 'w') - html_file.write('' + parsed) - html_file.close() - - -def init_parser(): - """ - Compiles JS parser to call from Python. - """ - parser = open('distribution/parser.js', 'r').read() - parser = execjs.compile(parser) - return parser - - -def download_stylesheet(): - """ - Downloads stylesheet for docs from IDE repository. - """ - repo_url = "https://raw.githubusercontent.com/enso-org/ide/" - file_path = "develop/src/rust/ide/view/src/documentation/style.css" - url = repo_url + file_path - download_to = "distribution/temp-style.css" - download_from_url(url, download_to) - replace_all_occurrences_in_file(download_to, - 'distribution/style.css', - '.docVis', - 'body') - - -def download_parser(): - """ - Downloads scala parser from Engine repository. - """ - url = "https://packages.luna-lang.org/parser-js/nightly/" - url = url + PARSER_COMMIT + "/scala-parser.js" - download_to = "distribution/scala-parser.js" - download_from_url(url, download_to) - replace_all_occurrences_in_file(download_to, - 'distribution/parser.js', - 'export ', - '// export') - - -def download_stdlib(argv): - """ - Downloads Std-Lib from Engine repository. - """ - token = "" - try: - opts, args = getopt.getopt(argv, "t:", ["token="]) - except getopt.GetoptError as err: - print(str(err)) - sys.exit(2) - for opt, arg in opts: - if opt in ("-t", "--token"): - token = arg - download_from_git(token, - org=ORGANIZATION, - repo=REPO, - branch=BRANCH, - folder=DIRECTORY) - - -if __name__ == '__main__': - main(sys.argv[1:]) diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 00000000..976ba029 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,2 @@ +[mypy] +ignore_missing_imports = True diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 00000000..9eb78d7a --- /dev/null +++ b/poetry.lock @@ -0,0 +1,510 @@ +[[package]] +name = "appdirs" +version = "1.4.4" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "astroid" +version = "2.4.2" +description = "An abstract syntax tree for Python with inference support." +category = "main" +optional = false +python-versions = ">=3.5" + +[package.dependencies] +lazy-object-proxy = ">=1.4.0,<1.5.0" +six = ">=1.12,<2.0" +wrapt = ">=1.11,<2.0" + +[[package]] +name = "black" +version = "20.8b1" +description = "The uncompromising code formatter." +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +appdirs = "*" +click = ">=7.1.2" +mypy-extensions = ">=0.4.3" +pathspec = ">=0.6,<1" +regex = ">=2020.1.8" +toml = ">=0.10.1" +typed-ast = ">=1.4.0" +typing-extensions = ">=3.7.4" + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] + +[[package]] +name = "certifi" +version = "2020.12.5" +description = "Python package for providing Mozilla's CA Bundle." +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "chardet" +version = "4.0.0" +description = "Universal encoding detector for Python 2 and 3" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "click" +version = "7.1.2" +description = "Composable command line interface toolkit" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "colorama" +version = "0.4.4" +description = "Cross-platform colored terminal text." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "deprecated" +version = "1.2.11" +description = "Python @deprecated decorator to deprecate old python classes, functions or methods." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.dependencies] +wrapt = ">=1.10,<2" + +[package.extras] +dev = ["tox", "bump2version (<1)", "sphinx (<2)", "importlib-metadata (<3)", "importlib-resources (<4)", "configparser (<5)", "sphinxcontrib-websupport (<2)", "zipp (<2)", "PyTest (<5)", "PyTest-Cov (<2.6)", "pytest", "pytest-cov"] + +[[package]] +name = "idna" +version = "2.10" +description = "Internationalized Domain Names in Applications (IDNA)" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "isort" +version = "5.7.0" +description = "A Python utility / library to sort Python imports." +category = "main" +optional = false +python-versions = ">=3.6,<4.0" + +[package.extras] +pipfile_deprecated_finder = ["pipreqs", "requirementslib"] +requirements_deprecated_finder = ["pipreqs", "pip-api"] +colors = ["colorama (>=0.4.3,<0.5.0)"] + +[[package]] +name = "lazy-object-proxy" +version = "1.4.3" +description = "A fast and thorough lazy object proxy." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "mccabe" +version = "0.6.1" +description = "McCabe checker, plugin for flake8" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "mypy" +version = "0.800" +description = "Optional static typing for Python" +category = "main" +optional = false +python-versions = ">=3.5" + +[package.dependencies] +mypy-extensions = ">=0.4.3,<0.5.0" +typed-ast = ">=1.4.0,<1.5.0" +typing-extensions = ">=3.7.4" + +[package.extras] +dmypy = ["psutil (>=4.0)"] + +[[package]] +name = "mypy-extensions" +version = "0.4.3" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "pathspec" +version = "0.8.1" +description = "Utility library for gitignore style pattern matching of file paths." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "pyexecjs" +version = "1.5.1" +description = "Run JavaScript code from Python" +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +six = ">=1.10.0" + +[[package]] +name = "pygithub" +version = "1.54.1" +description = "Use the full Github API v3" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +deprecated = "*" +pyjwt = "<2.0" +requests = ">=2.14.0" + +[package.extras] +integrations = ["cryptography"] + +[[package]] +name = "pyjwt" +version = "1.7.1" +description = "JSON Web Token implementation in Python" +category = "main" +optional = false +python-versions = "*" + +[package.extras] +crypto = ["cryptography (>=1.4)"] +flake8 = ["flake8", "flake8-import-order", "pep8-naming"] +test = ["pytest (>=4.0.1,<5.0.0)", "pytest-cov (>=2.6.0,<3.0.0)", "pytest-runner (>=4.2,<5.0.0)"] + +[[package]] +name = "pylint" +version = "2.6.2" +description = "python code static checker" +category = "main" +optional = false +python-versions = ">=3.5.*" + +[package.dependencies] +astroid = ">=2.4.0,<2.5" +colorama = {version = "*", markers = "sys_platform == \"win32\""} +isort = ">=4.2.5,<6" +mccabe = ">=0.6,<0.7" +toml = ">=0.7.1" + +[[package]] +name = "regex" +version = "2020.11.13" +description = "Alternative regular expression module, to replace re." +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "requests" +version = "2.25.1" +description = "Python HTTP for Humans." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[package.dependencies] +certifi = ">=2017.4.17" +chardet = ">=3.0.2,<5" +idna = ">=2.5,<3" +urllib3 = ">=1.21.1,<1.27" + +[package.extras] +security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"] +socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] + +[[package]] +name = "six" +version = "1.15.0" +description = "Python 2 and 3 compatibility utilities" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "main" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "typed-ast" +version = "1.4.2" +description = "a fork of Python 2 and 3 ast modules with type comment support" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "typing-extensions" +version = "3.7.4.3" +description = "Backported and Experimental Type Hints for Python 3.5+" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "urllib3" +version = "1.26.3" +description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" + +[package.extras] +brotli = ["brotlipy (>=0.6.0)"] +secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] +socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] + +[[package]] +name = "wrapt" +version = "1.12.1" +description = "Module for decorators, wrappers and monkey patching." +category = "main" +optional = false +python-versions = "*" + +[metadata] +lock-version = "1.1" +python-versions = "^3.9" +content-hash = "b8d08582256720baff79a7213fb847da596ef80a0d287db3e01bb4d42235b72c" + +[metadata.files] +appdirs = [ + {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, + {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, +] +astroid = [ + {file = "astroid-2.4.2-py3-none-any.whl", hash = "sha256:bc58d83eb610252fd8de6363e39d4f1d0619c894b0ed24603b881c02e64c7386"}, + {file = "astroid-2.4.2.tar.gz", hash = "sha256:2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703"}, +] +black = [ + {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, +] +certifi = [ + {file = "certifi-2020.12.5-py2.py3-none-any.whl", hash = "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830"}, + {file = "certifi-2020.12.5.tar.gz", hash = "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"}, +] +chardet = [ + {file = "chardet-4.0.0-py2.py3-none-any.whl", hash = "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"}, + {file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"}, +] +click = [ + {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, + {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, +] +colorama = [ + {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, + {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, +] +deprecated = [ + {file = "Deprecated-1.2.11-py2.py3-none-any.whl", hash = "sha256:924b6921f822b64ec54f49be6700a126bab0640cfafca78f22c9d429ed590560"}, + {file = "Deprecated-1.2.11.tar.gz", hash = "sha256:471ec32b2755172046e28102cd46c481f21c6036a0ec027521eba8521aa4ef35"}, +] +idna = [ + {file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"}, + {file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"}, +] +isort = [ + {file = "isort-5.7.0-py3-none-any.whl", hash = "sha256:fff4f0c04e1825522ce6949973e83110a6e907750cd92d128b0d14aaaadbffdc"}, + {file = "isort-5.7.0.tar.gz", hash = "sha256:c729845434366216d320e936b8ad6f9d681aab72dc7cbc2d51bedc3582f3ad1e"}, +] +lazy-object-proxy = [ + {file = "lazy-object-proxy-1.4.3.tar.gz", hash = "sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0"}, + {file = "lazy_object_proxy-1.4.3-cp27-cp27m-macosx_10_13_x86_64.whl", hash = "sha256:a2238e9d1bb71a56cd710611a1614d1194dc10a175c1e08d75e1a7bcc250d442"}, + {file = "lazy_object_proxy-1.4.3-cp27-cp27m-win32.whl", hash = "sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4"}, + {file = "lazy_object_proxy-1.4.3-cp27-cp27m-win_amd64.whl", hash = "sha256:4677f594e474c91da97f489fea5b7daa17b5517190899cf213697e48d3902f5a"}, + {file = "lazy_object_proxy-1.4.3-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d"}, + {file = "lazy_object_proxy-1.4.3-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:d945239a5639b3ff35b70a88c5f2f491913eb94871780ebfabb2568bd58afc5a"}, + {file = "lazy_object_proxy-1.4.3-cp34-cp34m-win32.whl", hash = "sha256:9651375199045a358eb6741df3e02a651e0330be090b3bc79f6d0de31a80ec3e"}, + {file = "lazy_object_proxy-1.4.3-cp34-cp34m-win_amd64.whl", hash = "sha256:eba7011090323c1dadf18b3b689845fd96a61ba0a1dfbd7f24b921398affc357"}, + {file = "lazy_object_proxy-1.4.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:48dab84ebd4831077b150572aec802f303117c8cc5c871e182447281ebf3ac50"}, + {file = "lazy_object_proxy-1.4.3-cp35-cp35m-win32.whl", hash = "sha256:ca0a928a3ddbc5725be2dd1cf895ec0a254798915fb3a36af0964a0a4149e3db"}, + {file = "lazy_object_proxy-1.4.3-cp35-cp35m-win_amd64.whl", hash = "sha256:194d092e6f246b906e8f70884e620e459fc54db3259e60cf69a4d66c3fda3449"}, + {file = "lazy_object_proxy-1.4.3-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:97bb5884f6f1cdce0099f86b907aa41c970c3c672ac8b9c8352789e103cf3156"}, + {file = "lazy_object_proxy-1.4.3-cp36-cp36m-win32.whl", hash = "sha256:cb2c7c57005a6804ab66f106ceb8482da55f5314b7fcb06551db1edae4ad1531"}, + {file = "lazy_object_proxy-1.4.3-cp36-cp36m-win_amd64.whl", hash = "sha256:8d859b89baf8ef7f8bc6b00aa20316483d67f0b1cbf422f5b4dc56701c8f2ffb"}, + {file = "lazy_object_proxy-1.4.3-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:1be7e4c9f96948003609aa6c974ae59830a6baecc5376c25c92d7d697e684c08"}, + {file = "lazy_object_proxy-1.4.3-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d74bb8693bf9cf75ac3b47a54d716bbb1a92648d5f781fc799347cfc95952383"}, + {file = "lazy_object_proxy-1.4.3-cp37-cp37m-win32.whl", hash = "sha256:9b15f3f4c0f35727d3a0fba4b770b3c4ebbb1fa907dbcc046a1d2799f3edd142"}, + {file = "lazy_object_proxy-1.4.3-cp37-cp37m-win_amd64.whl", hash = "sha256:9254f4358b9b541e3441b007a0ea0764b9d056afdeafc1a5569eee1cc6c1b9ea"}, + {file = "lazy_object_proxy-1.4.3-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:a6ae12d08c0bf9909ce12385803a543bfe99b95fe01e752536a60af2b7797c62"}, + {file = "lazy_object_proxy-1.4.3-cp38-cp38-win32.whl", hash = "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd"}, + {file = "lazy_object_proxy-1.4.3-cp38-cp38-win_amd64.whl", hash = "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239"}, +] +mccabe = [ + {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, + {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, +] +mypy = [ + {file = "mypy-0.800-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:e1c84c65ff6d69fb42958ece5b1255394714e0aac4df5ffe151bc4fe19c7600a"}, + {file = "mypy-0.800-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:947126195bfe4709c360e89b40114c6746ae248f04d379dca6f6ab677aa07641"}, + {file = "mypy-0.800-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:b95068a3ce3b50332c40e31a955653be245666a4bc7819d3c8898aa9fb9ea496"}, + {file = "mypy-0.800-cp35-cp35m-win_amd64.whl", hash = "sha256:ca7ad5aed210841f1e77f5f2f7d725b62c78fa77519312042c719ed2ab937876"}, + {file = "mypy-0.800-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e32b7b282c4ed4e378bba8b8dfa08e1cfa6f6574067ef22f86bee5b1039de0c9"}, + {file = "mypy-0.800-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:e497a544391f733eca922fdcb326d19e894789cd4ff61d48b4b195776476c5cf"}, + {file = "mypy-0.800-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:5615785d3e2f4f03ab7697983d82c4b98af5c321614f51b8f1034eb9ebe48363"}, + {file = "mypy-0.800-cp36-cp36m-win_amd64.whl", hash = "sha256:2b216eacca0ec0ee124af9429bfd858d5619a0725ee5f88057e6e076f9eb1a7b"}, + {file = "mypy-0.800-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e3b8432f8df19e3c11235c4563a7250666dc9aa7cdda58d21b4177b20256ca9f"}, + {file = "mypy-0.800-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d16c54b0dffb861dc6318a8730952265876d90c5101085a4bc56913e8521ba19"}, + {file = "mypy-0.800-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:0d2fc8beb99cd88f2d7e20d69131353053fbecea17904ee6f0348759302c52fa"}, + {file = "mypy-0.800-cp37-cp37m-win_amd64.whl", hash = "sha256:aa9d4901f3ee1a986a3a79fe079ffbf7f999478c281376f48faa31daaa814e86"}, + {file = "mypy-0.800-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:319ee5c248a7c3f94477f92a729b7ab06bf8a6d04447ef3aa8c9ba2aa47c6dcf"}, + {file = "mypy-0.800-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:74f5aa50d0866bc6fb8e213441c41e466c86678c800700b87b012ed11c0a13e0"}, + {file = "mypy-0.800-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:a301da58d566aca05f8f449403c710c50a9860782148332322decf73a603280b"}, + {file = "mypy-0.800-cp38-cp38-win_amd64.whl", hash = "sha256:b9150db14a48a8fa114189bfe49baccdff89da8c6639c2717750c7ae62316738"}, + {file = "mypy-0.800-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f5fdf935a46aa20aa937f2478480ebf4be9186e98e49cc3843af9a5795a49a25"}, + {file = "mypy-0.800-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:6f8425fecd2ba6007e526209bb985ce7f49ed0d2ac1cc1a44f243380a06a84fb"}, + {file = "mypy-0.800-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:5ff616787122774f510caeb7b980542a7cc2222be3f00837a304ea85cd56e488"}, + {file = "mypy-0.800-cp39-cp39-win_amd64.whl", hash = "sha256:90b6f46dc2181d74f80617deca611925d7e63007cf416397358aa42efb593e07"}, + {file = "mypy-0.800-py3-none-any.whl", hash = "sha256:3e0c159a7853e3521e3f582adb1f3eac66d0b0639d434278e2867af3a8c62653"}, + {file = "mypy-0.800.tar.gz", hash = "sha256:e0202e37756ed09daf4b0ba64ad2c245d357659e014c3f51d8cd0681ba66940a"}, +] +mypy-extensions = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] +pathspec = [ + {file = "pathspec-0.8.1-py2.py3-none-any.whl", hash = "sha256:aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"}, + {file = "pathspec-0.8.1.tar.gz", hash = "sha256:86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd"}, +] +pyexecjs = [ + {file = "PyExecJS-1.5.1.tar.gz", hash = "sha256:34cc1d070976918183ff7bdc0ad71f8157a891c92708c00c5fbbff7a769f505c"}, +] +pygithub = [ + {file = "PyGithub-1.54.1-py3-none-any.whl", hash = "sha256:87afd6a67ea582aa7533afdbf41635725f13d12581faed7e3e04b1579c0c0627"}, + {file = "PyGithub-1.54.1.tar.gz", hash = "sha256:300bc16e62886ca6537b0830e8f516ea4bc3ef12d308e0c5aff8bdbd099173d4"}, +] +pyjwt = [ + {file = "PyJWT-1.7.1-py2.py3-none-any.whl", hash = "sha256:5c6eca3c2940464d106b99ba83b00c6add741c9becaec087fb7ccdefea71350e"}, + {file = "PyJWT-1.7.1.tar.gz", hash = "sha256:8d59a976fb773f3e6a39c85636357c4f0e242707394cadadd9814f5cbaa20e96"}, +] +pylint = [ + {file = "pylint-2.6.2-py3-none-any.whl", hash = "sha256:e71c2e9614a4f06e36498f310027942b0f4f2fde20aebb01655b31edc63b9eaf"}, + {file = "pylint-2.6.2.tar.gz", hash = "sha256:718b74786ea7ed07aa0c58bf572154d4679f960d26e9641cc1de204a30b87fc9"}, +] +regex = [ + {file = "regex-2020.11.13-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6"}, + {file = "regex-2020.11.13-cp36-cp36m-win32.whl", hash = "sha256:49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e"}, + {file = "regex-2020.11.13-cp36-cp36m-win_amd64.whl", hash = "sha256:749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884"}, + {file = "regex-2020.11.13-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538"}, + {file = "regex-2020.11.13-cp37-cp37m-win32.whl", hash = "sha256:0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4"}, + {file = "regex-2020.11.13-cp37-cp37m-win_amd64.whl", hash = "sha256:1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444"}, + {file = "regex-2020.11.13-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b"}, + {file = "regex-2020.11.13-cp38-cp38-win32.whl", hash = "sha256:7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c"}, + {file = "regex-2020.11.13-cp38-cp38-win_amd64.whl", hash = "sha256:6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683"}, + {file = "regex-2020.11.13-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux1_i686.whl", hash = "sha256:4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c"}, + {file = "regex-2020.11.13-cp39-cp39-win32.whl", hash = "sha256:f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"}, + {file = "regex-2020.11.13-cp39-cp39-win_amd64.whl", hash = "sha256:a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d"}, + {file = "regex-2020.11.13.tar.gz", hash = "sha256:83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562"}, +] +requests = [ + {file = "requests-2.25.1-py2.py3-none-any.whl", hash = "sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e"}, + {file = "requests-2.25.1.tar.gz", hash = "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804"}, +] +six = [ + {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, + {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, +] +toml = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] +typed-ast = [ + {file = "typed_ast-1.4.2-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:7703620125e4fb79b64aa52427ec192822e9f45d37d4b6625ab37ef403e1df70"}, + {file = "typed_ast-1.4.2-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:c9aadc4924d4b5799112837b226160428524a9a45f830e0d0f184b19e4090487"}, + {file = "typed_ast-1.4.2-cp35-cp35m-manylinux2014_aarch64.whl", hash = "sha256:9ec45db0c766f196ae629e509f059ff05fc3148f9ffd28f3cfe75d4afb485412"}, + {file = "typed_ast-1.4.2-cp35-cp35m-win32.whl", hash = "sha256:85f95aa97a35bdb2f2f7d10ec5bbdac0aeb9dafdaf88e17492da0504de2e6400"}, + {file = "typed_ast-1.4.2-cp35-cp35m-win_amd64.whl", hash = "sha256:9044ef2df88d7f33692ae3f18d3be63dec69c4fb1b5a4a9ac950f9b4ba571606"}, + {file = "typed_ast-1.4.2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:c1c876fd795b36126f773db9cbb393f19808edd2637e00fd6caba0e25f2c7b64"}, + {file = "typed_ast-1.4.2-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:5dcfc2e264bd8a1db8b11a892bd1647154ce03eeba94b461effe68790d8b8e07"}, + {file = "typed_ast-1.4.2-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:8db0e856712f79c45956da0c9a40ca4246abc3485ae0d7ecc86a20f5e4c09abc"}, + {file = "typed_ast-1.4.2-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:d003156bb6a59cda9050e983441b7fa2487f7800d76bdc065566b7d728b4581a"}, + {file = "typed_ast-1.4.2-cp36-cp36m-win32.whl", hash = "sha256:4c790331247081ea7c632a76d5b2a265e6d325ecd3179d06e9cf8d46d90dd151"}, + {file = "typed_ast-1.4.2-cp36-cp36m-win_amd64.whl", hash = "sha256:d175297e9533d8d37437abc14e8a83cbc68af93cc9c1c59c2c292ec59a0697a3"}, + {file = "typed_ast-1.4.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cf54cfa843f297991b7388c281cb3855d911137223c6b6d2dd82a47ae5125a41"}, + {file = "typed_ast-1.4.2-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:b4fcdcfa302538f70929eb7b392f536a237cbe2ed9cba88e3bf5027b39f5f77f"}, + {file = "typed_ast-1.4.2-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:987f15737aba2ab5f3928c617ccf1ce412e2e321c77ab16ca5a293e7bbffd581"}, + {file = "typed_ast-1.4.2-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:37f48d46d733d57cc70fd5f30572d11ab8ed92da6e6b28e024e4a3edfb456e37"}, + {file = "typed_ast-1.4.2-cp37-cp37m-win32.whl", hash = "sha256:36d829b31ab67d6fcb30e185ec996e1f72b892255a745d3a82138c97d21ed1cd"}, + {file = "typed_ast-1.4.2-cp37-cp37m-win_amd64.whl", hash = "sha256:8368f83e93c7156ccd40e49a783a6a6850ca25b556c0fa0240ed0f659d2fe496"}, + {file = "typed_ast-1.4.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:963c80b583b0661918718b095e02303d8078950b26cc00b5e5ea9ababe0de1fc"}, + {file = "typed_ast-1.4.2-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e683e409e5c45d5c9082dc1daf13f6374300806240719f95dc783d1fc942af10"}, + {file = "typed_ast-1.4.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:84aa6223d71012c68d577c83f4e7db50d11d6b1399a9c779046d75e24bed74ea"}, + {file = "typed_ast-1.4.2-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:a38878a223bdd37c9709d07cd357bb79f4c760b29210e14ad0fb395294583787"}, + {file = "typed_ast-1.4.2-cp38-cp38-win32.whl", hash = "sha256:a2c927c49f2029291fbabd673d51a2180038f8cd5a5b2f290f78c4516be48be2"}, + {file = "typed_ast-1.4.2-cp38-cp38-win_amd64.whl", hash = "sha256:c0c74e5579af4b977c8b932f40a5464764b2f86681327410aa028a22d2f54937"}, + {file = "typed_ast-1.4.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:07d49388d5bf7e863f7fa2f124b1b1d89d8aa0e2f7812faff0a5658c01c59aa1"}, + {file = "typed_ast-1.4.2-cp39-cp39-manylinux1_i686.whl", hash = "sha256:240296b27397e4e37874abb1df2a608a92df85cf3e2a04d0d4d61055c8305ba6"}, + {file = "typed_ast-1.4.2-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:d746a437cdbca200622385305aedd9aef68e8a645e385cc483bdc5e488f07166"}, + {file = "typed_ast-1.4.2-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:14bf1522cdee369e8f5581238edac09150c765ec1cb33615855889cf33dcb92d"}, + {file = "typed_ast-1.4.2-cp39-cp39-win32.whl", hash = "sha256:cc7b98bf58167b7f2db91a4327da24fb93368838eb84a44c472283778fc2446b"}, + {file = "typed_ast-1.4.2-cp39-cp39-win_amd64.whl", hash = "sha256:7147e2a76c75f0f64c4319886e7639e490fee87c9d25cb1d4faef1d8cf83a440"}, + {file = "typed_ast-1.4.2.tar.gz", hash = "sha256:9fc0b3cb5d1720e7141d103cf4819aea239f7d136acf9ee4a69b047b7986175a"}, +] +typing-extensions = [ + {file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"}, + {file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"}, + {file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"}, +] +urllib3 = [ + {file = "urllib3-1.26.3-py2.py3-none-any.whl", hash = "sha256:1b465e494e3e0d8939b50680403e3aedaa2bc434b7d5af64dfd3c958d7f5ae80"}, + {file = "urllib3-1.26.3.tar.gz", hash = "sha256:de3eedaad74a2683334e282005cd8d7f22f4d55fa690a2a1020a416cb0a47e73"}, +] +wrapt = [ + {file = "wrapt-1.12.1.tar.gz", hash = "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7"}, +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..9880f7f9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +[tool.poetry] +name = "enso-docs" +version = "0.1.0" +description = "Enso Standard Library documentation site generator." +authors = ["Enso Team "] + +[tool.poetry.dependencies] +python = "^3.9" +PyGithub = "^1.54.1" +black = "^20.8b1" +mypy = "^0.800" +PyExecJS = "^1.5.1" +pylint = "^2.6.2" + +[tool.poetry.dev-dependencies] + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/replace_all_occurences_in_file.py b/replace_all_occurences_in_file.py deleted file mode 100644 index 80bc0106..00000000 --- a/replace_all_occurences_in_file.py +++ /dev/null @@ -1,13 +0,0 @@ -import os - - -def replace_all_occurrences_in_file(path_old, path_new, pat, to): - file1 = open(path_old, 'r') - file2 = open(path_new, 'w') - - for line in file1.readlines(): - new_line = line.replace(pat, to) - file2.write(new_line) - file1.close() - file2.close() - os.remove(path_old) diff --git a/safe_create_dir.py b/safe_create_dir.py deleted file mode 100644 index b4a60201..00000000 --- a/safe_create_dir.py +++ /dev/null @@ -1,10 +0,0 @@ -import os -import errno - - -def safe_create_directory(path): - try: - os.makedirs(path) - except OSError as exception: - if exception.errno != errno.EEXIST: - raise \ No newline at end of file diff --git a/__init__.py b/src/__init__.py similarity index 100% rename from __init__.py rename to src/__init__.py diff --git a/src/constants.py b/src/constants.py new file mode 100644 index 00000000..cbd306ed --- /dev/null +++ b/src/constants.py @@ -0,0 +1,42 @@ +""" +File containing all the constants. +""" + +#: The GitHub organization from which the standard libraries will be downloaded. +ORGANIZATION: str = "enso-org" +#: The repository in the above organization from which standard libraries +#: will be downloaded. +REPO: str = "enso" +#: The branch in the above repository from which standard libraries +#: will be downloaded. +BRANCH: str = "main" +#: The directory in the above branch from which standard libraries +#: will be downloaded. +DIRECTORY: str = "distribution/std-lib" + +#: The commit from which scala parser will be obtained. +PARSER_COMMIT: str = "5c735b0ae7fc14bf72f5c0bf43b17c3fdf5d86b4" +#: The URL used to download scala parser package. +PARSER_URL: str = "https://packages.luna-lang.org/parser-js/nightly/" +#: The URL leading to IDE repository. +IDE_REPO_URL: str = "https://raw.githubusercontent.com/enso-org/ide/" +#: The branch in the above repository from which stylesheet will be downloaded. +IDE_BRANCH: str = "develop" +#: The directory in the above repository from which stylesheet will be obtained. +IDE_DIRECTORY: str = "/src/rust/ide/view/src/documentation/" + +#: The Enso source file extension. +FILE_EXT: str = ".enso" + +#: The input directory, into which all downloads will go. +IN_DIR: str = "distribution" +#: The input directory, into which the Standard Library will go. +STD_LIB_DIR: str = IN_DIR + "/std-lib" +#: The output directory, into which all generated content will go. +OUT_DIR: str = "gen" + + +#: The scala parser file name. +PARSER_FILE: str = "scala-parser.js" +#: The stylesheet file name. +STYLE_FILE: str = "style.css" diff --git a/src/copy_file.py b/src/copy_file.py new file mode 100644 index 00000000..58c4b083 --- /dev/null +++ b/src/copy_file.py @@ -0,0 +1,11 @@ +""" +Runs a system command that copies file from one place to another. +""" +import os + + +def copy_file(from_path: str, to_path: str) -> None: + """ + Runs a system command that copies file from one place to another. + """ + os.system("cp " + from_path + " " + to_path) diff --git a/src/download_helpers.py b/src/download_helpers.py new file mode 100644 index 00000000..301acfec --- /dev/null +++ b/src/download_helpers.py @@ -0,0 +1,74 @@ +""" +Helper methods for downloading files and folders. +""" +import os +import base64 +import requests +from github import Github +from github import GithubException +from github.Repository import Repository +import constants +from safe_create_directory import safe_create_directory + + +def __get_sha_for_tag(repository: Repository, tag: str) -> str: + """ + Gets necessary SHA value from selected repository's branch. + """ + branches = repository.get_branches() + matched_branches = [match for match in branches if match.name == tag] + if matched_branches: + return matched_branches[0].commit.sha + + tags = repository.get_tags() + matched_tags = [match for match in tags if match.name == tag] + if not matched_tags: + raise ValueError("No Tag or Branch exists with that name") + return matched_tags[0].commit.sha + + +def __download_directory(repository: Repository, sha: str, server_path: str) -> None: + """ + Recursively downloads directory from GitHub repo. + """ + safe_create_directory(server_path) + contents = repository.get_dir_contents(server_path, ref=sha) + + for content in contents: + print("Downloading: %s" % content.path) + if content.type == "dir" and not content.path.endswith("THIRD-PARTY"): + os.makedirs(content.path) + __download_directory(repository, sha, content.path) + else: + try: + path = content.path + if path.endswith(constants.FILE_EXT): + file_content = repository.get_contents(path, ref=sha) + file_data = base64.b64decode(file_content.content) # type: ignore + file_out = open(content.path, "wb+") + file_out.write(file_data) + file_out.close() + except (GithubException, IOError) as exc: + print("Error processing %s: %s", content.path, exc) + + +def download_from_git( + token: str, org: str, repo: str, branch: str, folder: str +) -> None: + """ + Downloads directory from GitHub repository. + """ + github = Github(token) + organization = github.get_organization(org) + repository = organization.get_repo(repo) + sha = __get_sha_for_tag(repository, branch) + __download_directory(repository, sha, folder) + + +def download_from_url(url: str, to_file: str) -> None: + """ + Downloads file from given URL. + """ + request = requests.get(url, allow_redirects=True) + print("Downloading: %s" % url) + open(to_file, "wb").write(request.content) diff --git a/src/downloaders.py b/src/downloaders.py new file mode 100644 index 00000000..8ef1c066 --- /dev/null +++ b/src/downloaders.py @@ -0,0 +1,41 @@ +""" +Downloaders for docs stylesheet, parser and stdlib. +""" +import constants +from download_helpers import download_from_url, download_from_git +from replace_all_occurences_in_file import replace_all_occurrences_in_file + + +def download_stylesheet(branch: str, file_name: str) -> None: + """ + Downloads the stylesheet from the IDE's repository. + """ + file_path: str = constants.IDE_DIRECTORY + file_name + url: str = constants.IDE_REPO_URL + branch + file_path + download_to: str = constants.IN_DIR + "/temp-" + file_name + download_from_url(url, download_to) + replace_all_occurrences_in_file( + download_to, constants.IN_DIR + "/" + file_name, ".docVis", "body" + ) + + +def download_parser(parser_url: str, parser_commit: str, parser_file: str) -> None: + """ + Downloads the scala parser from the Engine's repository. + """ + url: str = parser_url + parser_commit + "/" + parser_file + download_to: str = constants.IN_DIR + "/temp-" + parser_file + download_from_url(url, download_to) + replace_all_occurrences_in_file( + download_to, + constants.IN_DIR + "/" + parser_file, + "export ", + "// export", + ) + + +def download_stdlib(token: str, org: str, repo: str, branch: str, folder: str) -> None: + """ + Downloads the Standard Library from the Engine's repository. + """ + download_from_git(token, org, repo, branch, folder) diff --git a/src/index.html b/src/index.html new file mode 100644 index 00000000..164e05b7 --- /dev/null +++ b/src/index.html @@ -0,0 +1,20 @@ + + + + + +

+ Enso Docs +

+
+ +
+ + diff --git a/src/main.py b/src/main.py new file mode 100644 index 00000000..ed7ef4df --- /dev/null +++ b/src/main.py @@ -0,0 +1,62 @@ +""" +Enso standard library documentation generator. +""" +import argparse +import constants +from downloaders import download_stdlib, download_parser, download_stylesheet +from parse import init_parser, init_gen_dir, gen_all_files + + +def main(arguments: argparse.Namespace) -> None: + """ + Program entry point. + """ + download_stdlib( + arguments.token, arguments.org, arguments.repo, arguments.br, arguments.dir + ) + download_parser(arguments.parser_url, arguments.commit, arguments.parser) + download_stylesheet(arguments.ide_br, arguments.style) + parser = init_parser(arguments.parser) + init_gen_dir(arguments.out, arguments.style) + gen_all_files(parser, arguments.std, arguments.out, arguments.style) + print("All done.") + + +if __name__ == "__main__": + arg_parser = argparse.ArgumentParser( + description="Generates documentation sites for Enso Standard Library." + ) + arg_parser.add_argument("token", help="GitHub user Personal Access Token.") + arg_parser.add_argument( + "--org", default=constants.ORGANIZATION, help="GitHub organization." + ) + arg_parser.add_argument( + "--repo", default=constants.REPO, help="Organization's repository." + ) + arg_parser.add_argument("--br", default=constants.BRANCH, help="Repository branch.") + arg_parser.add_argument( + "--dir", default=constants.DIRECTORY, help="Repository directory." + ) + arg_parser.add_argument( + "--ide_br", default=constants.IDE_BRANCH, help="IDE branch." + ) + arg_parser.add_argument( + "--commit", default=constants.PARSER_COMMIT, help="Scala parser commit." + ) + arg_parser.add_argument( + "--out", default=constants.OUT_DIR, help="Output directory." + ) + arg_parser.add_argument( + "--std", default=constants.STD_LIB_DIR, help="Std-Lib directory." + ) + arg_parser.add_argument( + "--style", default=constants.STYLE_FILE, help="Style file name." + ) + arg_parser.add_argument( + "--parser", default=constants.PARSER_FILE, help="Parser file name." + ) + arg_parser.add_argument( + "--parser_url", default=constants.PARSER_URL, help="URL to parser." + ) + args = arg_parser.parse_args() + main(args) diff --git a/src/parse.py b/src/parse.py new file mode 100644 index 00000000..e8917fac --- /dev/null +++ b/src/parse.py @@ -0,0 +1,70 @@ +""" +Creates `gen` directory with all necessary files. +""" +import glob +import execjs +import constants +from copy_file import copy_file +from safe_create_directory import safe_create_directory + + +def gen_all_files( + parser: execjs.ExternalRuntime, std_dir: str, out_dir: str, style_file: str +) -> None: + """ + Recursively generates all doc files and puts them into the `gen` directory. + """ + for filename in glob.iglob("**/*" + constants.FILE_EXT, recursive=True): + out_file_name = ( + filename.replace(std_dir + "/", "") + .replace("/", "-") + .replace(constants.FILE_EXT, ".html") + ) + print("Generating: " + out_file_name) + try: + __gen_file(parser, filename, out_file_name, out_dir, style_file) + except execjs.Error as err: + print("Could not generate: " + out_file_name) + print("Got an exception: " + str(err)) + + +def __gen_file( + parser: execjs.ExternalRuntime, + path: str, + out_name: str, + out_dir: str, + style_file: str, +) -> None: + """ + Generates an HTML file from Enso source file provided with `path` and saves + it as `out_name`. + """ + enso_file = open(path, "r") + js_method = "$e_doc_parser_generate_html_source" + stylesheet_link = '' + parsed = parser.call(js_method, enso_file.read()) + enso_file.close() + html_file = open(out_dir + "/" + out_name, "w") + html_file.write(stylesheet_link + parsed) + html_file.close() + + +def init_gen_dir(name: str, style_file: str) -> None: + """ + Creates the `gen` directory with all necessary files. + """ + safe_create_directory(name) + stylesheet_file: str = "/" + style_file + index_html_file: str = "/index.html" + source_directory: str = "src" + copy_file(constants.IN_DIR + stylesheet_file, name + stylesheet_file) + copy_file(source_directory + index_html_file, name + index_html_file) + + +def init_parser(parser_file: str) -> execjs.ExternalRuntime: + """ + Compiles the JS parser to call from within Python code. + """ + parser = open(constants.IN_DIR + "/" + parser_file, "r").read() + parser = execjs.compile(parser) + return parser diff --git a/src/replace_all_occurences_in_file.py b/src/replace_all_occurences_in_file.py new file mode 100644 index 00000000..bff93a4f --- /dev/null +++ b/src/replace_all_occurences_in_file.py @@ -0,0 +1,21 @@ +""" +Replaces all occurrences of a word in a file. +""" +import os + + +def replace_all_occurrences_in_file( + path_old: str, path_new: str, old_word: str, new_word: str +) -> None: + """ + Replaces all occurrences of a word in a file. + """ + file1 = open(path_old, "r") + file2 = open(path_new, "w") + + for line in file1.readlines(): + new_line: str = line.replace(old_word, new_word) + file2.write(new_line) + file1.close() + file2.close() + os.remove(path_old) diff --git a/src/safe_create_directory.py b/src/safe_create_directory.py new file mode 100644 index 00000000..2eb17eec --- /dev/null +++ b/src/safe_create_directory.py @@ -0,0 +1,15 @@ +""" +Safely creates a new directory from provided `path`. +""" +import os +import shutil + + +def safe_create_directory(path: str) -> None: + """ + Safely creates a new directory from provided `path`. + """ + if os.path.exists(path): + shutil.rmtree(path) + + os.makedirs(path)