Skip to content

Commit dbc743e

Browse files
authored
Merge pull request #36 from afishman-openai/main
Typing and Splitting Files for Readability
2 parents 799f2d2 + 34206d3 commit dbc743e

File tree

19 files changed

+3565
-3126
lines changed

19 files changed

+3565
-3126
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ "**" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.9", "3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -r requirements.txt
29+
pip install .[dev]
30+
pip install mypy==1.18.2 ruff==0.14.1
31+
32+
- name: Ruff Lint
33+
run: |
34+
ruff check .
35+
ruff format --check .
36+
37+
- name: Mypy
38+
run: |
39+
mypy urchin
40+
41+
- name: Pytest
42+
run: |
43+
pytest -q
Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
11
name: Publish Python 🐍 distributions 📦 to PyPI
22

3-
on: push
3+
on:
4+
push:
5+
tags:
6+
- "*" # Only run on tag pushes
47

58
jobs:
69
build-n-publish:
710
name: Build and publish Python 🐍 distributions 📦 to PyPI
11+
if: github.repository == 'fishbotics/urchin'
812
runs-on: ubuntu-latest
9-
13+
1014
steps:
11-
- uses: actions/checkout@v3
12-
- name: Set up Python
13-
uses: actions/setup-python@v4
14-
with:
15-
python-version: "3.x"
16-
17-
- name: Install pypa/build
18-
run: >-
19-
python -m
20-
pip install
21-
build
22-
--user
23-
- name: Build a binary wheel and a source tarball
24-
run: >-
25-
python -m
26-
build
27-
--sdist
28-
--wheel
29-
--outdir dist/
30-
.
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.x"
21+
22+
- name: Install pypa/build
23+
run: python -m pip install build --user
24+
25+
- name: Build a binary wheel and a source tarball
26+
run: python -m build --sdist --wheel --outdir dist/
3127

32-
- name: Publish distribution 📦 to PyPI
33-
if: startsWith(github.ref, 'refs/tags')
34-
uses: pypa/gh-action-pypi-publish@release/v1
35-
with:
36-
password: ${{ secrets.PYPI_API_TOKEN }}
28+
- name: Publish distribution 📦 to PyPI
29+
uses: pypa/gh-action-pypi-publish@release/v1
30+
with:
31+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/test.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,30 @@ on:
44
push:
55
pull_request:
66
schedule:
7-
# * is a special character in YAML so you have to quote this string
8-
# Execute a "weekly" build at 0 AM UTC on Mondays
9-
- cron: '0 0 * * MON'
7+
# * is a special character in YAML so you have to quote this string
8+
# Execute a "weekly" build at 0 AM UTC on Mondays
9+
- cron: "0 0 * * MON"
1010

1111
jobs:
1212
build:
13-
1413
runs-on: ubuntu-latest
1514
strategy:
1615
fail-fast: false
1716
matrix:
1817
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1918

2019
steps:
21-
- uses: actions/checkout@v3
22-
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v3
24-
with:
25-
python-version: ${{ matrix.python-version }}
26-
- name: Install package
27-
run: |
28-
python -m pip install --upgrade pip
29-
python -m pip install flake8 pytest pytest-cov coveralls wheel
30-
python -m pip install .
20+
- uses: actions/checkout@v3
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v3
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install package
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install flake8 pytest pytest-cov coveralls wheel
29+
python -m pip install .
3130
32-
- name: Test with pytest
33-
run: |
34-
pytest --cov=urchin tests
31+
- name: Test with pytest
32+
run: |
33+
pytest --cov=urchin tests

.pre-commit-config.yaml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
repos:
2-
- repo: https://gitlab.com/pycqa/flake8
3-
rev: 3.7.1
4-
hooks:
5-
- id: flake8
6-
exclude: ^setup.py
2+
- repo: https://gitlab.com/pycqa/flake8
3+
rev: 3.7.1
4+
hooks:
5+
- id: flake8
6+
exclude: ^setup.py
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
rev: v0.14.1
9+
hooks:
10+
- id: ruff
11+
name: ruff (lint + isort)
12+
args: ["--fix"]
13+
- id: ruff-format
14+
name: ruff (format)
15+
- repo: https://github.com/pre-commit/mirrors-mypy
16+
rev: v1.18.2
17+
hooks:
18+
- id: mypy
19+
name: mypy
20+
args: ["--config=pyproject.toml", "urchin"]
21+
- repo: local
22+
hooks:
23+
- id: pytest
24+
name: pytest
25+
entry: pytest -q
26+
language: system
27+
pass_filenames: false

docs/source/conf.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
# List of patterns, relative to source directory, that match files and
8080
# directories to ignore when looking for source files.
8181
# This pattern also affects html_static_path and html_extra_path.
82-
exclude_patterns = []
82+
exclude_patterns: list[str] = []
8383

8484
# The name of the Pygments (syntax highlighting) style to use.
8585
pygments_style = None
@@ -124,7 +124,7 @@
124124

125125
# -- Options for LaTeX output ------------------------------------------------
126126

127-
latex_elements = {
127+
latex_elements: dict[str, str] = {
128128
# The paper size ('letterpaper' or 'a4paper').
129129
#
130130
# 'papersize': 'letterpaper',
@@ -217,9 +217,7 @@ class MyPythonDomain(PythonDomain):
217217
def find_obj(self, env, modname, classname, name, type, searchmode=0):
218218
"""Ensures an object always resolves to the desired module
219219
if defined there."""
220-
orig_matches = PythonDomain.find_obj(
221-
self, env, modname, classname, name, type, searchmode
222-
)
220+
orig_matches = PythonDomain.find_obj(self, env, modname, classname, name, type, searchmode)
223221

224222
if len(orig_matches) <= 1:
225223
return orig_matches

pyproject.toml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "urchin"
7+
version = "0.0.30"
8+
requires-python = ">=3.9"
9+
description = "URDF parser and manipulator for Python"
10+
readme = { text = "URDF parser and manipulator for Python. This package is a fork of urdfpy, which seems to be no longer maintained.", content-type = "text/plain" }
11+
authors = [
12+
{ name = "Adam Fishman", email = "hello@fishbotics.com" }
13+
]
14+
license = { text = "MIT License" }
15+
urls = { "Homepage" = "https://github.com/fishbotics/urchin" }
16+
keywords = ["robotics", "ros", "urdf", "robots", "parser"]
17+
classifiers = [
18+
"Development Status :: 4 - Beta",
19+
"License :: OSI Approved :: MIT License",
20+
"Programming Language :: Python",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
"Natural Language :: English",
26+
"Topic :: Scientific/Engineering"
27+
]
28+
dependencies = [
29+
"lxml", # For XML DOM Tree
30+
"networkx", # For joint graph
31+
"numpy>=1.20", # Numpy
32+
"pillow", # For texture image loading
33+
"pycollada>=0.6", # COLLADA (.dae) mesh loading via trimesh
34+
"pyribbit>=0.1.46", # For visualization
35+
"scipy", # For trimesh, annoyingly
36+
"trimesh" # Mesh geometry loading/creation/saving
37+
]
38+
39+
[project.optional-dependencies]
40+
dev = [
41+
"flake8", # Code formatting checker
42+
"pre-commit", # Pre-commit hooks
43+
"pytest", # Code testing
44+
"pytest-cov", # Coverage testing
45+
"tox" # Automatic virtualenv testing
46+
]
47+
docs = [
48+
"sphinx", # General doc library
49+
"sphinx_rtd_theme", # RTD theme for sphinx
50+
"sphinx-automodapi" # For generating nice tables
51+
]
52+
53+
[tool.mypy]
54+
python_version = "3.10"
55+
strict = false
56+
warn_unused_ignores = true
57+
58+
[[tool.mypy.overrides]]
59+
module = ["lxml.*", "trimesh.*", "networkx.*", "PIL.*", "pyribbit.*", "sphinx.*", "sphinx_rtd_theme"]
60+
ignore_missing_imports = true
61+
62+
[tool.ruff]
63+
line-length = 100
64+
target-version = "py310"
65+
66+
[tool.ruff.lint]
67+
select = ["E", "F", "I"]
68+
fixable = ["ALL"]
69+
70+
[tool.ruff.format]
71+
quote-style = "double"
72+
indent-style = "space"
73+
docstring-code-format = true

scripts/vis_urdf.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
Script for visualizing a robot from a URDF.
33
Author: Matthew Matl
44
"""
5+
56
import argparse
67

78
import urchin
89

910
if __name__ == "__main__":
10-
1111
# Parse Args
1212
parser = argparse.ArgumentParser(description="Visualize a robot from a URDF file")
13-
parser.add_argument(
14-
"urdf", type=str, help="Path to URDF file that describes the robot"
15-
)
13+
parser.add_argument("urdf", type=str, help="Path to URDF file that describes the robot")
1614
parser.add_argument("-a", action="store_true", help="Visualize robot articulation")
1715
parser.add_argument("-c", action="store_true", help="Use collision geometry")
1816

setup.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)