From b74643eb6dcf8b957e0b52adf1587528f9791487 Mon Sep 17 00:00:00 2001 From: Brent Yi Date: Wed, 6 Jan 2021 19:18:42 -0800 Subject: [PATCH] Support Python 3.6, 3.7; add publish action --- .github/workflows/build.yml | 2 +- .github/workflows/publish.yml | 31 +++++++++++++++++++++++++++++++ README.md | 8 ++++++++ jaxlie/_base.py | 2 +- jaxlie/_so3.py | 8 ++++---- setup.py | 7 +++++-- 6 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c613548..047bfdf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9"] + python-version: ["3.6", "3.7", "3.8", "3.9"] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d5f3859 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,31 @@ +# This workflows will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/README.md b/README.md index b4b19bb..f1e739f 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![codecov](https://codecov.io/gh/brentyi/jaxlie/branch/master/graph/badge.svg)](https://codecov.io/gh/brentyi/jaxlie) **[ [API reference](https://brentyi.github.io/jaxlie) ]** +**[ [PyPI](https://pypi.org/project/jaxlie/) ]** `jaxlie` is a Lie theory library for rigid body transformations and optimization in JAX. @@ -22,6 +23,13 @@ Current functionality: --- +##### Install (Python >=3.7) +```bash +pip install jaxlie +``` + +--- + ##### Example usage ```python diff --git a/jaxlie/_base.py b/jaxlie/_base.py index 62a39e9..8477ecd 100644 --- a/jaxlie/_base.py +++ b/jaxlie/_base.py @@ -26,7 +26,7 @@ class MatrixLieGroup(abc.ABC): space_dim: int = 0 """Dimension of coordinates that can be transformed.""" - def __init__(self, parameters: jnp.ndarray, /): + def __init__(self, parameters: jnp.ndarray): """Construct a group object from its underlying parameters.""" # Note that this method is implicitly overriden by the dataclass decorator and diff --git a/jaxlie/_so3.py b/jaxlie/_so3.py index c66b413..6596793 100644 --- a/jaxlie/_so3.py +++ b/jaxlie/_so3.py @@ -29,7 +29,7 @@ def __repr__(self): return f"{self.__class__.__name__}(wxyz={wxyz})" @staticmethod - def from_x_radians(theta) -> "SO3": + def from_x_radians(theta: float) -> "SO3": """Generates a x-axis rotation. Args: @@ -41,7 +41,7 @@ def from_x_radians(theta) -> "SO3": return SO3.exp(jnp.array([theta, 0.0, 0.0])) @staticmethod - def from_y_radians(theta) -> "SO3": + def from_y_radians(theta: float) -> "SO3": """Generates a y-axis rotation. Args: @@ -53,7 +53,7 @@ def from_y_radians(theta) -> "SO3": return SO3.exp(jnp.array([0.0, theta, 0.0])) @staticmethod - def from_z_radians(theta) -> "SO3": + def from_z_radians(theta: float) -> "SO3": """Generates a z-axis rotation. Args: @@ -65,7 +65,7 @@ def from_z_radians(theta) -> "SO3": return SO3.exp(jnp.array([0.0, 0.0, theta])) @staticmethod - def from_rpy_radians(roll, pitch, yaw) -> "SO3": + def from_rpy_radians(roll: float, pitch: float, yaw: float) -> "SO3": """Generates a transform from a set of Euler angles. Uses the ZYX mobile robot convention. diff --git a/setup.py b/setup.py index dc87570..e5f9da0 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="jaxlie", - version="0.0.0", + version="0.0.1", description="Matrix Lie groups in Jax", long_description=long_description, long_description_content_type="text/markdown", @@ -15,16 +15,19 @@ license="MIT", packages=find_packages(exclude=["examples", "tests"]), package_data={"liejax": ["py.typed"]}, - python_requires=">=3.7", + python_requires=">=3.6", install_requires=[ "jax", "jaxlib", "numpy", "overrides", + "dataclasses; python_version < '3.7.0'", ], classifiers=[ + "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ],