google / google-apputils Goto Github PK
View Code? Open in Web Editor NEWPlease use https://github.com/abseil/abseil-py instead. This was auto-exported from code.google.com/p/google-apputils-python
License: Apache License 2.0
Please use https://github.com/abseil/abseil-py instead. This was auto-exported from code.google.com/p/google-apputils-python
License: Apache License 2.0
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.
ls -la google_apputils.egg-info
total 56
drwxr-x--- 9 schwehr eng 306 Feb 29 2012 .
drwxr-x--- 11 schwehr eng 374 Feb 29 2012 ..
-rw-r----- 1 schwehr eng 247 Feb 29 2012 PKG-INFO
-rw-r----- 1 schwehr eng 1032 Feb 29 2012 SOURCES.txt
-rw-r----- 1 schwehr eng 1 Feb 29 2012 dependency_links.txt
-rw-r----- 1 schwehr eng 175 Feb 29 2012 entry_points.txt
-rw-r----- 1 schwehr eng 23 Feb 29 2012 namespace_packages.txt
-rw-r----- 1 schwehr eng 53 Feb 29 2012 requires.txt
-rw-r----- 1 schwehr eng 7 Feb 29 2012 top_level.txt
Missing r-x and r-- for dir and files. So python's install process can write
into a tree as one user (e.g. root) and block other setup.py's from working.
What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?
bigquery-2.0.12/table_formatter.py
sudo -u fink-bld [ENV] sh -c /tmp/fink.4ugD2
perl -pi -e "s/'google-api-python-client==.*',//" setup.py
perl -pi -e "s/'oauth2client==.*',//" setup.py
/sw/bin/python2.7 setup.py build
Traceback (most recent call last):
File "setup.py", line 22, in <module>
use_setuptools()
File "/sw/src/fink.build/bigquery-py27-2.0.12-1/bigquery-2.0.12/ez_setup.py", line 74, in use_setuptools
import pkg_resources
File "/sw/lib/python2.7/site-packages/pkg_resources.py", line 2825, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/sw/lib/python2.7/site-packages/pkg_resources.py", line 710, in subscribe
callback(dist)
File "/sw/lib/python2.7/site-packages/pkg_resources.py", line 2825, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/sw/lib/python2.7/site-packages/pkg_resources.py", line 2257, in activate
self.insert_on(path)
File "/sw/lib/python2.7/site-packages/pkg_resources.py", line 2364, in insert_on
self.check_version_conflict()
File "/sw/lib/python2.7/site-packages/pkg_resources.py", line 2401, in check_version_conflict
nsp = dict.fromkeys(self._get_metadata('namespace_packages.txt'))
File "/sw/lib/python2.7/site-packages/pkg_resources.py", line 2251, in _get_metadata
for line in self.get_metadata_lines(name):
File "/sw/lib/python2.7/site-packages/pkg_resources.py", line 1219, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/sw/lib/python2.7/site-packages/pkg_resources.py", line 1211, in get_metadata
return self._get(self._fn(self.egg_info,name))
File "/sw/lib/python2.7/site-packages/pkg_resources.py", line 1326, in _get
stream = open(path, 'rb')
IOError: [Errno 13] Permission denied:
'/sw/lib/python2.7/site-packages/google_apputils-0.3.0-py2.7.egg-info/namespace_
packages.txt'
### execution of /sw/bin/python2.7 failed, exit code 1
### execution of /tmp/fink.4ugD2 failed, exit code 1
What version of the product are you using? On what operating system?
fink mac osx 10.8
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 15 May 2013 at 9:37
What steps will reproduce the problem?
1. Install distribute and pip directly:
sudo bash -c "wget -O - http://python-distribute.org/distribute_setup.py |
python"
sudo bash -c "wget -O -
https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python"
2. 'pip install google-apputils'
3. Get a warning:
Running setup.py install for google-apputils
WARNING: google is a namespace package, but its __init__.py does
not declare_namespace(); setuptools 0.7 will REQUIRE this!
(See the setuptools manual under "Namespace Packages" for details.)
WARNING: google.apputils is a namespace package, but its __init__.py does
not declare_namespace(); setuptools 0.7 will REQUIRE this!
(See the setuptools manual under "Namespace Packages" for details.)
What is the expected output? What do you see instead?
No warnings.
What version of the product are you using? On what operating system?
Ubuntu 10.04
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 28 Mar 2012 at 12:44
Fails to build with python3. 2to3 works. Not sure if it's output is backwards compatible.
https://pypi.python.org/pypi/absl-py/ (https://github.com/abseil/abseil-py) replaces this library. We need to document the migration strategy.
Also consider if there is even more we could do such as having google-apputils depend on absl-py or even push a version implemented on top of it? Though it'd be a lot better to not provide such a crutch and just reach out to anything with a google-apputils
dep to have them update to absl-py
directly.
It would be nice to have the bits necessary to build Debian package included in
the tree, similar to how python-gflags does it.
I've attached a patch that will accomplish this. I may submit this package to
Debian proper at some point.
(the end result of this should be a debian directory inside your source tree)
Original issue reported on code.google.com by [email protected]
on 7 Sep 2010 at 11:17
Attachments:
Just became an Xoogler, but still loving this library and using it in my new
project. Currently, I'm including it as a submodule in Git, and in order to do
that I need this package to be available in a Git repo.
I've just forked it to https://github.com/grow/google-apputils-python on
GitHub, and I'll try to keep it up to date, however, it'd obviously be best if
it were maintained by Google. :)
Any chance we could see this on https://github.com/google, or at least as a Git
project on Project Hosting? Thanks, feel free to close this issue if not, and
I'll just maintain my fork.
Original issue reported on code.google.com by [email protected]
on 23 Sep 2013 at 11:39
https://pypi.python.org/pypi/google-apputils/0.4.0
Need to at least update project URL to reflect change to GitHub.
I don't think python-dateutil<2 restriction is necessary anymore, we use
version 2.2 with Python 2.x just fine.
Additionally the restriction prevents us from installing upstream version of
google-apputils-python.
Original issue reported on code.google.com by [email protected]
on 30 Sep 2014 at 1:26
Many (most?) environments today will already have setuptools present.
Please provide any additional information below.
See the attached patch.
Original issue reported on code.google.com by [email protected]
on 22 Oct 2014 at 5:52
Attachments:
Kind of off topic, but it seems mox
hasn't been transferred yet. Is that planned to happen at some point?
Running:
(venv) $ python setup.py google_test
I get a lot of messages like this:
Testing resources_test
/path/to/google-apputils/google/apputils/basetest.py:1617: RuntimeWarning: Trying to access flag test_tmpdir before flags were parsed. This will raise an exception in the future.
if not os.path.isdir(FLAGS.test_tmpdir):
ERROR:root:Trying to access flag test_tmpdir before flags were parsed.
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/gflags/flagvalues.py", line 535, in __getattr__
raise exceptions.UnparsedFlagAccessError(error_message)
UnparsedFlagAccessError: Trying to access flag test_tmpdir before flags were parsed
After cloning I installed google-apputils in a virtualenv with:
(venv) $ python setup.py install
then ran the google_test
command.
I only want to run the unit tests and see them pass or fail.
Adding description to setup.py
Original issue reported on code.google.com by [email protected]
on 21 Feb 2015 at 3:07
Attachments:
What steps will reproduce the problem?
1. do a proper install of the tool with find
2. ez_setup.py gets installed in /sw/bin/ ACK!
3.
What is the expected output? What do you see instead?
scripts in setup.py should not contain files from other modules
https://code.google.com/p/google-apputils-python/source/browse/trunk/setup.py#56
please delete this line:
scripts=["ez_setup.py"],
What version of the product are you using? On what operating system?
writing dependency_links to google_apputils.egg-info/dependency_links.txt
writing entry points to google_apputils.egg-info/entry_points.txt
reading manifest file 'google_apputils.egg-info/SOURCES.txt'
writing manifest file 'google_apputils.egg-info/SOURCES.txt'
Copying google_apputils.egg-info to
/sw/src/fink.build/root-google-apputils-py27-0.3.0-1/sw/lib/python2.7/site-packa
ges/google_apputils-0.3.0-py2.7.egg-info
Installing
/sw/src/fink.build/root-google-apputils-py27-0.3.0-1/sw/lib/python2.7/site-packa
ges/google_apputils-0.3.0-py2.7-nspkg.pth
running install_scripts
creating /sw/src/fink.build/root-google-apputils-py27-0.3.0-1/sw/bin
copying build/scripts-2.7/ez_setup.py ->
/sw/src/fink.build/root-google-apputils-py27-0.3.0-1/sw/bin
changing mode of
/sw/src/fink.build/root-google-apputils-py27-0.3.0-1/sw/bin/ez_setup.py to 755
sudo -u fink-bld [ENV] sh -c /tmp/fink.2KV27
/bin/rm -f /sw/src/fink.build/root-google-apputils-py27-0.3.0-1/sw/info/dir
/sw/src/fink.build/root-google-apputils-py27-0.3.0-1/sw/info/dir.old
/sw/src/fink.build/root-google-apputils-py27-0.3.0-1/sw/share/info/dir
/sw/src/fink.build/root-google-apputils-py27-0.3.0-1/sw/share/info/dir.old
Reverting ownership of install dir to root
- Depends line is: python27, gflags-py27, darwin (>= 12-1)
Writing control file...
Writing md5sums file...
Validating .deb dir /sw/src/fink.build/root-google-apputils-py27-0.3.0-1...
Error: File in a language-versioned package is neither versioned nor in a
versioned directory.
Offending file: /sw/bin/ez_setup.py
Original issue reported on code.google.com by [email protected]
on 15 May 2013 at 9:32
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.