diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..d3bd36e --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +layout pipenv \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 8e2530d..7d32218 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: xenial language: python branches: @@ -5,14 +6,14 @@ branches: - gh-pages python: - - 2.7 - - 3.4 - - 3.5 - - 3.6 + - '2.7' + - '3.4' + - '3.5' + - '3.6' + - '3.7' #- pypy #- pypy3 -before_install: install: - pip install tox tox-travis diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..6b090f1 --- /dev/null +++ b/Pipfile @@ -0,0 +1,15 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] +gitchangelog = "*" +twine = "*" +pytest = "*" +pytest-xdist = "*" + +[packages] +pyros-genmsg = "*" +pyros-genpy = "*" +filefinder2 = "*" diff --git a/README.rst b/README.rst index 4d7b67f..672a6bd 100644 --- a/README.rst +++ b/README.rst @@ -62,7 +62,8 @@ Usage: with rosimport.RosImporter(): import my_msgs.msg # directly from a my_msgs/msg directory containing My.msg ros definition - # Or relatively : - from . import msg # modules are still available, but importer has been deactivated. +Relative imports are supported, as well as all the import semantics of python3 (even in python2, thanks for filefinder2) + +TODO : TermtoSVG / ASCIInema ! diff --git a/example/MyPyRosPkg/__init__.py b/example/MyPyRosPkg/__init__.py new file mode 100644 index 0000000..588465f --- /dev/null +++ b/example/MyPyRosPkg/__init__.py @@ -0,0 +1,12 @@ +import sys +import rosimport + +with rosimport.RosImporter(): + + from . import msg + +print("dir(msg) ->" + repr(dir(msg))) + +import inspect +print("inspect.getsource(msg.mymsg) ->") +print(inspect.getsource(msg.mymsg)) diff --git a/example/MyPyRosPkg/msg/mymsg.msg b/example/MyPyRosPkg/msg/mymsg.msg new file mode 100644 index 0000000..cb8d81e --- /dev/null +++ b/example/MyPyRosPkg/msg/mymsg.msg @@ -0,0 +1 @@ +string mystring diff --git a/example/README.rst b/example/README.rst new file mode 100644 index 0000000..7da9ded --- /dev/null +++ b/example/README.rst @@ -0,0 +1,28 @@ +HOW TO USE +========== + +Use a virtualenv. If you are not sure how, you can do some very useful reading at https://packaging.python.org/tutorials/managing-dependencies/ + +If you have direnv (and pipenv) on your machine, this is done as soon as you 'cd' into rosimport working tree. + + +1) Install rosimport in the virtualenv:: + + (rosimport--FuygrvY)alexv@AlexV-ROS-vbox:~/rosimport$ pipenv install -e . + Installing -e .… + Adding rosimport to Pipfile's [packages]… + ✔ Installation Succeeded + Pipfile.lock (474337) out of date, updating to (c8604e)… + Locking [dev-packages] dependencies… + ✔ Success! + Locking [packages] dependencies… + ✔ Success! + Updated Pipfile.lock (474337)! + Installing dependencies from Pipfile.lock (474337)… + 🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 5/5 — 00:00:02 + (rosimport--FuygrvY)alexv@AlexV-ROS-vbox:~/rosimport$ + +2) Import the package to trigger the import sequence + + + diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index f54ec84..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,14 +0,0 @@ -gitchangelog -twine - -# this is needed as install dependency since we embed tests in the package. -pytest>=2.5.1 -pytest-xdist # for --boxed (careful with the version it will be moved out of xdist) - - -# source access to latest filefinder from git ... -# -e git+https://github.com/asmodehn/filefinder2.git#egg=filefinder2 - -# ros dependencies (necessary when running tests from install) --e git+https://github.com/asmodehn/genmsg.git@setuptools#egg=ros_genmsg --e git+https://github.com/asmodehn/genpy.git@setuptools-kinetic#egg=ros_genpy diff --git a/tox.ini b/tox.ini index 9014991..8b3f567 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ # content of: tox.ini , put in same dir as setup.py [tox] -envlist = py27, py34, py35, py36 +envlist = py27, py34, py35, py36, py37 #, pypy #, pypy3 skip_missing_interpreters=true @@ -10,6 +10,7 @@ skip_missing_interpreters=true 3.4 = py34 3.5 = py35 3.6 = py36 +3.7 = py37 # not tested yet #pypy = pypy @@ -28,12 +29,12 @@ skipsdist=True [testenv] whitelist_externals = git -deps = - # only when we want to test latest unreleased filefinder2 | genpy | genmsg - -rrequirements-dev.txt # to always force recreation and avoid unexpected side effects recreate=True +deps= + pytest + pytest-xdist commands= git submodule sync -q