Skip to main content
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.

Release files for google-apputils 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distributions (sdists)

Source distribution for google-apputils 0.4.2
File Size Uploaded
google-apputils-0.4.2.zip 101.5 kB Details
google-apputils-0.4.2.tar.gz 81.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for google-apputils 0.4.2
File Interpreter ABI Platform
google_apputils-0.4.2-py2.7.egg Legacy Egg format - - Details

Total release size: 300.9 kB

Release files / google-apputils-0.4.2.zip

Download URL google-apputils-0.4.2.zip
Size 101.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f518d9c3ccf433352a79ad221dc7b80239dc53d030d132ada70fa51eadf7e33b
BLAKE2b-256 checksum
How to use checksums
099c4b038fbc54ef7ee3640c0f75f87c89f4bb4c7f20b31b8bfc1093e15ead9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / google-apputils-0.4.2.tar.gz

Download URL google-apputils-0.4.2.tar.gz
Size 81.1 kB
Tags Source
SHA-256 checksum
How to use checksums
47959d0651c32102c10ad919b8a0ffe0ae85f44b8457ddcf2bdc0358fb03dc29
BLAKE2b-256 checksum
How to use checksums
6966a511c428fef8591c5adfa432a257a333e0d14184b6c5d03f1450827f7fe7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / google_apputils-0.4.2-py2.7.egg

Download URL google_apputils-0.4.2-py2.7.egg
Size 118.3 kB
Tags Egg
SHA-256 checksum
How to use checksums
c01f1f743f451134fcb823eb095d689b8471581e401bb3d3e0d13741ee68ca2a
BLAKE2b-256 checksum
How to use checksums
e4a905540567740506890677937aff845bc02e17c3d4cf9bf59eb92ea3dc054b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.4.2 This release

3 release files

0.4.1

3 release files

0.4.0

1 release file

0.3.0

0.2.2

1 release file

0.2.1

0.2

1 release file

0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page