Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM] Example full Python3 branch #9614

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
220 commits
Select commit Hold shift + click to select a range
0e8ff2d
Generalize shebangs
EricCousineau-TRI Apr 15, 2018
1d7a8ad
Permit different Python versions
EricCousineau-TRI Apr 15, 2018
16d6d3e
Add notes on Python version
EricCousineau-TRI Apr 15, 2018
c3a1684
Teach pydrake about Python versions
EricCousineau-TRI Apr 15, 2018
77e7932
Strip down build components
EricCousineau-TRI Apr 15, 2018
0c86836
python3, unittest: Remove deprecated test cast methods (`assert*Equal…
EricCousineau-TRI Apr 15, 2018
a98b672
Update containers and sybmolic stuff to Python3.
EricCousineau-TRI Apr 15, 2018
3d5780f
unittest py: Ensure we flush stdout before switching to stderr
EricCousineau-TRI Apr 15, 2018
5c28f31
Seems that something is resetting warnings somewhere... ???
EricCousineau-TRI Apr 15, 2018
5387f81
Update
EricCousineau-TRI Apr 15, 2018
783be6b
unittest py: Allow tracing of import
EricCousineau-TRI Apr 15, 2018
5ebbc35
Restore build components
EricCousineau-TRI Apr 15, 2018
1fdf41b
Fix comment
EricCousineau-TRI Apr 15, 2018
e9499eb
Fixes for template stuff
EricCousineau-TRI Apr 15, 2018
b306836
Running into more issues with warning module
EricCousineau-TRI Apr 15, 2018
86a565f
Merge remote-tracking branch 'upstream/master' into feature/py3-wip
EricCousineau-TRI Oct 5, 2018
0e6d6a2
Fix some things
EricCousineau-TRI Oct 6, 2018
1ad9345
So many issues...
EricCousineau-TRI Oct 6, 2018
0d51048
Start tracking failures
EricCousineau-TRI Oct 6, 2018
daa89c6
Record setup
EricCousineau-TRI Oct 6, 2018
5870550
Fix cpp_const for py3
EricCousineau-TRI Oct 6, 2018
1112e82
record fixing
EricCousineau-TRI Oct 6, 2018
030c63b
Fix bad usage of `map`
EricCousineau-TRI Oct 6, 2018
7dbfb8a
Yuck... Can't import a module during construction???
EricCousineau-TRI Oct 6, 2018
25b4260
Fix map usage
EricCousineau-TRI Oct 6, 2018
214468c
More fixes
EricCousineau-TRI Oct 6, 2018
cf2c0c0
Fix deprecation bits
EricCousineau-TRI Oct 6, 2018
1e37913
Fix mishap with linter
EricCousineau-TRI Oct 6, 2018
824e085
Use simpler re-import guard
EricCousineau-TRI Oct 6, 2018
47bbe5c
Prefer utf8
EricCousineau-TRI Oct 7, 2018
63f842b
Fix more tidbits
EricCousineau-TRI Oct 7, 2018
0ee3b14
More tidbits
EricCousineau-TRI Oct 7, 2018
26855b2
Fix up drakelint
EricCousineau-TRI Oct 7, 2018
52e4229
Fix (I think?) pycodestyle stuff
EricCousineau-TRI Oct 7, 2018
492784e
Ensure six is available
EricCousineau-TRI Oct 7, 2018
ad25467
Getting weird errors about 'Could not initialize class sun.security.s…
EricCousineau-TRI Oct 7, 2018
59c8a3f
Latent fix
EricCousineau-TRI Oct 7, 2018
0b59f1a
Additional compat stuff
EricCousineau-TRI Oct 7, 2018
807c2bf
Fix lint error
EricCousineau-TRI Oct 7, 2018
2ec5e88
Fix up repo stuff
EricCousineau-TRI Oct 7, 2018
ed14563
More fixes + errors
EricCousineau-TRI Oct 7, 2018
71fdf77
Fix execfile
EricCousineau-TRI Oct 7, 2018
925557b
Fixing more items
EricCousineau-TRI Oct 7, 2018
fa4a7d1
Fix a few more things
EricCousineau-TRI Oct 7, 2018
baaf029
Fix call python
EricCousineau-TRI Oct 7, 2018
287b380
Fixup
EricCousineau-TRI Oct 7, 2018
f4b0166
Fix stuff
EricCousineau-TRI Oct 7, 2018
6b77f82
Seems like most are fixed?
EricCousineau-TRI Oct 7, 2018
dcc2852
All tests pass in Python3. Need to check Python2...
EricCousineau-TRI Oct 7, 2018
28b2210
Test
EricCousineau-TRI Oct 8, 2018
dfa4f73
Getting lint errors now...
EricCousineau-TRI Oct 8, 2018
1a8548f
try
EricCousineau-TRI Oct 8, 2018
96ce141
Yuck...
EricCousineau-TRI Oct 8, 2018
2ab174f
Correction
EricCousineau-TRI Oct 8, 2018
ac41214
tmp
EricCousineau-TRI Oct 8, 2018
d4625dd
Fix lint
EricCousineau-TRI Oct 8, 2018
fb615d1
Update
EricCousineau-TRI Oct 8, 2018
4469903
Fixup
EricCousineau-TRI Oct 8, 2018
c87fa36
Simplify
EricCousineau-TRI Oct 8, 2018
962d5fa
Make things consistent
EricCousineau-TRI Oct 8, 2018
23ceb25
Merge remote-tracking branch 'upstream/master' into feature/py3-wip
EricCousineau-TRI Oct 8, 2018
fc3a8a4
More fixup
EricCousineau-TRI Oct 8, 2018
fbdeef7
Update
EricCousineau-TRI Oct 8, 2018
729231d
Fixup doxygen gen
EricCousineau-TRI Oct 8, 2018
a9f26fc
Fix build_components_refresh
EricCousineau-TRI Oct 8, 2018
1d8ddb8
Fixup pycps
EricCousineau-TRI Oct 8, 2018
fe02433
pydrake: Enable testing to pass under Python3
EricCousineau-TRI Oct 11, 2018
15d8b01
Squash merge of #9613 at e41cffa
EricCousineau-TRI Oct 11, 2018
5c5307f
Fixes
EricCousineau-TRI Oct 11, 2018
252488a
Fix qualname
EricCousineau-TRI Oct 11, 2018
feef3c1
Test newer sphinx stuff
EricCousineau-TRI Oct 11, 2018
9847c9c
Tmp
EricCousineau-TRI Oct 11, 2018
aa54ea8
Fixup
EricCousineau-TRI Oct 11, 2018
a8ad83f
Update things...
EricCousineau-TRI Oct 11, 2018
b44b519
Restore path
EricCousineau-TRI Oct 11, 2018
4f51b9a
Minor cleanup
EricCousineau-TRI Oct 11, 2018
f51239d
Simplify more
EricCousineau-TRI Oct 11, 2018
0ccda35
Robustify
EricCousineau-TRI Oct 11, 2018
1a3ff60
Minimize info
EricCousineau-TRI Oct 11, 2018
01cd772
Fix fmt
EricCousineau-TRI Oct 11, 2018
8b471b2
Spiffify
EricCousineau-TRI Oct 11, 2018
b9ec52e
More spiffs
EricCousineau-TRI Oct 11, 2018
1452b73
python: Generalize repository to support multiple versions
EricCousineau-TRI Oct 11, 2018
4bb4366
Merge branch 'master' of https://github.com/RobotLocomotion/drake int…
EricCousineau-TRI Oct 11, 2018
9083b70
Merge branch 'feature/py_general_support' into feature/py3-wip
EricCousineau-TRI Oct 11, 2018
e1d8762
updates
EricCousineau-TRI Oct 12, 2018
0d9d26e
Syntax error
EricCousineau-TRI Oct 12, 2018
72a9fb8
Fix lint
EricCousineau-TRI Oct 12, 2018
946fd27
Fixup
EricCousineau-TRI Oct 12, 2018
34dc0cb
Fixup
EricCousineau-TRI Oct 12, 2018
dee531f
python: Generalize repository to support multiple versions
EricCousineau-TRI Oct 12, 2018
39346f4
Merge branch 'feature/py_general_support' into feature/py3-wip
EricCousineau-TRI Oct 12, 2018
4a5e384
Attempt to fix things up...
EricCousineau-TRI Oct 13, 2018
843ca32
Update
EricCousineau-TRI Oct 13, 2018
01944c8
Temp squash merge of #9649 at a77e11c
EricCousineau-TRI Oct 16, 2018
47fc9d6
Revert shebangs to python2
EricCousineau-TRI Oct 16, 2018
d7379bd
Merge remote-tracking branch 'upstream/master' into feature/py3-wip
EricCousineau-TRI Oct 16, 2018
1823fac
Fix
EricCousineau-TRI Oct 16, 2018
71ecb32
Update
EricCousineau-TRI Oct 16, 2018
003afbf
Merge branch 'feature/py3-wip' of github.com:EricCousineau-TRI/drake …
EricCousineau-TRI Oct 16, 2018
3efa6a7
Strip executable bits from version-dependent stuff
EricCousineau-TRI Oct 16, 2018
b68d410
More executable stripping
EricCousineau-TRI Oct 16, 2018
bcc8938
Merge branch 'master' of https://github.com/RobotLocomotion/drake int…
EricCousineau-TRI Oct 17, 2018
77a8c03
Update setup
EricCousineau-TRI Oct 17, 2018
59cc8e2
Fixup to reflect newer state of things
EricCousineau-TRI Oct 17, 2018
517bcd2
Scriptify
EricCousineau-TRI Oct 17, 2018
a84d29a
Get rid of extra executable bits
EricCousineau-TRI Oct 17, 2018
38d3e5b
Specify version for bazel wrapper
EricCousineau-TRI Oct 17, 2018
fcc5428
Remove spurious shebangs
EricCousineau-TRI Oct 17, 2018
253627e
Simplify
EricCousineau-TRI Oct 17, 2018
4af4192
Fix remaining tests
EricCousineau-TRI Oct 17, 2018
7cb3935
Remove exec bit
EricCousineau-TRI Oct 17, 2018
15b4405
Tinker with multiplexing Py2
EricCousineau-TRI Oct 17, 2018
bfc6bce
Try to figure out how to remove prefix???
EricCousineau-TRI Oct 17, 2018
978d4c0
Can install
EricCousineau-TRI Oct 17, 2018
6ab7533
Try to simplify stuff
EricCousineau-TRI Oct 17, 2018
307ec1e
Yuck... Hack with things
EricCousineau-TRI Oct 17, 2018
60a75af
Fix up for linting
EricCousineau-TRI Oct 17, 2018
dad3b53
Reflow
EricCousineau-TRI Oct 17, 2018
79be4af
Make things more explicit
EricCousineau-TRI Oct 17, 2018
8470c8e
Update
EricCousineau-TRI Oct 17, 2018
8d1bf57
Update
EricCousineau-TRI Oct 17, 2018
0dff93f
Clean up (minor)
EricCousineau-TRI Oct 17, 2018
11a57d3
Finish up; still sketchy to offer both versions?
EricCousineau-TRI Oct 17, 2018
e4157c6
More fixup
EricCousineau-TRI Oct 17, 2018
3cd51ee
Try to simplify some more
EricCousineau-TRI Oct 17, 2018
c1f1fed
Add explicit LCM unittest
EricCousineau-TRI Oct 17, 2018
c8f8f39
Merge branch 'master' of https://github.com/RobotLocomotion/drake int…
EricCousineau-TRI Oct 17, 2018
d318803
Merge branch 'master' of https://github.com/RobotLocomotion/drake int…
EricCousineau-TRI Oct 17, 2018
10cfd29
Update
EricCousineau-TRI Oct 17, 2018
1946605
Fix lint
EricCousineau-TRI Oct 17, 2018
4bcebed
Disable for now
EricCousineau-TRI Oct 17, 2018
2f514c8
Cleanup
EricCousineau-TRI Oct 17, 2018
aa35709
Fixup
EricCousineau-TRI Oct 17, 2018
5710965
python3: Support Python2 for lcm when being used by drake_visualizer
EricCousineau-TRI Oct 22, 2018
ed21778
Source from different places
EricCousineau-TRI Oct 22, 2018
749e53c
Merge branch 'master' of https://github.com/RobotLocomotion/drake int…
EricCousineau-TRI Oct 27, 2018
40bc6c7
Partial revert
EricCousineau-TRI Oct 27, 2018
10f349b
Merge branch 'feature/py2_and_py3_lcm' into feature/py3-wip
EricCousineau-TRI Oct 27, 2018
c4f7198
Merge remote-tracking branch 'upstream/master' into feature/py3-wip
EricCousineau-TRI Nov 11, 2018
186a160
Merge branch 'master' of https://github.com/RobotLocomotion/drake int…
EricCousineau-TRI Nov 13, 2018
16f3431
Merge branch 'master' of https://github.com/RobotLocomotion/drake int…
EricCousineau-TRI Nov 21, 2018
ffd8cce
Update for things
EricCousineau-TRI Nov 21, 2018
9637aaf
Add nominal setup stuff
EricCousineau-TRI Nov 21, 2018
62e3b37
Merge branch 'master' of https://github.com/RobotLocomotion/drake int…
EricCousineau-TRI Dec 10, 2018
7701569
Try using workspace bits. Causes complete recompile???
EricCousineau-TRI Dec 10, 2018
4b20578
Further update
EricCousineau-TRI Dec 10, 2018
0baa821
Merge branch 'feature/py3-wip' of github.com:EricCousineau-TRI/drake …
EricCousineau-TRI Dec 10, 2018
12e9a4c
Update readme
EricCousineau-TRI Dec 10, 2018
0bb2208
Partial revert
EricCousineau-TRI Dec 10, 2018
104c4bc
Enable installing duplicates of Python2 lcmtypes
EricCousineau-TRI Dec 10, 2018
732ec6e
Fix styling
EricCousineau-TRI Dec 10, 2018
6287190
Simplify compatibility
EricCousineau-TRI Dec 10, 2018
915ccd6
Get rid of non-functional changes
EricCousineau-TRI Dec 10, 2018
04a92c1
Make "hermetic"
EricCousineau-TRI Dec 10, 2018
3064189
Disable hermetic stuff
EricCousineau-TRI Dec 11, 2018
5c37f9d
python: Print out debug
EricCousineau-TRI Dec 11, 2018
113a95a
Merge branch 'master' of https://github.com/RobotLocomotion/drake int…
EricCousineau-TRI Dec 13, 2018
3f341e5
More Python3 changes
EricCousineau-TRI Dec 13, 2018
001fbf5
Minor sync
EricCousineau-TRI Dec 13, 2018
705bd03
Merge branch 'master' of https://github.com/RobotLocomotion/drake int…
EricCousineau-TRI Dec 13, 2018
cb698ca
Generalize meshcat server install
EricCousineau-TRI Dec 13, 2018
d18de54
Merge branch 'master' of https://github.com/RobotLocomotion/drake int…
EricCousineau-TRI Dec 17, 2018
08c4de1
Configure Python
EricCousineau-TRI Dec 17, 2018
d899be2
Try out package
EricCousineau-TRI Dec 17, 2018
3ee314e
Configure things
EricCousineau-TRI Dec 17, 2018
58a116a
Switch it up
EricCousineau-TRI Dec 17, 2018
cef7a44
Updates
EricCousineau-TRI Dec 17, 2018
d063a73
tmp
EricCousineau-TRI Dec 17, 2018
a117199
Move relevant bits to `tmp/`
EricCousineau-TRI Dec 17, 2018
1a5202f
Cleanup
EricCousineau-TRI Dec 17, 2018
d404941
Simplify
EricCousineau-TRI Dec 17, 2018
814133e
Remove old coldness
EricCousineau-TRI Dec 17, 2018
096f5bc
Update
EricCousineau-TRI Dec 17, 2018
5a67131
split reqs out even more
EricCousineau-TRI Dec 17, 2018
7865cdf
Add more info
EricCousineau-TRI Dec 17, 2018
17306ea
Update
EricCousineau-TRI Dec 17, 2018
e755ceb
Fixies
EricCousineau-TRI Dec 17, 2018
9e9a330
Fixies
EricCousineau-TRI Dec 17, 2018
23b15c2
This seems wrong...
EricCousineau-TRI Dec 17, 2018
9a4c10e
Robustify
EricCousineau-TRI Dec 17, 2018
f3da752
Update s'more
EricCousineau-TRI Dec 17, 2018
08a0f9a
Sync
EricCousineau-TRI Dec 17, 2018
424c074
Upper dates
EricCousineau-TRI Dec 17, 2018
9ca3fac
Partial revert
EricCousineau-TRI Dec 17, 2018
a2126e4
Refine
EricCousineau-TRI Dec 17, 2018
d5a8c42
Update
EricCousineau-TRI Dec 17, 2018
66042ce
Update
EricCousineau-TRI Dec 18, 2018
94ab324
Fixify
EricCousineau-TRI Dec 18, 2018
8d0296c
Remove vestigial `meshcat-server` binary (now autogenerated)
EricCousineau-TRI Dec 17, 2018
402962f
python: Document Python3 support for Bionic
EricCousineau-TRI Dec 18, 2018
9bb4b1a
Merge branch 'feature/py3_bionic' into feature/py3-wip
EricCousineau-TRI Dec 18, 2018
f0a98dc
Prototyping
EricCousineau-TRI Dec 18, 2018
e958a35
Fixies
EricCousineau-TRI Dec 18, 2018
5a0df42
Fixes
EricCousineau-TRI Dec 18, 2018
048b348
Fixup
EricCousineau-TRI Dec 18, 2018
4ab8dab
Fixies
EricCousineau-TRI Dec 18, 2018
1eacffa
python: Document Python3 support for Bionic
EricCousineau-TRI Dec 18, 2018
9107556
Update
EricCousineau-TRI Dec 18, 2018
196a647
fix
EricCousineau-TRI Dec 18, 2018
7c67cab
Fixies
EricCousineau-TRI Dec 18, 2018
b9bee30
fix prefix
EricCousineau-TRI Dec 18, 2018
77cf5a2
More fix
EricCousineau-TRI Dec 18, 2018
6cbdbca
Moar format
EricCousineau-TRI Dec 18, 2018
ca25516
Fix
EricCousineau-TRI Dec 18, 2018
4a1a8d7
More fix
EricCousineau-TRI Dec 18, 2018
53f58c3
Merge branch 'feature/py3_bionic' into feature/py3-wip
EricCousineau-TRI Dec 18, 2018
d8430f7
python: Document Python3 support for Bionic
EricCousineau-TRI Dec 18, 2018
1d27cf3
Merge branch 'feature/py3_bionic' into feature/py3-wip
EricCousineau-TRI Dec 19, 2018
c3d2990
Fixies
EricCousineau-TRI Dec 19, 2018
6c23f22
More fxi
EricCousineau-TRI Dec 19, 2018
4de24dc
Yupper
EricCousineau-TRI Dec 19, 2018
3af97c5
fix
EricCousineau-TRI Dec 19, 2018
25305e7
Merge remote-tracking branch 'upstream/master' into feature/py3-wip
EricCousineau-TRI Jan 2, 2019
0e34efa
Minor refactor
EricCousineau-TRI Jan 2, 2019
03dad11
Fixup
EricCousineau-TRI Jan 2, 2019
bb21f46
FIxup
EricCousineau-TRI Jan 2, 2019
4b3d894
Merge remote-tracking branch 'upstream/master' into feature/py3-wip
EricCousineau-TRI Jan 2, 2019
a535c14
Simplify
EricCousineau-TRI Jan 2, 2019
3c6c03c
Fix more
EricCousineau-TRI Jan 3, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 64 additions & 49 deletions bindings/pydrake/common/test/deprecation_test.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
from __future__ import print_function

from pydrake.common.deprecation import DrakeDeprecationWarning

import pydoc
import unittest
import rlcompleter
import six
import sys
from types import ModuleType
import unittest
import warnings

import pydrake
from pydrake.common.deprecation import DrakeDeprecationWarning


def get_completion_suffixes(namespace, prefix, max_count=1000):
# Gets all completions for a given namespace and prefix, stripping the
# prefix from the results.
completer = rlcompleter.Completer(namespace)
suffixes = []
for i in range(max_count):
candidate = completer.complete(prefix, i)
if candidate is None:
break
assert candidate.startswith(prefix), (prefix, candidate)
suffixes.append(candidate[len(prefix):])
else:
raise RuntimeError("Exceeded max count!")
return suffixes


class TestDeprecation(unittest.TestCase):
Expand Down Expand Up @@ -72,51 +85,56 @@ def test_module_autocomplete(self):
# Without `__dir__` being implemented, it'll only return `install` as a
# non-private autocomplete candidate.
import deprecation_example
namespace = locals()
completer = rlcompleter.Completer(namespace)
candidates = []
for i in range(1000):
candidate = completer.complete("deprecation_example.", i)
if candidate is None:
break
candidates.append(candidate)
candidates_expected = [
suffixes = get_completion_suffixes(
locals(), prefix="deprecation_example.")
suffixes_expected = [
# Injection from `Completer.attr_matches`, via `get_class_members`.
"deprecation_example.__class__(",
"deprecation_example.__delattr__(",
"deprecation_example.__dict__",
"deprecation_example.__dir__(",
"deprecation_example.__doc__",
"deprecation_example.__format__(",
"deprecation_example.__getattr__(",
"deprecation_example.__getattribute__(",
"deprecation_example.__hash__(",
"deprecation_example.__init__(",
"deprecation_example.__module__",
"deprecation_example.__new__(",
"deprecation_example.__reduce__(",
"deprecation_example.__reduce_ex__(",
"deprecation_example.__repr__(",
"deprecation_example.__setattr__(",
"deprecation_example.__sizeof__(",
"deprecation_example.__str__(",
"deprecation_example.__subclasshook__(",
"deprecation_example.__weakref__",
"deprecation_example._install(",
"__class__(",
"__delattr__(",
"__dict__",
"__dir__(",
"__doc__",
"__format__(",
"__getattr__(",
"__getattribute__(",
"__hash__(",
"__init__(",
"__module__",
"__new__(",
"__reduce__(",
"__reduce_ex__(",
"__repr__(",
"__setattr__(",
"__sizeof__(",
"__str__(",
"__subclasshook__(",
"__weakref__",
"_install(",
# Intended completions via `__all__`.
"deprecation_example.sub_module",
"deprecation_example.value",
"sub_module",
"value",
]
if six.PY3:
candidates_expected += [
'deprecation_example.__ge__(',
'deprecation_example.__eq__(',
'deprecation_example.__le__(',
'deprecation_example.__lt__(',
'deprecation_example.__gt__(',
'deprecation_example.__ne__(',
suffixes_expected += [
"__ge__(",
"__eq__(",
"__le__(",
"__lt__(",
"__gt__(",
"__ne__(",
]
self.assertSetEqual(set(candidates), set(candidates_expected))
if hasattr(deprecation_example, "__init_subclass__"):
suffixes_expected.append("__init_subclass__(")
# For Bionic Python3, the behavior of autocompletion seems to
# constrain behavior depending on underscore prefixes.
if "__init__(" not in suffixes:
under = get_completion_suffixes(
locals(), prefix="deprecation_example._")
suffixes += ["_" + s for s in under]
dunder = get_completion_suffixes(
locals(), prefix="deprecation_example.__")
suffixes += ["__" + s for s in dunder]
self.assertSetEqual(set(suffixes), set(suffixes_expected))

def _check_warning(
self, item, message_expected, type=DrakeDeprecationWarning):
Expand Down Expand Up @@ -199,11 +217,8 @@ def base_deprecation():
method_extra = ExampleClass.deprecated_method
prop = ExampleClass.deprecated_prop
prop_extra = ExampleClass.deprecated_prop
# N.B. `help(<module>)` is super verbose.
print("Help text:\n{}".format(
pydoc.getdoc(pydrake.common.deprecation)))
# Manually set this back to `once`.
warnings.simplefilter("ignored", DeprecationWarning)
warnings.simplefilter("ignore", DeprecationWarning)
warnings.simplefilter("once", DrakeDeprecationWarning)

def test_deprecation_pybind(self):
Expand Down
1 change: 1 addition & 0 deletions tmp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
virtualenv*/
31 changes: 31 additions & 0 deletions tmp/py3.README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
This is an experimental branch that uses Python3. This is not yet
a supported configuration on Drake's `master`.

As such, if you have any questions, please ask me (Eric), as other people on
slack aren't using this code.

## Setup

Follow setup instructions, make sure you run `install_prereqs`.

https://drake.mit.edu/from_source.html

### Bionic

Follow installation instructions normally.

### Xenial `virtualenv`

In any terminal that you're using:

cd drake
source tmp/py3.virtualenv.sh

Update `gen/environment.bzl` to use this Python binary:

build --python_path=<PYTHON>
build --action_env=DRAKE_PYTHON_BIN_PATH=<PYTHON>

## Python3

When building, running, or testing, pass `--config=python3`.
18 changes: 18 additions & 0 deletions tmp/py3.failing_tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
source py3_setup.sh

bazel-py3 test //bindings/pydrake/...
--trace=user -f

Python2

Python3


In Bionic Docker:

+ all_install_test.py
from drake import lcmt_viewer_load_robot
ImportError: cannot import name 'lcmt_viewer_load_robot'

Seems like just a sandboxing issue, as this is unreproducible from using
sandbox install.
9 changes: 9 additions & 0 deletions tmp/py3.requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pyyaml
protobuf==3.6.0
sphinx==1.8.1
sphinx_rtd_theme
numpy==1.14.0
zmq
tornado
matplotlib
pydot
24 changes: 24 additions & 0 deletions tmp/py3.virtualenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

_env_dir=$(cd $(dirname ${BASH_SOURCE}) && pwd)/virtualenv
if [[ ! -f ${_env_dir}/bin/python3 ]]; then
(
set -eux
cd $(dirname ${_env_dir})
python3_bin=$(which python3)
${python3_bin} -m virtualenv --python ${python3_bin} ${_env_dir}
set +eux
source ${_env_dir}/bin/activate
# Install some (if not all) needed dependencies.
pip install -r ${_env_dir}/../py3.requirements.txt
set -eux
# Reflect system Python; make `python` and `python-config` fall through to
# system, and use `python{major}-config`.
rm ${_env_dir}/bin/python
mv ${_env_dir}/bin/{python-config,python3-config}
sed -i 's#/bin/python\b#/bin/python3#g' ${_env_dir}/bin/python3-config
)
fi

source ${_env_dir}/bin/activate
unset _env_dir
7 changes: 7 additions & 0 deletions tmp/scratch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -eux -o pipefail

# See:
user=$(logname)
logname
sudo -u ${user} touch tmp_file