{ "info": { "author": "Evan Plaice", "author_email": "evanplaice@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Other Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.0", "Programming Language :: Python :: 3.1", "Topic :: Software Development :: Code Generators", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Pre-processors" ], "description": "pypreprocessor\n==============\n\nFeatures\n--------\n\n**support c-style directives in python**\n\n- using an intentionally limited subset of the c directives, and then\n some...\n\n**can run post-processed code on-the-fly**\n\n- pre-process and run code all in one shot\n- accurately preserves error tracebacks for the source file\n\n**can output to a file**\n\n- as easily as setting a flag\n- with a user specified filename if defined\n\n**can strip all pre-processor data from the output**\n\n- as easily as setting a flag\n- removes all preprocessor directives\n- removes all preprocessor specific code\n\n**#defines can be set in code prior to processing**\n\n- useful if you need to run a file in different modes\n- eliminates the need for decision logic in the preprocessor itself\n\n**nested #ifdef directives are supported**\n\n- helpfull for more complicated code\n- .. rubric:: endifall gives the opportunity to end all open blocks\n :name: endifall-gives-the-opportunity-to-end-all-open-blocks\n\nBenefits\n--------\n\n**Ease of Use**\n\n- all of the functionality required to run the pypreprocessor is\n contained in a single module\n- adding preprocessor support is as simple as importing pypreprocessor\n to a file containing preprocessor directives and telling it to run\n- the preprocessor preserves errors in the pre and post processed code\n as much as possible\n- the preprocessor will break execution and output traceback errors if\n it sees invalid preprocessor directives\n\n**Dynamic**\n\n- pypreprocessor has multiple option of operation\n- it can generate a new post-processed version of a source file absent\n all of the preprocessor information\n- or it can pre-process and run code transparently the same way as\n c-style languages do\n\n**Simple**\n\n- the source footprint for the pypreprocessor code is very small\n- the preprocessor is designed to be as simple and lightweight as\n possible\n\nSyntax\n------\n\nThe syntax for pypreprocessor uses a select subset of the stanard\nc-style preprocessor directives, and then some...\n\n**Supported directives**\n\n- define non-value constants used by the preprocessor\n\n .. code:: python\n\n #define constant\n\n- remove a non-value constant from the list of defined constants\n\n .. code:: python\n\n #undef constant\n\n- makes the subsequent block of code available if the specified\n constant is set\n\n .. code:: python\n\n #ifdef constant\n\n- makes the subsequent block of code available if all of the preceding\n #ifdef statements return false\n\n .. code:: python\n\n #else\n\n- required to close out an #ifdef/#else block\n\n .. code:: python\n\n #endif\n\n- possibility to close all open blocks\n\n .. code:: python\n\n #endifall\n\n- exclude the subsequent block of code (conditionals not included). I\n know it doesn't fit into the standard set of c-style directives but\n it's too handy to exclude (no pun).\n\n .. code:: python\n\n #exclude\n\n- required to close out an #exclude block\n\n .. code:: python\n\n #endexclude\n\n**Options**\n\nThe following options need to be set prior to pypreprocessor.parse()\n\n.. code:: python\n\n pypreprocessor.defines.append('define')\n\nadd defines to the preprocessor programmatically, this allows the source\nfile to have some decision logic to decide which 'defines' need to be\nset\n\n.. code:: python\n\n pypreprocessor.run = True / False\n pypreprocessor.resume = True / False\n pypreprocessor.save = True / False\n\nset the options of the preprocessor:\n\n- run: Run the preprocessed code if true. Default is true\n- resume: Return after a file is preprocessed and can preprocess a next\n file if true. Default is false\n- save: Save preprocessed code if true. Default is true\n\n.. code:: python\n\n pypreprocessor.input = 'inputFile.py'\n\nrequired if you are preprocessing a module that is going to be imported.\nyou can also use it to process external files.\n\n.. code:: python\n\n pypreprocessor.output = 'outputFile.py'\n\nset this to get a user defined name for the output file, otherwise the\ndefault is used: ``'inputFile_out.py'``\n\n.. code:: python\n\n pypreprocessor.removeMeta = True\n\nset this to remove the metadata from the output, useful if you're\ngenerating a 'clean' version of the source\n\n.. code:: python\n\n pypreprocessor.readEncoding = sys.stdin.encoding\n pypreprocessor.writeEncoding = sys.stdout.encoding\n\nset this to make preprocessor use encoding\n\nApplications\n------------\n\n**Include support for debug-specific information**\n\nIt is often useful to provide statements within code specific to\ndebugging, such as, print statements used to verify correct outputs.\nBut, removing those debug statements can be painful and introduce new\nbugs while migrating to the production version.\n\nWhy not leave them...\n\nBy setting a \"#define debug\" at the top of the module and wrapping all\nof the debug statements in \"#ifdef debug\" blocks; disabling that code\nduring production is as easy as adding another hash mark before the\n\"#define debug\" statement.\n\nFor a working example see:\n\n- `/examples/debug.py `__\n\n**Python2 -> Python3 code conversion**\n\nProducing code that can be run in both Python 2 and Python 3 is as easy\nas...\n\n1. check the version of the python interpreter in use\n2. set a #define in the preprocessor indicating the version\n3. add #ifdef directives on the code that is version specific\n\nFor a working example see:\n\n- `/examples/py2and3.py `__\n\n**Writing code from Debug -> Production in the same file**\n\nEver wanted to run a file with debug-specific code during development\nbut output a clean version specific source file for release? Here's\nhow...\n\n1. make a source file that takes the arguments 'debug' and 'production'\n2. put the debug code in \"#ifdef debug\" blocks\n3. then run 'filename.py debug' during development\n4. or 'filename.py production' to output a version without any of the\n pypreprocessor metadata\n\nFor a working example see:\n\n- `/examples/debug2production.py `__\n\nNote: This file also contains a 'postprocessed' mode that shows what\npypreprocessor actually outputs. It's so simple it'll probably make you\n::facepalm:: ;)\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/interpreters/pypreprocessor", "keywords": "python", "license": "The MIT License (MIT)\n\nCopyright (c) 2010 Evan Plaice\nCopyright (c) 2017 Hendi O L\nCopyright (c) 2018 Epikem\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n", "maintainer": "", "maintainer_email": "", "name": "pypreprocessor", "package_url": "https://pypi.org/project/pypreprocessor/", "platform": "all", "project_url": "https://pypi.org/project/pypreprocessor/", "project_urls": { "Homepage": "https://github.com/interpreters/pypreprocessor" }, "release_url": "https://pypi.org/project/pypreprocessor/0.7.7/", "requires_dist": null, "requires_python": "", "summary": "Run c-style preprocessor directives in python modules", "version": "0.7.7" }, "last_serial": 3575634, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "d9e05f3e8373f89816540d06be4dc91d", "sha256": "eb53c3df7074254cffc750f961f428f0e51800035f22ccf420c631bc49d9ecab" }, "downloads": -1, "filename": "pypreprocessor-0.1.0.linux-i686.exe", "has_sig": false, "md5_digest": "d9e05f3e8373f89816540d06be4dc91d", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 64430, "upload_time": "2010-06-02T09:15:59", "url": "https://files.pythonhosted.org/packages/c4/b6/386c92e3d1755841644dab9b6f8a22a9172333cd777f0b5299759b1c6c85/pypreprocessor-0.1.0.linux-i686.exe" }, { "comment_text": "", "digests": { "md5": "287e2f04bfd4108bf57f2ccf9812d2c1", "sha256": "fbd81fc3f72427f483abb84a4e983b84fb6d9c165859bafae616a89d5c6084bb" }, "downloads": -1, "filename": "pypreprocessor-0.1.0.tar.gz", "has_sig": false, "md5_digest": "287e2f04bfd4108bf57f2ccf9812d2c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2226, "upload_time": "2010-06-02T09:15:57", "url": "https://files.pythonhosted.org/packages/10/d7/fb122a943203197bcfdde9c43b679d0724b229a433a745655bf169e4e4bb/pypreprocessor-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "25426bf98924af66f41275e8632afbd2", "sha256": "6bedd93862c946bb46c9ed2072eee2332a1c75f6698d56875eb1318f8ab2be4a" }, "downloads": -1, "filename": "pypreprocessor-0.2.0.linux-i686.exe", "has_sig": false, "md5_digest": "25426bf98924af66f41275e8632afbd2", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 64775, "upload_time": "2010-06-04T22:44:12", "url": "https://files.pythonhosted.org/packages/10/94/9a855d54c59e35b978940dd335d14eb06deff33034d6b1f87a8bbbeb74e8/pypreprocessor-0.2.0.linux-i686.exe" }, { "comment_text": "", "digests": { "md5": "2048a5ca9736580461629b6ae97e921b", "sha256": "12cc163805d01e8659f5cf995b1627b97afdb62121df69feab03d64163bd75fe" }, "downloads": -1, "filename": "pypreprocessor-0.2.0.tar.gz", "has_sig": false, "md5_digest": "2048a5ca9736580461629b6ae97e921b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3610, "upload_time": "2010-06-04T22:44:10", "url": "https://files.pythonhosted.org/packages/43/9a/09655a896f949d2e2bfa7cc43f12ea756679dfebe8723678d57f42531b72/pypreprocessor-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "92d5ec3df56eafc3e643437a36e420b3", "sha256": "415b55c49c034a4a89cab62f548424221d33cf379edc7ca7911f1d376a617385" }, "downloads": -1, "filename": "pypreprocessor-0.3.0.linux-i686.exe", "has_sig": false, "md5_digest": "92d5ec3df56eafc3e643437a36e420b3", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 66883, "upload_time": "2010-06-10T01:11:12", "url": "https://files.pythonhosted.org/packages/03/08/dce3031fbd25590adc3bd9d86868e08421b8d5448449645723271af03ea3/pypreprocessor-0.3.0.linux-i686.exe" }, { "comment_text": "", "digests": { "md5": "722714c419a1d5fdcd55bfe34ac05696", "sha256": "9e16c2d8a3d0800c9d14a88b75a2ec211c0c33218cffa2714944700bae4b0dd7" }, "downloads": -1, "filename": "pypreprocessor-0.3.0.tar.gz", "has_sig": false, "md5_digest": "722714c419a1d5fdcd55bfe34ac05696", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5277, "upload_time": "2010-06-10T01:11:11", "url": "https://files.pythonhosted.org/packages/b3/c6/56d017157f932b3062c5b11f34730ea8c79caf7f4a447b8662b748cead9f/pypreprocessor-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "931f7667beeb46069d78a98f83494d95", "sha256": "9b5486575a6247ae6c2cc35f99489fc2f792385f7403eaff11ce46306ebe2298" }, "downloads": -1, "filename": "pypreprocessor-0.4.0.linux-i686.exe", "has_sig": false, "md5_digest": "931f7667beeb46069d78a98f83494d95", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 66851, "upload_time": "2010-06-20T10:27:41", "url": "https://files.pythonhosted.org/packages/6f/d0/fed363b24d05db0e3f71f23587299642e84ab746e9e5e41b5dd6bc8fd965/pypreprocessor-0.4.0.linux-i686.exe" }, { "comment_text": "", "digests": { "md5": "49d6030696897d152ae65caa6c7f9cd4", "sha256": "93137ccffe9c32f49831d30c2bfc7b5a445202f4c7e9a99572c04d0d92ec4a75" }, "downloads": -1, "filename": "pypreprocessor-0.4.0.tar.gz", "has_sig": false, "md5_digest": "49d6030696897d152ae65caa6c7f9cd4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5277, "upload_time": "2010-06-20T10:27:39", "url": "https://files.pythonhosted.org/packages/1c/31/369f552cf4abb0a3992da15c23baedb29e1cb77d9e003d7160b136add4d0/pypreprocessor-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "1a7ba18ca0c341063f614c5aaa281ff5", "sha256": "18a33e46538ec9f329d92d5cafa0a588aa528021d06b35a249629a190eb7f597" }, "downloads": -1, "filename": "pypreprocessor-0.5.0.macosx-10.10-intel.exe", "has_sig": false, "md5_digest": "1a7ba18ca0c341063f614c5aaa281ff5", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 66762, "upload_time": "2015-09-09T09:06:51", "url": "https://files.pythonhosted.org/packages/a7/8a/45caa69df393a13b5f2b38bd98dd575513484d1978898ae5cc99999b9d1c/pypreprocessor-0.5.0.macosx-10.10-intel.exe" }, { "comment_text": "", "digests": { "md5": "395cfa97162d54793859d5957978f812", "sha256": "e15a73ab5134c27fec97072e90b37b5d1ba622e678f021eabaddfefd5ce999a7" }, "downloads": -1, "filename": "pypreprocessor-0.5.0.tar.gz", "has_sig": false, "md5_digest": "395cfa97162d54793859d5957978f812", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4796, "upload_time": "2015-09-09T09:06:46", "url": "https://files.pythonhosted.org/packages/3a/5f/ba99c2b3953064c3569b6af687affbb644151d5eb5f64347d2f595540f9c/pypreprocessor-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "ee6ca2ac219abee17346a104ae62c90c", "sha256": "80ef829c24b982ce3c3c8287ae502037da2857110bf2482e5c00d2173190bafc" }, "downloads": -1, "filename": "pypreprocessor-0.6.0.tar.gz", "has_sig": false, "md5_digest": "ee6ca2ac219abee17346a104ae62c90c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6418, "upload_time": "2016-01-25T16:29:56", "url": "https://files.pythonhosted.org/packages/c7/5f/4db323d7891a6f6086174de65e1254551b473e8fd83b1dffa416ea11c088/pypreprocessor-0.6.0.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "f0f4f9c6a5da36118f3266b7d138d1dd", "sha256": "8c3651d33fdf2ddc58941c3cb8ce2f3d7d4f6f679827ca84e0e7bcb5bfe6c6a0" }, "downloads": -1, "filename": "pypreprocessor-0.7.tar.gz", "has_sig": false, "md5_digest": "f0f4f9c6a5da36118f3266b7d138d1dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7601, "upload_time": "2018-01-26T08:36:26", "url": "https://files.pythonhosted.org/packages/10/c8/d878fa8533e93c7df4483316b0f807d66e58bf9f0fa6ed317f5cd62df56e/pypreprocessor-0.7.tar.gz" } ], "0.7.3": [ { "comment_text": "", "digests": { "md5": "7523a68f7989b5d5e3cfd9f951916483", "sha256": "571edbe4778bd77ab77f332bb42237c8c8f464d18ad3ff9b199ead7d8b1514b0" }, "downloads": -1, "filename": "pypreprocessor-0.7.3.tar.gz", "has_sig": false, "md5_digest": "7523a68f7989b5d5e3cfd9f951916483", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9807, "upload_time": "2018-01-31T06:47:28", "url": "https://files.pythonhosted.org/packages/3b/9b/16762b39a5a031a7046897837d96d40d2c97aecb910dc9ebc470dc389d56/pypreprocessor-0.7.3.tar.gz" } ], "0.7.7": [ { "comment_text": "", "digests": { "md5": "6143e2ff20dc797f46d1a2e4745d1cff", "sha256": "0d6d5256675c694d640878e853bfec55d18164df63b5c1459261c58f0c033014" }, "downloads": -1, "filename": "pypreprocessor-0.7.7.tar.gz", "has_sig": false, "md5_digest": "6143e2ff20dc797f46d1a2e4745d1cff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10946, "upload_time": "2018-02-12T17:33:15", "url": "https://files.pythonhosted.org/packages/27/54/c8daff18372422e66fb3c474af4b9fb3c0e9fc94685f4948d990d7080b08/pypreprocessor-0.7.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6143e2ff20dc797f46d1a2e4745d1cff", "sha256": "0d6d5256675c694d640878e853bfec55d18164df63b5c1459261c58f0c033014" }, "downloads": -1, "filename": "pypreprocessor-0.7.7.tar.gz", "has_sig": false, "md5_digest": "6143e2ff20dc797f46d1a2e4745d1cff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10946, "upload_time": "2018-02-12T17:33:15", "url": "https://files.pythonhosted.org/packages/27/54/c8daff18372422e66fb3c474af4b9fb3c0e9fc94685f4948d990d7080b08/pypreprocessor-0.7.7.tar.gz" } ] }