{"id":13938027,"url":"https://github.com/nuxt-community/python-module","last_synced_at":"2025-05-16T15:08:31.058Z","repository":{"id":28945607,"uuid":"119804303","full_name":"nuxt-community/python-module","owner":"nuxt-community","description":"Write Nuxt 2 applications using Python! [Experimental]","archived":false,"fork":false,"pushed_at":"2025-05-03T19:18:05.000Z","size":131,"stargazers_count":203,"open_issues_count":9,"forks_count":12,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-03T20:25:15.362Z","etag":null,"topics":["frontend","javascripthon","metapensiero","nuxt","nuxt-module","nuxtjs","python","web","website"],"latest_commit_sha":null,"homepage":"https://nuxt-python.surge.sh","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nuxt-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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,"zenodo":null}},"created_at":"2018-02-01T08:11:19.000Z","updated_at":"2025-03-05T13:22:40.000Z","dependencies_parsed_at":"2023-11-18T07:22:57.663Z","dependency_job_id":"cf305631-d788-4438-8dde-8a349b6cb756","html_url":"https://github.com/nuxt-community/python-module","commit_stats":{"total_commits":19,"total_committers":5,"mean_commits":3.8,"dds":"0.42105263157894735","last_synced_commit":"84320e71fd06f8e19bbf0d677492d64fe4a17fc6"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-community%2Fpython-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-community%2Fpython-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-community%2Fpython-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-community%2Fpython-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuxt-community","download_url":"https://codeload.github.com/nuxt-community/python-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553958,"owners_count":22090417,"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":["frontend","javascripthon","metapensiero","nuxt","nuxt-module","nuxtjs","python","web","website"],"created_at":"2024-08-07T23:04:10.829Z","updated_at":"2025-05-16T15:08:30.976Z","avatar_url":"https://github.com/nuxt-community.png","language":"Vue","readme":"# @nuxtjs/python\n[![npm (scoped with tag)](https://img.shields.io/npm/v/@nuxtjs/python/latest.svg?style=flat-square)](https://npmjs.com/package/@nuxtjs/python)\n[![npm](https://img.shields.io/npm/dt/@nuxtjs/python.svg?style=flat-square)](https://npmjs.com/package/@nuxtjs/python)\n[![CircleCI](https://img.shields.io/circleci/project/github/nuxt-community/python-module/master.svg?style=flat-square)](https://circleci.com/gh/nuxt-community/python-module)\n[![Codecov](https://img.shields.io/codecov/c/github/nuxt-community/python-module.svg?style=flat-square)](https://codecov.io/gh/nuxt-community/python-module)\n[![Dependencies](https://david-dm.org/nuxt-community/python-module/status.svg?style=flat-square)](https://david-dm.org/nuxt-community/python-module)\n[![js-standard-style](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com)\n\n\u003e Write Nuxt.js Apps in Python\n\n[📖 **Release Notes**](./CHANGELOG.md)\n\n## Features\n\n- Write Nuxt 2 applications using Python!\n- Currently only supports custom Javascripthon but in the future other compilers will also be expected to work.\n\n## Try the example\n\n1. Clone this repository and change directory into it\n2. Install dependencies:\n    ```\n    npm install                         # or use yarn\n\n    pip install -r requirements.txt\n    ```\n3. Run example: `npm run dev`\n\n## Setup in your own project\n\n- Add `@nuxtjs/python` dependency using yarn or npm to your project\n- Add `@nuxtjs/python` to `modules` section of `nuxt.config.js`\n  ```js\n  {\n    modules: [\n      '@nuxtjs/python'\n    ],\n    python: {\n      compiler: 'pj'   // default\n    }\n  }\n  ```\n- In Vue files, Mark your script tags like this: `\u003cscript lang=\"py\"\u003e`.\n- You may pass options to py-loader (currently it supports `compiler` parameter)\n\n## Choice of Python to Javascript compiler\n\nCompiler default and recommended is **Javascripthon** but it is possible to use other compilers (see below).\n\n- Install the [Javascripthon](https://gitlab.com/metapensiero/metapensiero.pj) Python transpiler. For now **you'll need the master branch** e.g:\n    ```\n    pip install -e git+https://gitlab.com/metapensiero/metapensiero.pj#egg=javascripthon\n    ```\n\n- Note that Javascripthon requires that you have **Python 3.5** (or better).\n\n- Javascripthon supports converting Python import statements to ES6 imports as used in Nuxt. Please note syntax [conversions](https://gitlab.com/metapensiero/metapensiero.pj#import-statements).\n\n- You can pass a `compiler` option to py-loader by using module options or in a `python` section in your `nuxt.config.js` file.\n\n- `Transcrypt` has its own module system so in order to use it, you can use the CommonJS module standard (`require` to import and `module.exports`) and it should work. See the `py-loader` [Vuejs example](https://github.com/martim00/python-webpack-loader/blob/master/examples/vue-demo/src/App.vue).\n\n## Usage\n\n### Using `.vue` files\n\n**TIP** If you use Vim you can get syntax highlighting for HTML, CSS *and* Python by installing [vim-vue](https://github.com/posva/vim-vue) plugin and applying [this patch](https://github.com/posva/vim-vue/pull/97).\n\n`hello.vue`:\n\n```html\n\u003ctemplate\u003e\n  \u003cdiv\u003e\n      Nuxt {{ best_lang }}\n  \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript lang=\"py\"\u003e\nclass Component:\n  def __init__(self):\n      self['data'] = lambda: { 'best_lang': 'Python' }\n\n__default__ = Component()\n\u003c/script\u003e\n```\n\n### Using `.py` files for other nuxt files\n\n`store/index.py`\n\n```python\nfrom vuex import Store\n\ndef increment(state):\n    state.counter = state.counter + 1\n\ndef createStore():\n    return Store(\n      state={'counter': 0},\n      mutations={'increment': increment}\n    )\n\n__default__ = createStore\n```\n\n`pages/counter.vue`\n\n```html\n\u003ctemplate\u003e\n  \u003ch2\u003e{{ $store.state.counter }}\u003c/h2\u003e\n  \u003cbutton @click=\"$store.commit('increment')\"\u003e+1\u003c/button\u003e\n\u003c/template\u003e\n```\n\n👉 For a working example, see [here](./example).\n\n## Development\n\n- Clone this repository\n- Install dependencies using `yarn install` or `npm install`\n- Start development server using `npm run dev`\n\n## License\n\n[MIT License](./LICENSE)\n\nCopyright (c) Sebastian Silva \u003csebastian@fuentelibre.org\u003e\n\nThis module was started from the [module-template](https://github.com/nuxt-community/module-template) by Pooya Parsa and relies heavily on [python-webpack-loader](https://github.com/martim00/python-webpack-loader) by Martim Nascimento and [Javascripthon](https://gitlab.com/metapensiero/metapensiero.pj) by Alberto Berti.\n","funding_links":[],"categories":["Vue"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuxt-community%2Fpython-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuxt-community%2Fpython-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuxt-community%2Fpython-module/lists"}