Skip to content

Commit

Permalink
Dropping Python 2 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
visatish committed Mar 25, 2020
1 parent 1b5756a commit 9e37523
Show file tree
Hide file tree
Showing 52 changed files with 31 additions and 272 deletions.
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
language: python

matrix:
include:
- name: "Python 2.7 on Xenial Linux"
python: 2.7
dist: xenial

- name: "Python 3.5 on Xenial Linux"
python: 3.5
dist: xenial
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## **Python 2.x support has officially been dropped.**

# Berkeley AUTOLAB's GQCNN Package
<p>
<a href="https://travis-ci.org/BerkeleyAutomation/gqcnn/">
Expand All @@ -10,10 +12,7 @@
<img alt="Software License" src="https://img.shields.io/badge/license-REGENTS-brightgreen.svg">
</a>
<a>
<img alt="Python 2 Version" src="https://img.shields.io/badge/python-2.7-yellow.svg">
</a>
<a>
<img alt="Python 2 Version" src="https://img.shields.io/badge/python-3.5%20%7C%203.6%20%7C%203.7-yellowgreen.svg">
<img alt="Python 3 Versions" src="https://img.shields.io/badge/python-3.5%20%7C%203.6%20%7C%203.7-yellow.svg">
</a>
</p>

Expand Down
10 changes: 1 addition & 9 deletions docker/cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ ARG work_dir=/root/Workspace
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
python-dev \
python3-dev \
python-tk \
python3-tk \
python-opengl \
curl \
Expand All @@ -33,9 +31,6 @@ RUN curl -L http://download.osgeo.org/libspatialindex/spatialindex-src-1.8.5.tar
cd ..

# Install pip (`apt-get install python-pip` causes trouble w/ networkx).
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
rm get-pip.py
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
python3 get-pip.py && \
rm get-pip.py
Expand All @@ -50,14 +45,11 @@ WORKDIR ${work_dir}
ADD docker/gqcnn.tar .

# This is because `python setup.py develop` skips `install_requires` (I think).
RUN python -m pip install -r gqcnn/requirements/p2/cpu_requirements.txt
RUN python3 -m pip install -r gqcnn/requirements/p3/cpu_requirements.txt
RUN python3 -m pip install -r gqcnn/requirements/cpu_requirements.txt

# Install the library in editable mode because it's more versatile (in case we want to develop or if users want to modify things)
# Keep the egg outside of the library in site-packages in case we want to mount the library (overwriting it) for development with docker
ENV PYTHONPATH ${work_dir}/gqcnn
WORKDIR /usr/local/lib/python2.7/site-packages/
RUN python ${work_dir}/gqcnn/setup.py develop --docker
WORKDIR /usr/local/lib/python3.5/site-packages/
RUN python3 ${work_dir}/gqcnn/setup.py develop --docker

Expand Down
12 changes: 2 additions & 10 deletions docker/gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ ARG work_dir=/root/Workspace
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
python-dev \
python3-dev \
python-tk \
python3-tk \
python-opengl \
curl \
Expand All @@ -33,9 +31,6 @@ RUN curl -L http://download.osgeo.org/libspatialindex/spatialindex-src-1.8.5.tar
cd ..

# Install pip (`apt-get install python-pip` causes trouble w/ networkx).
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
rm get-pip.py
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
python3 get-pip.py && \
rm get-pip.py
Expand All @@ -50,16 +45,13 @@ WORKDIR ${work_dir}
ADD docker/gqcnn.tar .

# This is because `python setup.py develop` skips install_requires (I think) and also because we want to explicitly use the GPU requirements.
RUN python -m pip install -r gqcnn/requirements/p2/gpu_requirements.txt
RUN python3 -m pip install -r gqcnn/requirements/p3/gpu_requirements.txt
RUN python3 -m pip install -r gqcnn/requirements/gpu_requirements.txt

# Install the library in editable mode because it's more versatile (in case we want to develop or if users want to modify things)
# Keep the egg outside of the library in site-packages in case we want to mount the library (overwriting it) for development with docker
ENV PYTHONPATH ${work_dir}/gqcnn
WORKDIR /usr/local/lib/python2.7/site-packages/
RUN python ${work_dir}/gqcnn/setup.py develop --docker
WORKDIR /usr/local/lib/python3.5/site-packages/
RUN python3 ${work_dir}/gqcnn/setup.py develop --docker

# Move to the base library dir
# Move to the base library dir
WORKDIR ${work_dir}/gqcnn
2 changes: 1 addition & 1 deletion docs/source/install/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Prerequisites
Python
""""""

The `gqcnn` package has only been tested with `Python 2.7`, `Python 3.5`, `Python 3.6`, and `Python 3.7`.
The `gqcnn` package has only been tested with `Python 3.5`, `Python 3.6`, and `Python 3.7`.

Ubuntu
""""""
Expand Down
4 changes: 0 additions & 4 deletions examples/antipodal_grasp_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
------
Jeff Mahler
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import argparse
import os

Expand Down
4 changes: 0 additions & 4 deletions examples/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
------
Jeff Mahler & Vishal Satish
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import argparse
import json
import os
Expand Down
4 changes: 0 additions & 4 deletions examples/policy_ros.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
------
Jeff Mahler
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import argparse
import logging
import numpy as np
Expand Down
4 changes: 0 additions & 4 deletions examples/policy_with_image_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
------
Jeff Mahler
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import argparse
import os
import time
Expand Down
4 changes: 0 additions & 4 deletions gqcnn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from .model import get_gqcnn_model, get_fc_gqcnn_model
from .training import get_gqcnn_trainer
from .grasping import (RobustGraspingPolicy, UniformRandomGraspingPolicy,
Expand Down
4 changes: 0 additions & 4 deletions gqcnn/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from .analyzer import GQCNNAnalyzer

__all__ = ["GQCNNAnalyzer"]
4 changes: 0 additions & 4 deletions gqcnn/analysis/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
------
Jeff Mahler
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import json
import logging
import os
Expand Down
4 changes: 0 additions & 4 deletions gqcnn/grasping/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from .grasp import Grasp2D, SuctionPoint2D, MultiSuctionPoint2D
from .grasp_quality_function import (GraspQualityFunctionFactory,
GQCnnQualityFunction)
Expand Down
16 changes: 5 additions & 11 deletions gqcnn/grasping/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,16 @@
------
Jeff Mahler
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from abc import ABC, abstractmethod

from abc import ABCMeta, abstractmethod

from future.utils import with_metaclass
import numpy as np

from autolab_core import Point

from .grasp import Grasp2D, SuctionPoint2D, MultiSuctionPoint2D


class Action(with_metaclass(ABCMeta, object)):
"""Abstract action class.
class Action(object):
"""Base action class.
Attributes
----------
Expand Down Expand Up @@ -78,8 +72,8 @@ class NoAction(Action):
pass


class GraspAction3D(with_metaclass(ABCMeta, Action)):
"""Abstract grasp class with grasp specified as an end-effector pose.
class GraspAction3D(ABC, Action):
"""Base grasp class with grasp specified as an end-effector pose.
Attributes
----------
Expand Down
10 changes: 2 additions & 8 deletions gqcnn/grasping/constraint_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,11 @@
------
Jeff Mahler
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from abc import ABC, abstractmethod

from abc import ABCMeta, abstractmethod

from future.utils import with_metaclass
import numpy as np


class GraspConstraintFn(with_metaclass(ABCMeta, object)):
class GraspConstraintFn(ABC):
"""Abstract constraint functions for grasp sampling."""

def __init__(self, config):
Expand Down
4 changes: 0 additions & 4 deletions gqcnn/grasping/grasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
------
Jeff Mahler
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import numpy as np

from autolab_core import Point, RigidTransform
Expand Down
10 changes: 2 additions & 8 deletions gqcnn/grasping/grasp_quality_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,10 @@
-------
Jason Liu & Jeff Mahler
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from abc import ABCMeta, abstractmethod
from abc import ABC, abstractmethod
from time import time

import cv2
from future.utils import with_metaclass
import matplotlib.pyplot as plt
import numpy as np

Expand All @@ -49,8 +44,7 @@
from .grasp import SuctionPoint2D
from ..utils import GeneralConstants, GripperMode


class GraspQualityFunction(with_metaclass(ABCMeta, object)):
class GraspQualityFunction(ABC):
"""Abstract grasp quality class."""

def __init__(self):
Expand Down
9 changes: 2 additions & 7 deletions gqcnn/grasping/image_grasp_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,10 @@
------
Jeff Mahler & Sherdil Niyaz
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from abc import ABCMeta, abstractmethod
from abc import ABC, abstractmethod
import random
from time import time

from future.utils import with_metaclass
import matplotlib.pyplot as plt
import numpy as np
import scipy.ndimage.filters as snf
Expand Down Expand Up @@ -74,7 +69,7 @@ class DepthSamplingMode(object):
MAX = "max"


class ImageGraspSampler(with_metaclass(ABCMeta, object)):
class ImageGraspSampler(ABC):
"""Wraps image to crane grasp candidate generation for easy deployment of
GQ-CNN.
Expand Down
4 changes: 0 additions & 4 deletions gqcnn/grasping/policy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from .fc_policy import (FullyConvolutionalGraspingPolicyParallelJaw,
FullyConvolutionalGraspingPolicySuction)
from .policy import (RobustGraspingPolicy, CrossEntropyRobustGraspingPolicy,
Expand Down
5 changes: 0 additions & 5 deletions gqcnn/grasping/policy/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
------
Vishal Satish
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function


class SamplingMethod(object):
TOP_K = "top_k"
UNIFORM = "uniform"
11 changes: 2 additions & 9 deletions gqcnn/grasping/policy/fc_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,9 @@
------
Vishal Satish
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from abc import abstractmethod, ABCMeta
from abc import abstractmethod
import os

from future.utils import with_metaclass
import matplotlib.pyplot as plt
import numpy as np

Expand All @@ -49,9 +44,7 @@
from .enums import SamplingMethod
from .policy import GraspingPolicy, GraspAction


class FullyConvolutionalGraspingPolicy(with_metaclass(ABCMeta,
GraspingPolicy)):
class FullyConvolutionalGraspingPolicy(GraspingPolicy):
"""Abstract grasp sampling policy class using Fully-Convolutional GQ-CNN
network."""

Expand Down
Loading

0 comments on commit 9e37523

Please sign in to comment.