{"id":13714111,"url":"https://github.com/SWI-Prolog/swish","last_synced_at":"2025-05-07T01:32:17.088Z","repository":{"id":20547846,"uuid":"23827556","full_name":"SWI-Prolog/swish","owner":"SWI-Prolog","description":"SWI-Prolog for SHaring: a SWI-Prolog web IDE","archived":false,"fork":false,"pushed_at":"2024-04-29T19:32:17.000Z","size":5041,"stargazers_count":479,"open_issues_count":38,"forks_count":126,"subscribers_count":32,"default_branch":"master","last_synced_at":"2024-05-01T11:18:48.794Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Prolog","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SWI-Prolog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"SWI-Prolog","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2014-09-09T09:36:57.000Z","updated_at":"2024-05-27T15:26:07.365Z","dependencies_parsed_at":"2023-02-14T15:46:12.718Z","dependency_job_id":"a5ae6e48-c023-4ec6-9b12-e6bab1d4ef36","html_url":"https://github.com/SWI-Prolog/swish","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SWI-Prolog%2Fswish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SWI-Prolog%2Fswish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SWI-Prolog%2Fswish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SWI-Prolog%2Fswish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SWI-Prolog","download_url":"https://codeload.github.com/SWI-Prolog/swish/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224551162,"owners_count":17330089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T23:01:52.480Z","updated_at":"2024-11-14T01:30:38.958Z","avatar_url":"https://github.com/SWI-Prolog.png","language":"Prolog","funding_links":["https://github.com/sponsors/SWI-Prolog"],"categories":["Prolog","IDE"],"sub_categories":[],"readme":"# SWISH: A web based SWI-Prolog environment\n\nThere are three ways to use SWISH, which we list in increasing order of\ncomplexity:\n\n  1. [Use the online version](#online-versions)\n  2. [Deploy the Docker image](#docker-image)\n  3. [Install locally](#local-installation)\n\n## Online versions\n\nSWISH can be used to access [SWI-Prolog](http://www.swi-prolog.org) at\nthe address below. We try to keep this server continuously online. You\ncan use these servers for playing, courses or sharing and discussing\nideas.\n\n  - https://swish.swi-prolog.org/ (plain Prolog and R)\n  - http://cplint.ml.unife.it/ (probabilistic and machine learning\n    extensions)\n  - http://lpsdemo.interprolog.com/example/FirstStepswithLPS.swinb\n    (Logic Production Systems)\n\nWe have not yet dealt with scalable hosting nor with really reliable and\nscalable storage for saved programs. We hope to keep all your programs\nonline for at least multiple years.\n\n## Docker image\n\nWe maintain [Docker](https://hub.docker.com) images at the [swipl\norganization at Docker Hub](https://hub.docker.com/u/swipl/).  A\nbluffer's guide to run SWISH with R if you have Docker installed\nis as simple as this:\n\n    docker run -d --net=none --name=rserve swipl/rserve\n    docker run -d -p 3050:3050 --volumes-from rserve -v $(pwd):/data swipl/swish\n\nThere are many configuration options for SWISH, notably for\nauthentication, email notifications and extension plugins. See the\n[docker-swish](https://github.com/SWI-Prolog/docker-swish) repo for\ndetails.\n\n\n## Local installation\n\n### Get submodules\n\n`cd` to your swish root directory and run\n\n    git submodule update --init\n\nIf you have `make` installed you  can   configure  the  desired packs by\nediting the `PACKS` variable and run the  following to download them and\nconfigure those that need to be configured.\n\n    make packs\n\n### Get JavaScript requirements\n\n#### Using Yarn\n\nInstall [Yarn](https://yarnpkg.com) for your platform.   On Ubuntu, this\nimplies getting `node` and `npm` by installing two packages and next use\n`npm` to install `yarn` (some older  Linux versions need `nodejs-legacy`\ninstead of `nodejs`):\n\n    sudo apt install npm nodejs\n    sudo npm i yarn -g\n\nOnce you have `yarn`, run the following from the toplevel of `swish` to\nget the dependencies:\n\n    yarn\n    make src\n\n#### Download as zip\n\nAs installing node and yarn is not a pleasure on all operating systems,\nyou can also download  the  dependencies  as   a  single  zip  file from\nhttp://www.swi-prolog.org/download/swish/swish-node-modules.zip.\nUnpack the zip file, maintaining the directory structure, from the swish\nroot directory to create the directory web/node_modules. If you have\n`make` installed you can install the above `.zip` file using\n\n    make yarn-zip\n\nLast updated: Dec 16, 2019: upgraded dependencies, new archive name\n\n### Get the latest SWI-Prolog\n\nInstall the latest  [SWI-Prolog](http://www.swi-prolog.org) _development\nversion_. As SWISH is very  much  in   flux  and  depends  on the recent\nSWI-Prolog pengines and sandboxing libraries, it   is  quite common that\nyou            need            the             [nightly            build\n(Windows)](http://www.swi-prolog.org/download/daily/bin/) or build   the\nsystem    from    the     current      git     development    repository\n[swipl-devel.git](https://github.com/SWI-Prolog/swipl-devel).\n\nApr 25, 2019: Works for a quite large range of SWI-Prolog versions.\nThe current swipl-devel.git snapshot fixes an issue in CSV downloading,\nemitting CORS and cache control HTTP headers near the end of the CSV\noutput.\n\n### Other dependencies\n\nRendering Prolog terms [as\ngraphs](https://swish.swi-prolog.org/example/render_graphviz.swinb)\nrequires [Graphviz](https://www.graphviz.org/). The avatar system\nrequires the `convert` utility from\n[ImageMagic](https://www.imagemagick.org). These are available as\npackages for virtually any Linux system, e.g., on Debian based systems\ndo\n\n    sudo apt-get install imagemagick\n    sudo apt-get install graphviz\n\n\n\n## Running SWISH\n\nWith a sufficiently recent Prolog installed, start the system by opening\n`run.pl` either by running `swipl  run.pl`   (Unix)  or opening `run.pl`\nfrom the Windows explorer.\n\nNow direct your browser to http://localhost:3050/\n\nIf you want  to  know  what  the   latest  version  looks  like,  go  to\nhttps://swish.swi-prolog.org/\n\n### Configuring SWISH\n\nThere is a lot that can be configured in SWISH.  Roughly:\n\n  - Make additional libraries available, e.g., RDF support, database\n    connections, link to R, etc.\n\n  - Configure authentication and authorization.  The default is not\n    to demand and run commands sandboxed.  At the other extreme you\n    can configure the system to demand login for all access and provide\n    full access to Prolog.\n\nConfiguration is done  by  reading  `*.pl`   files  from  the  directory\n`config-enabled`. The directory `config-available`   contains  templates\nthat can be copied and optionally edited to create a configuration.\n\nSee [README.md in\nconfig-available](https://github.com/SWI-Prolog/swish/tree/master/config-available)\nfor details.\n\n\n### Running SWISH without sandbox limitations\n\nBy default, SWISH does not require the user   to  login but lets you run\nonly _safe_ commands.  If  you  want   to  use  SWISH  for  unrestricted\ndevelopment, enable the config file `auth_http_always.pl`:\n\n    mkdir -p config-enabled\n    (cd config-enabled \u0026\u0026 ln -s ../config-available/auth_http_always.pl)\n\nNext, for first usage, you need  to   create  a user. The authentication\nmodule defines swish_add_user/0, which asks for   details about the user\nto be created and updates or  creates   a  file  called `passwd`. At the\nmoment _Group_ and _E-Mail_ are stored, but not used.\n\n    ?- swish_add_user.\n    % Password file: /home/jan/src/prolog/swish/passwd (update)\n    User name: bob\n    Real name: Bob Hacker\n    Group:     user\n    E-Mail:    bob@hacker.org\n    Password:\n    (again):\n    true.\n\nIf you now try to run a command in  SWISH, it will prompt for a user and\npassword. After authentication you can run any Prolog predicate.\n\n**NOTE** Authentication uses HTTP _digest   authentication_  by default.\nThis authentication method uses a   challenge-response  method to verify\nthe password and ensures the credentials  change with every request such\nthat old credentials cannot be re-used   by  an attacker. Unfortunately,\nthe server stores the password as the   SHA1 hash created from the user,\npassword and _realm_.  This  is   relatively  vulnerable  to brute-force\nattacks for anyone who gains access to the  password file due to the low\ncomputational overhead of SHA1 and the   lack of a user-specific _salt_.\nAlso note that the exchanged  commands   and  replies are not encrypted.\nSecure servers should use HTTPS.\n\n### Optional login\n\nInstead of using `auth_http_always.pl` you can use `auth_http.pl`, which\nallows for unauthenticated -sandboxed- usage as   well  as logging in to\nthe server and get unrestricted  access.   In  addition, several _social\nlogin_ modules are provided to login  using Google, etc. Currently these\nprovide no additional rights. A more   fine grained authorization scheme\nis planned.\n\n\n## Running as a service\n\nThe script daemon.pl is provided to run SWISH  as a service or daemon on\nUnix systems. Run this to get an overview of the options.\n\n    ./daemon.pl --help\n\nThis script can be used to start  SWISH   as  a  daemon from the command\nline, start SWISH from service managers   such as `upstart` or `systemd`\nand    simplifies    running    as     an      HTTPS     server.     See\nhttps://github.com/triska/letswicrypt.\n\n\n## Running SWISH as additional local IDE\n\nYou can run SWISH alongside your   normal  Prolog development tools. The\ncleanest way to do so is by using  `myswish.pl` and install this in your\nlocal Prolog library. See `myswish.pl` for details   on  how to set this\nup.\n\n\n## Design\n\nMost of the application is realised  using client-side JavaScript, which\ncan be found  in  the  directory   `web/js`.  The  JavaScript  files use\n[RequireJS](http://requirejs.org/)   for   dependency     tracking   and\n[jQuery](https://jquery.com/) for structuring the   JavaScript  as jQuery\nplugins. The accompanying CSS is in   `web/css`.  More details about the\norganization of the JavaScript is in `web/js/README.md`\n\nThere are two overal pages. `web/swish.html`  provides a static page and\n`lib/page.pl` provides a Prolog frontend to  generate the overal page or\nparts thereof dynamically. The latter   facilitates smoothless embedding\nin SWI-Prolog web applications.\n\n\n## Development and debugging\n\nNo building is needed  to  run  the   system  from  sources.  For public\ninstallations you probably want to create   the  minified JavaScript and\nCSS files to reduce network traffic and startup time. You need some more\ntools for that:\n\n    % sudo npm install -g jsdoc\n    % sudo npm install -g requirejs\n    % sudo npm install -g clean-css-cli\n    % sudo npm install -g uglify-js\n\nYou also need GNU make installed as   `make`  and SWI-Prolog as `swipl`.\nWith all that in  place,  the   following  command  creates the minified\nversions:\n\n    % make min\n\nThe default main page (`/`)  is   generated  from `lib/page.pl`. It uses\nminified    JavaScript    and    CSS      from     `web/js/swish-min.js`\n`web/css/swish-min.css` when available. If the   minified  files are not\npresent,  the  server  automatically  includes   the  full  source.  The\ngenerated files may be removed using\n\n    make clean\n\nAlternatively, use of the minified  files   can  be  disable from Prolog\nusing this command and reloading the page:\n\n    ?- debug(nominified).\n\n## Documentation\n\nThe JavaScript is documented   using  [JsDoc](http://usejsdoc.org/). The\ngenerated documentation is available in `web/js/doc/index.html`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSWI-Prolog%2Fswish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSWI-Prolog%2Fswish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSWI-Prolog%2Fswish/lists"}