{ "info": { "author": "Harshad Sharma", "author_email": "harshad@sharma.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Internet", "Topic :: Software Development", "Topic :: Utilities" ], "description": "MakeWeb\n=======\n\nMake interactive web apps using good ol\u2019 HTML, CSS and a sprinkling of\nJavaScript \u2014 in Python.\n\nExamples:\n---------\n\nHyperText Markup Lnguage\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf we run this script:\n\n.. code:: python\n\n # 00-generate-html.py\n\n from makeweb import Doc, body, h1\n\n def generate_html():\n doc = Doc('html', lang='mr')\n with body():\n h1('\u0939\u093e!')\n return str(doc)\n\n print(generate_html())\n\nWe should see this output on the screen:\n\n.. code:: html\n\n \n \n \n

\u0939\u093e!

\n \n \n\n*(Whitespace added for clarity.)*\n\nHa! HTML was easy, let us generate CSS from Python code.\n\nCascading Style Sheets\n~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n # 01-generate-css.py\n\n from makeweb import CSS\n\n css = CSS()\n\n css('body', background='white', color='#222')\n css('h1', color='darkorange', margin__top='1em')\n\n print(str(css))\n\nRunning the above example we see\u2026\n\n.. code:: css\n\n body{\n background:white;\n color:#222\n }\n h1{\n color:darkorange;\n margin-top:1em\n }\n\n*(Whitespace added for clarity.)*\n\nNotice that the double underscore in ``css('h1', margin__top='1em')``\ngets converted to hyphen in CSS as ``h1{margin-top:1em}``. This pattern\nis used throughout the library for HTML and CSS attributes.\n\nSo\u2026 CSS is even easier?! How about something more ambitious?\n\nJavaScript\n~~~~~~~~~~\n\n.. code:: python\n\n # 02-generate-js.py\n\n from makeweb import JS\n\n js = JS()\n\n @js.function\n def say_hello():\n hello_box = document.getElementById(\"hello_box\")\n hello_box.innerHTML = \"Hello, World Wide Web!\"\n\n print(str(js))\n\nAnd we get a JavaScript function out!\n\n.. code:: javascript\n\n function say_hello(){\n var hello_box;\n hello_box=document.getElementById(\"hello_box\");\n hello_box.innerHTML=\"Hello, World Wide Web!\";\n }\n\n*(Whitespace added for clarity.)*\n\nNow let us use these capabilities together!\n\nApp\n~~~\n\n.. code:: python\n\n # hello-readme.py\n\n from flask import Flask, Response\n from makeweb import (\n Doc, CSS, JS,\n head, title, style, script,\n body, h1, button,\n )\n\n # We'll use Flask to serve, you could use any other framework \n # or save as static files, or anything else \n # that you wish to do with generated html.\n app = Flask(__name__) \n css = CSS()\n js = JS()\n\n css('*,body', # <-- Add CSS to taste.\n font__family='sans-serif',\n text__align='center')\n css('h1', color=\"darkblue\") \n\n\n @js.function # <-- A sprinkling of JavaScript. Look ma, no braces!\n def say_hello():\n hello_box = document.getElementById(\"hello_box\")\n hello_box.innerHTML = \"Hello, World Wide Web!\"\n\n\n @app.route('/')\n def index():\n doc = Doc('html') # <-- Generate all the HTML your app (really) needs.\n with head():\n title('Hello')\n with style(): # Embed CSS.\n css.embed()\n with body():\n h1('...', id='hello_box') # Set attributes. \n button('Hello', onclick=\"say_hello()\") # <-- hook up say_hello().\n with script(): # Embed JavaScript.\n js.embed()\n return Response(str(doc)) # <-- Serve all the awesome your users desire!\n\n\n app.run() # <-- It is time! \n\nThis app transfers ~550 bytes over the network in order to run\nsuccessfully, that is including the HTTP headers overhead. You read that\nright, not even one kilobyte! The web technologies are quite simple and\nstraightforward for general use, and very flexible, robust and powerful\ntoo!\n\nYou might not need (or want the baggage of) complex tooling for a small\nproject. It could be a one time make-and-forget tool at work or a\nweekend hobby project, or maybe something even larger if you really like\nthis way of working. MakeWeb can come in handy because it makes it\nalmost trivial to build the web like it was intended, straight from your\nPython code.\n\nWait, somebody mentioned single-page-apps? How about single source-file\napps that don\u2019t download half the internet to work? \ud83d\ude02 Kidding, this is a\nvery, very barebones system, and therefore you can use any existing\nstylesheets or JS libraries alongside MakeWeb.\n\n Check out examples for more demos!\n\nInstall:\n--------\n\nStable:\n~~~~~~~\n\n::\n\n $ python3 -m venv makeweb\n $ source makeweb/bin/activate\n $ pip install makeweb[js]\n\nCurrent:\n~~~~~~~~\n\n::\n\n $ python3 -m venv makeweb\n $ source makeweb/bin/activate\n $ git clone https://github.com/hiway/makeweb.git\n $ cd makeweb\n $ pip install -e .[examples]\n\nDevelopment:\n~~~~~~~~~~~~\n\n::\n\n $ python3 -m venv makeweb\n $ source makeweb/bin/activate\n $ git clone https://github.com/hiway/makeweb.git\n $ cd makeweb\n $ pip install -e .[dev]\n\nTest:\n^^^^^\n\n.. code:: bash\n\n $ pytest tests.py\n\nWith coverage:\n\n.. code:: bash\n\n $ pytest --cov=makeweb --cov-report=term tests.py\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hiway/makeweb", "keywords": "website,html,css,javascript,generate,template", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "makeweb", "package_url": "https://pypi.org/project/makeweb/", "platform": "", "project_url": "https://pypi.org/project/makeweb/", "project_urls": { "Homepage": "https://github.com/hiway/makeweb" }, "release_url": "https://pypi.org/project/makeweb/0.1.0/", "requires_dist": [ "pytidylib; extra == 'dev'", "jsmin; extra == 'dev'", "javascripthon; extra == 'dev'", "flask; extra == 'dev'", "pytest; extra == 'dev'", "pytest-cov; extra == 'dev'", "faker; extra == 'examples'", "markdown; extra == 'examples'", "flask; extra == 'examples'", "tinydb; extra == 'examples'", "jsmin; extra == 'examples'", "javascripthon; extra == 'examples'", "jsmin; extra == 'js'", "javascripthon; extra == 'js'" ], "requires_python": "", "summary": "", "version": "0.1.0" }, "last_serial": 3837070, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "75afc8713c92196454a46e6cae15941b", "sha256": "7300dc0cf81dcae3f5eecd5082adf45ed4680e84c5e596bd847b012d4cfaea95" }, "downloads": -1, "filename": "makeweb-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "75afc8713c92196454a46e6cae15941b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6656, "upload_time": "2018-05-05T15:23:37", "url": "https://files.pythonhosted.org/packages/98/27/07317a39ddef88b3b573a565264e08175aa16abaaef866c8bf7f3d0610fb/makeweb-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d8a7e8d670218dfa34659a392da57fa8", "sha256": "fd178fb32413279e8d2936c4d4e36185e1efaf129b9a8e434445c30074b686c3" }, "downloads": -1, "filename": "makeweb-0.1.0.tar.gz", "has_sig": false, "md5_digest": "d8a7e8d670218dfa34659a392da57fa8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7802, "upload_time": "2018-05-05T15:23:39", "url": "https://files.pythonhosted.org/packages/74/b5/668f747a64bd280f527a1044d2527bfb47bc77cd08378d9449f176ed15d5/makeweb-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "75afc8713c92196454a46e6cae15941b", "sha256": "7300dc0cf81dcae3f5eecd5082adf45ed4680e84c5e596bd847b012d4cfaea95" }, "downloads": -1, "filename": "makeweb-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "75afc8713c92196454a46e6cae15941b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6656, "upload_time": "2018-05-05T15:23:37", "url": "https://files.pythonhosted.org/packages/98/27/07317a39ddef88b3b573a565264e08175aa16abaaef866c8bf7f3d0610fb/makeweb-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d8a7e8d670218dfa34659a392da57fa8", "sha256": "fd178fb32413279e8d2936c4d4e36185e1efaf129b9a8e434445c30074b686c3" }, "downloads": -1, "filename": "makeweb-0.1.0.tar.gz", "has_sig": false, "md5_digest": "d8a7e8d670218dfa34659a392da57fa8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7802, "upload_time": "2018-05-05T15:23:39", "url": "https://files.pythonhosted.org/packages/74/b5/668f747a64bd280f527a1044d2527bfb47bc77cd08378d9449f176ed15d5/makeweb-0.1.0.tar.gz" } ] }