google-apputils


Namegoogle-apputils JSON
Version 0.4.2 PyPI version JSON
download
home_pagehttp://code.google.com/p/google-apputils-python
SummaryObsolete. Please migrate to absl-py instead.
upload_time2015-02-21 01:38:27
maintainerNone
docs_urlNone
authorGoogle Inc.
requires_pythonNone
licenseUNKNOWN
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Google Application Utilities for Python
=======================================

This project is a small collection of utilities for building Python
applications.  It includes some of the same set of utilities used to build and
run internal Python apps at Google.

Features:

  * Simple application startup integrated with python-gflags.
  * Subcommands for command-line applications.
  * Option to drop into pdb on uncaught exceptions.
  * Helper functions for dealing with files.
  * High-level profiling tools.
  * Timezone-aware wrappers for datetime.datetime classes.
  * Improved TestCase with the same methods as unittest2, plus helpful flags for
    test startup.
  * google_test setuptools command for running tests.
  * Helper module for creating application stubs.


Installation
============

To install the package, simply run:
  python setup.py install


Google-Style Tests
==================

Google-style tests (those run with basetest.main()) differ from setuptools-style
tests in that test modules are designed to be run as __main__. Setting up your
project to use Google-style tests is easy:

1. Create one or more test modules named '*_test.py' in a directory. Each test
module should have a main block that runs basetest.main():
  # In tests/my_test.py
  from google.apputils import basetest

  class MyTest(basetest.TestCase):
    def testSomething(self):
      self.assertTrue('my test')

  if __name__ == '__main__':
    basetest.main()

2. Add a setup requirement on google-apputils and set the test_dir option:
  # In setup.py
  setup(
      ...
      setup_requires = ['google-apputils>=0.2'],
      test_dir = 'tests',
      )

3. Run your tests:
  python setup.py google_test


Google-Style Stub Scripts
=========================

Google-style binaries (run with app.run()) are intended to be executed directly
at the top level, so you should not use a setuptools console_script entry point
to point at your main(). You can use distutils-style scripts if you want.

Another alternative is to use google.apputils.run_script_module, which is a
handy wrapper to execute a module directly as if it were a script:

1. Create a module like 'stubs.py' in your project:
  # In my/stubs.py
  from google.apputils import run_script_module

  def RunMyScript():
    import my.script
    run_script_module.RunScriptModule(my.script)

  def RunMyOtherScript():
    import my.other_script
    run_script_module.RunScriptModule(my.other_script)

2. Set up entry points in setup.py that point to the functions in your stubs
module:
  # In setup.py
  setup(
      ...
      entry_points = {
          'console_scripts': [
              'my_script = my.stubs:RunMyScript',
              'my_other_script = my.stubs.RunMyOtherScript',
              ],
          },
      )

There are also useful flags you can pass to your scripts to help you debug your
binaries; run your binary with --helpstub to see the full list.

            

Raw data

            {
    "_id": null,
    "home_page": "http://code.google.com/p/google-apputils-python",
    "name": "google-apputils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Google Inc.",
    "author_email": "opensource@google.com",
    "download_url": "https://files.pythonhosted.org/packages/69/66/a511c428fef8591c5adfa432a257a333e0d14184b6c5d03f1450827f7fe7/google-apputils-0.4.2.tar.gz",
    "platform": "UNKNOWN",
    "description": "Google Application Utilities for Python\n=======================================\n\nThis project is a small collection of utilities for building Python\napplications.  It includes some of the same set of utilities used to build and\nrun internal Python apps at Google.\n\nFeatures:\n\n  * Simple application startup integrated with python-gflags.\n  * Subcommands for command-line applications.\n  * Option to drop into pdb on uncaught exceptions.\n  * Helper functions for dealing with files.\n  * High-level profiling tools.\n  * Timezone-aware wrappers for datetime.datetime classes.\n  * Improved TestCase with the same methods as unittest2, plus helpful flags for\n    test startup.\n  * google_test setuptools command for running tests.\n  * Helper module for creating application stubs.\n\n\nInstallation\n============\n\nTo install the package, simply run:\n  python setup.py install\n\n\nGoogle-Style Tests\n==================\n\nGoogle-style tests (those run with basetest.main()) differ from setuptools-style\ntests in that test modules are designed to be run as __main__. Setting up your\nproject to use Google-style tests is easy:\n\n1. Create one or more test modules named '*_test.py' in a directory. Each test\nmodule should have a main block that runs basetest.main():\n  # In tests/my_test.py\n  from google.apputils import basetest\n\n  class MyTest(basetest.TestCase):\n    def testSomething(self):\n      self.assertTrue('my test')\n\n  if __name__ == '__main__':\n    basetest.main()\n\n2. Add a setup requirement on google-apputils and set the test_dir option:\n  # In setup.py\n  setup(\n      ...\n      setup_requires = ['google-apputils>=0.2'],\n      test_dir = 'tests',\n      )\n\n3. Run your tests:\n  python setup.py google_test\n\n\nGoogle-Style Stub Scripts\n=========================\n\nGoogle-style binaries (run with app.run()) are intended to be executed directly\nat the top level, so you should not use a setuptools console_script entry point\nto point at your main(). You can use distutils-style scripts if you want.\n\nAnother alternative is to use google.apputils.run_script_module, which is a\nhandy wrapper to execute a module directly as if it were a script:\n\n1. Create a module like 'stubs.py' in your project:\n  # In my/stubs.py\n  from google.apputils import run_script_module\n\n  def RunMyScript():\n    import my.script\n    run_script_module.RunScriptModule(my.script)\n\n  def RunMyOtherScript():\n    import my.other_script\n    run_script_module.RunScriptModule(my.other_script)\n\n2. Set up entry points in setup.py that point to the functions in your stubs\nmodule:\n  # In setup.py\n  setup(\n      ...\n      entry_points = {\n          'console_scripts': [\n              'my_script = my.stubs:RunMyScript',\n              'my_other_script = my.stubs.RunMyOtherScript',\n              ],\n          },\n      )\n\nThere are also useful flags you can pass to your scripts to help you debug your\nbinaries; run your binary with --helpstub to see the full list.\n",
    "bugtrack_url": null,
    "license": "UNKNOWN",
    "summary": "Obsolete. Please migrate to absl-py instead.",
    "version": "0.4.2",
    "project_urls": {
        "Download": "UNKNOWN",
        "Homepage": "http://code.google.com/p/google-apputils-python"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4a905540567740506890677937aff845bc02e17c3d4cf9bf59eb92ea3dc054b",
                "md5": "38b003cf8b73264340ffa8beeafaaf84",
                "sha256": "c01f1f743f451134fcb823eb095d689b8471581e401bb3d3e0d13741ee68ca2a"
            },
            "downloads": -1,
            "filename": "google_apputils-0.4.2-py2.7.egg",
            "has_sig": false,
            "md5_digest": "38b003cf8b73264340ffa8beeafaaf84",
            "packagetype": "bdist_egg",
            "python_version": "2.7",
            "requires_python": null,
            "size": 118300,
            "upload_time": "2015-02-21T01:38:32",
            "upload_time_iso_8601": "2015-02-21T01:38:32.457426Z",
            "url": "https://files.pythonhosted.org/packages/e4/a9/05540567740506890677937aff845bc02e17c3d4cf9bf59eb92ea3dc054b/google_apputils-0.4.2-py2.7.egg",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6966a511c428fef8591c5adfa432a257a333e0d14184b6c5d03f1450827f7fe7",
                "md5": "fb9fadf621dbecf28c8dabb5fe37ddb3",
                "sha256": "47959d0651c32102c10ad919b8a0ffe0ae85f44b8457ddcf2bdc0358fb03dc29"
            },
            "downloads": -1,
            "filename": "google-apputils-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "fb9fadf621dbecf28c8dabb5fe37ddb3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 81095,
            "upload_time": "2015-02-21T01:38:27",
            "upload_time_iso_8601": "2015-02-21T01:38:27.092358Z",
            "url": "https://files.pythonhosted.org/packages/69/66/a511c428fef8591c5adfa432a257a333e0d14184b6c5d03f1450827f7fe7/google-apputils-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "099c4b038fbc54ef7ee3640c0f75f87c89f4bb4c7f20b31b8bfc1093e15ead9d",
                "md5": "587c66c37f7f79f63b0b454628c4f660",
                "sha256": "f518d9c3ccf433352a79ad221dc7b80239dc53d030d132ada70fa51eadf7e33b"
            },
            "downloads": -1,
            "filename": "google-apputils-0.4.2.zip",
            "has_sig": false,
            "md5_digest": "587c66c37f7f79f63b0b454628c4f660",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 101503,
            "upload_time": "2015-02-21T01:38:30",
            "upload_time_iso_8601": "2015-02-21T01:38:30.014958Z",
            "url": "https://files.pythonhosted.org/packages/09/9c/4b038fbc54ef7ee3640c0f75f87c89f4bb4c7f20b31b8bfc1093e15ead9d/google-apputils-0.4.2.zip",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2015-02-21 01:38:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "google-apputils"
}
        
Elapsed time: 0.25723s