{ "info": { "author": "Evandro Coan", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "## Fast File Package\n\nAn module written with pure Python C Extensions to open a file and\ncache the more recent accessed lines.\nSee these files for an usage example:\n1. [tests/fastfileperformance.py](tests/fastfileperformance.py)\n1. [tests/fastfiletest.py](tests/fastfiletest.py)\n1. [tests/getline_c_performance.cpp](tests/getline_c_performance.cpp)\n1. [tests/getline_cpp_performance.cpp](tests/getline_cpp_performance.cpp)\n\n\n## Installation\n\nRequires `Python 3` ,\n`pip3`, `distutils`, `setuptools`, `wheel` and\na `C++ 11` compiler installed:\n```\nsudo apt-get install build-essential g++ python3-dev python3 python3-pip\npip3 install setuptools wheel\n```\n\nThen, you can clone this repository with:\n```\ngit clone https://github.com/evandrocoan/fastfilepackage\ncd fastfilepackage\npip3 install .\n```\n\nOr install it with:\n```\npip3 install fastfilepackage\n```\n\n### Alternive file reading\n\nThere are available 3 alternative implementations for file reading.\nBoth of them,\nshould have the same performance.\n1. You can define `FASTFILE_GETLINE=0` to use the Python builtins.open() implementation (default)\n1. You can define `FASTFILE_GETLINE=1` to use the C++ std::getline() implementation\n1. You can define `FASTFILE_GETLINE=2` to use the POSIX C getline() implementation\n\nUsage examples:\n1. `FASTFILE_GETLINE=1 pip3 install . -v`\n1. `FASTFILE_GETLINE=1 FASTFILE_DEBUG=1 pip3 install . -v`\n\n\n### File reading optimizations\n\nYou can enable a file reading optimization with the environment variable `FASTFILE_REGEX=1`.\nDo not define this variable or define it as `FASTFILE_REGEX=0` to disable the optimization.\n\n1. `FASTFILE_REGEX=1` will use the C language builtin regex library `regex.h`:\n https://linux.die.net/man/3/regexec\n1. `FASTFILE_REGEX=2` will use PCRE2 regex library `pcre2.h`:\n http://pcre.org/current/doc/html/pcre2_match.html,\n it requires the installation of the `libpcre2-dev` package with `sudo apt-get install libpcre2-dev`\n1. `FASTFILE_REGEX=3` will use RE2 regex library `re2/re2.h`:\n https://github.com/google/re2/wiki/CplusplusAPI,\n it requires the installation of the `re2` library with:\n ```sh\n git clone https://github.com/google/re2 re2 &&\n cd re2 &&\n make &&\n sudo make install &&\n make testinstall\n ```\n1. `FASTFILE_REGEX=4` will use Hyperscan regex library `hs.h`:\n https://github.com/intel/hyperscan,\n it requires the installation of the `libhyperscan-dev` package with `sudo apt-get install libhyperscan-dev`\n\nNotes:\n * Defining the variable `FASTFILE_REGEX` only has effect when `FASTFILE_GETLINE=2` is set (as/with value 2).\n If the variable `FASTFILE_GETLINE=2` is not defined (as/with value 2),\n any definition of `FASTFILE_REGEX` is ignored.\n\n\n## Debugging\n\nYou you use the `FASTFILE_DEBUG=1` variable specified on the `Enable debug mode` section,\nyou do not need to build the program with `CFLAGS=\"-O0...\" CXXFLAGS=\"-O0 ...\"\n/usr/bin/pip3 install .` because these flags are already set by\n`FASTFILE_DEBUG=1`.\n\nIf Python got segmentation fault,\nyou need to install the debug symbol packages,\nand compile the program into mode debug.\nThese instructions works for both Linux and\nCygwin.\n```\nsudo apt-get install python3-dbg\napt-cyg install libcrypt-devel python36-devel python36-debuginfo python3-debuginfo python3-cython-debuginfo\nCFLAGS=\"-O0 -g -ggdb -fstack-protector-all\" CXXFLAGS=\"-O0 -g -ggdb -fstack-protector-all\" /usr/bin/pip3 install .\n\ncd modulename/source\ngdb --args /usr/bin/python3 -m modulename.__init__ -p ../tests/light/\npython3 -m pdb -m modulename.__init__ -p ../tests/light/\n\ncd /usr/bin\n/usr/bin/python3 -u -m trace -t modulename-script.py -p ../tests/light/\n```\n1. https://github.com/spiside/pdb-tutorial\n1. https://docs.python.org/3.7/library/pdb.html\n1. https://docs.python.org/3.7/library/trace.html\n1. https://stackoverflow.com/questions/1629685/when-and-how-to-use-gccs-stack-protection-feature\n1. https://stackoverflow.com/questions/25678978/how-to-debug-python-script-that-is-crashing-python\n1. https://stackoverflow.com/questions/46265835/how-to-debug-a-python-module-run-with-python-m-from-the-command-line\n\nIn case you program enter on a deadlock (or livelock),\nyou can use `gdb` to discover or what is happening.\nFor this,\nfirst you need get a `core dump file` of the system somehow.\nOnce you get the `core dump` file,\nyou can call `gdb program_name coredump`.\nNow,\nyou can use the `gdb` commands to navigate between the existing threads and\nto discover which of them are waiting for the other,\ni.e.,e it is causing the deadlock or livelock.\n1. `p / s 0x6ffffdf8ed0` print or content on the address with the format \"%s\"\n1. `x / 100w 0x6ffffdf8ed0` \"examines\" the specified memory address\n1. `frame 0` shows the corresponding stack frame `0` as `bt f` (`backtrace full`)\n1. `bt f 5` shows the last 5 stack frames with all debugging symbols data\n1. `f 0` and` p varname` print the `varname` on `frame 0` context\n1. https://stackoverflow.com/questions/14659147/how-to-print-pointer-content-in-gdb\n1. https://stackoverflow.com/questions/14502236/how-to-view-a-pointer-like-an-array-in-gdb\n\nNote:\nInstead of creating a `core dump file`,\nyou can run your program directly with `gdb --args program_name` and\nonce you are on the `gdb` command line,\nyou can use the `run` command and\nonce your program enters/starts a dead or live lock,\nyou can press `Ctrl+C` to stop the program execution.\nThen,\n`gdb` will already had \"captured\" the `core dum file`.\n\n\n## Enable debug mode\n\nThe default debug level is `0` where no debugging message code is generated into the final binary.\nGuaranteeing maximum performance.\nIf you would like to compile a binary with debug messages,\ndefine the environment variable `FASTFILE_DEBUG` before running the installer.\nYou can see the debugging level available on the file [source/debugger.h](source/debugger.h):\n```\nFASTFILE_DEBUG=1 pip install .\nFASTFILE_DEBUG=1 pip install -e .\n\nFASTFILE_DEBUG=1 python setup.py install\nFASTFILE_DEBUG=1 python setup.py develop\n```\n\nIf you are on Windows,\nrun it like this:\n```\nset \"FASTFILE_DEBUG=1\" && pip install .\nset \"FASTFILE_DEBUG=1\" && pip install -e .\nset \"FASTFILE_DEBUG=1\" && python setup.py install\nset \"FASTFILE_DEBUG=1\" && python setup.py develop\n```\n\nTo debug `refcounts` leaks:\n1. CPython compiled with `./configure --with-pydebug`\n1. Runtime compiled with C assertion:\n crash (kill itself with SIGABRT signal) if a C assertion fails (`assert(...);`).\n1. Use the debug hooks on memory allocators by default,\n as `PYTHONDEBUG=debug` environment variable:\n detect memory under and overflow and\n misuse of memory allocators.\n1. Compiled without compiler optimizations (`-Og` or even `-O0`) to be usable with a debugger like `gdb`:\n `python-gdb.py` should work perfectly.\n However,\n the regular runtime is unusable with `gdb` since most variables and\n function arguments are stored in registers,\n and so `gdb` fails with the `` message.\n1. https://pythoncapi.readthedocs.io/runtimes.html#debug-build\n1. https://stackoverflow.com/questions/40121749/why-gcc-og-doesnt-generate-source-code-line-mapping\n1. https://stackoverflow.com/questions/8650972/how-do-i-debug-refcounts-in-a-python-c-extension-the-easiest-way\n\nTo generate core dumps instead of stack traces on `Cygwin`\n```\nexport CYGWIN=\"$CYGWIN error_start=dumper -d %1 %2\"\n```\n1. https://stackoverflow.com/questions/320001/using-a-stackdump-from-cygwin-executable\n\nIf you see this when running `gdb`:\n```\n[New Thread 8980.0x626c]\n[New Thread 8980.0x1ba0]\n[New Thread 8980.0x2454]\n[New Thread 8980.0x3fbc]\nwarning: the debug information found in \"/usr/lib/debug//usr/bin/cygwin1.dbg\" does not match \"/usr/bin/cygwin1.dll\" (CRC mismatch).\n\n[New Thread 8980.0x21c4]\n```\nRun the command `rm /usr/lib/debug//usr/bin/cygwin1.dbg`\n1. http://cygwin.1069669.n5.nabble.com/Debugging-with-GDB-td94421.html\n\n\n## License\n\nSee the file [LICENSE.txt](LICENSE.txt)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/evandrocoan/fastfilepackage", "keywords": "", "license": "LGPLv2.1", "maintainer": "", "maintainer_email": "", "name": "fastfilepackage", "package_url": "https://pypi.org/project/fastfilepackage/", "platform": "", "project_url": "https://pypi.org/project/fastfilepackage/", "project_urls": { "Homepage": "https://github.com/evandrocoan/fastfilepackage" }, "release_url": "https://pypi.org/project/fastfilepackage/1.0.24/", "requires_dist": null, "requires_python": "", "summary": "An module written with pure Python C Extensions to open a file and cache the more recent accessed lines", "version": "1.0.24" }, "last_serial": 5435429, "releases": { "1.0.13": [ { "comment_text": "", "digests": { "md5": "b17e423bd8265c4ebec9efaad57e3cc1", "sha256": "2bcb2fb7e35632d778f17652f850772692c7cddfeda5a2b6c066cf52de8bbf4a" }, "downloads": -1, "filename": "fastfilepackage-1.0.13.tar.gz", "has_sig": false, "md5_digest": "b17e423bd8265c4ebec9efaad57e3cc1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14274, "upload_time": "2019-05-23T01:41:50", "url": "https://files.pythonhosted.org/packages/f6/6c/f9c8734ec838695455d1a05dba71cf398e8aaedc03bfc83bdf355b3de83f/fastfilepackage-1.0.13.tar.gz" } ], "1.0.24": [ { "comment_text": "", "digests": { "md5": "f8461c18360dfd1507565551c069300e", "sha256": "b9eb5e5ee63cc6dfa592de659740fc9cd97401dccc43eea0398a08de878c1ca5" }, "downloads": -1, "filename": "fastfilepackage-1.0.24.tar.gz", "has_sig": false, "md5_digest": "f8461c18360dfd1507565551c069300e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35273, "upload_time": "2019-06-22T18:42:28", "url": "https://files.pythonhosted.org/packages/96/a4/65e4e761fc9fbc61a0cc7eacba548a4b9109c3baa5515db7be8864d25b14/fastfilepackage-1.0.24.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f8461c18360dfd1507565551c069300e", "sha256": "b9eb5e5ee63cc6dfa592de659740fc9cd97401dccc43eea0398a08de878c1ca5" }, "downloads": -1, "filename": "fastfilepackage-1.0.24.tar.gz", "has_sig": false, "md5_digest": "f8461c18360dfd1507565551c069300e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35273, "upload_time": "2019-06-22T18:42:28", "url": "https://files.pythonhosted.org/packages/96/a4/65e4e761fc9fbc61a0cc7eacba548a4b9109c3baa5515db7be8864d25b14/fastfilepackage-1.0.24.tar.gz" } ] }