Skip to content

Commit 41f2da2

Browse files
feat: python package publish
1 parent 888b80f commit 41f2da2

File tree

16 files changed

+473
-124
lines changed

16 files changed

+473
-124
lines changed

.github/workflows/python-tests.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Python Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install pytest pytest-cov
26+
pip install -e .
27+
- name: Install system dependencies
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y libgl1-mesa-glx
31+
- name: Run tests
32+
run: |
33+
pytest tests/ -v --cov=avisengine

.gitignore

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
23+
# Distribution / packaging
24+
.Python
25+
env/
26+
build/
27+
develop-eggs/
28+
dist/
29+
downloads/
30+
eggs/
31+
.eggs/
32+
lib/
33+
lib64/
34+
parts/
35+
sdist/
36+
var/
37+
wheels/
38+
*.egg-info/
39+
.installed.cfg
40+
*.egg
41+
42+
# Unit test / coverage reports
43+
htmlcov/
44+
.tox/
45+
.coverage
46+
.coverage.*
47+
.cache
48+
nosetests.xml
49+
coverage.xml
50+
*.cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Environments
55+
.env
56+
.venv
57+
env/
58+
venv/
59+
ENV/
60+
env.bak/
61+
venv.bak/
62+
63+
# IDE
64+
.idea/
65+
.vscode/
66+
*.swp
67+
*.swo
68+
*.swn

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 AVIS Engine
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include LICENSE
2+
include README.md
3+
include requirements.txt
4+
recursive-include docs *
5+
recursive-include tests *
6+
recursive-exclude * __pycache__
7+
recursive-exclude * *.py[cod]

docs/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# AVIS Engine Python API Documentation
2+
3+
The AVIS Engine Python API provides a robust interface for controlling and interacting with the AVIS Engine Simulator for autonomous vehicle development.
4+
5+
## Installation
6+
7+
```bash
8+
pip install avisengine
9+
```
10+
11+
## Quick Start
12+
13+
```python
14+
from avisengine import Car
15+
16+
# Create a car instance
17+
car = Car()
18+
19+
# Connect to the simulator
20+
car.connect("localhost", 25001)
21+
22+
# Set speed and steering
23+
car.setSpeed(50)
24+
car.setSteering(0)
25+
26+
# Get sensor data
27+
sensors = car.getSensors()
28+
print(f"Sensor readings: {sensors}")
29+
30+
# Get camera image
31+
image = car.getImage()
32+
33+
# Stop the car and close connection
34+
car.stop()
35+
```
36+
37+
## API Reference
38+
39+
### Car Class
40+
41+
The main class for interacting with the AVIS Engine simulator.
42+
43+
#### Methods
44+
45+
- `connect(server, port)`: Connect to the simulator
46+
- `setSpeed(speed)`: Set the car's speed
47+
- `setSteering(steering)`: Set the steering angle
48+
- `setSensorAngle(angle)`: Set the angle between sensor rays
49+
- `getData()`: Request and update sensor data
50+
- `getImage()`: Get the current camera image
51+
- `getSensors()`: Get the current sensor readings
52+
- `getSpeed()`: Get the current speed
53+
- `stop()`: Stop the car and close the connection

pyproject.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[build-system]
2+
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "avisengine"
7+
version = "0.1.3"
8+
description = "Python API for AVIS Engine Simulator - A robust simulation platform for autonomous vehicle development"
9+
readme = "README.md"
10+
requires-python = ">=3.6"
11+
license = {text = "MIT"}
12+
keywords = ["autonomous", "vehicle", "simulator", "engine", "avis"]
13+
authors = [
14+
{name = "Amirmohammad Zarif", email = "[email protected]"}
15+
]
16+
17+
[project.urls]
18+
Homepage = "https://avisengine.com"
19+
Documentation = "https://docs.avisengine.com"
20+
Repository = "https://github.com/AvisEngine/AVIS-Engine-Python-API"
21+
22+
[tool.pytest.ini_options]
23+
testpaths = ["tests"]
24+
python_files = ["test_*.py"]
25+
addopts = "--cov=avisengine --cov-report=term-missing"
26+
27+
[tool.black]
28+
line-length = 88
29+
include = '\.pyi?$'
30+
31+
[tool.isort]
32+
profile = "black"
33+
multi_line_output = 3

requirements.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Runtime dependencies
12
numpy==1.18.3
23
opencv-contrib-python==4.2.0.34
34
opencv-python==4.2.0.34
@@ -7,3 +8,13 @@ PyYAML==5.3.1
78
regex==2020.4.4
89
requests==2.22.0
910

11+
# Development dependencies
12+
pytest>=6.0
13+
pytest-cov>=4.1.0
14+
black>=23.3.0
15+
isort>=5.12.0
16+
flake8>=6.0.0
17+
tox>=4.5.1
18+
build>=0.10.0
19+
twine>=4.0.2
20+

setup.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from setuptools import setup, find_packages
2+
3+
with open("README.md", "r", encoding="utf-8") as fh:
4+
long_description = fh.read()
5+
6+
setup(
7+
name="avisengine",
8+
version="0.1.3",
9+
author="Amirmohammad Zarif",
10+
author_email="[email protected]",
11+
description="Python API for AVIS Engine Simulator - A robust simulation platform for autonomous vehicle development",
12+
long_description=long_description,
13+
long_description_content_type="text/markdown",
14+
url="https://github.com/AvisEngine/AVIS-Engine-Python-API",
15+
project_urls={
16+
"Homepage": "https://avisengine.com",
17+
"Documentation": "https://docs.avisengine.com",
18+
"Source": "https://github.com/AvisEngine/AVIS-Engine-Python-API",
19+
},
20+
package_dir={"": "src"},
21+
packages=find_packages(where="src"),
22+
classifiers=[
23+
"Programming Language :: Python :: 3",
24+
"License :: OSI Approved :: MIT License",
25+
"Operating System :: OS Independent",
26+
"Development Status :: 5 - Production/Stable",
27+
"Intended Audience :: Science/Research",
28+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
29+
"Topic :: Software Development :: Libraries :: Python Modules",
30+
],
31+
python_requires=">=3.6",
32+
install_requires=[
33+
"numpy>=1.18.3",
34+
"opencv-contrib-python>=4.2.0.34",
35+
"opencv-python>=4.2.0.34",
36+
"Pillow>=7.1.2",
37+
"PySocks>=1.7.1",
38+
"PyYAML>=5.3.1",
39+
"regex>=2020.4.4",
40+
"requests>=2.22.0"
41+
],
42+
)

setup_dev.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# This script sets up a development environment for AVIS Engine Python API
3+
4+
# Ensure python3 and pip are available
5+
if ! command -v python3 &> /dev/null; then
6+
echo "Python 3 is required but not installed. Please install Python 3 first."
7+
exit 1
8+
fi
9+
10+
# Create and activate virtual environment
11+
python3 -m venv venv
12+
source venv/bin/activate
13+
14+
# Upgrade pip and install development dependencies
15+
pip install --upgrade pip
16+
pip install -r requirements.txt
17+
18+
# Install package in development mode
19+
pip install -e .
20+
21+
# Run tests to verify setup
22+
pytest tests/ -v
23+
24+
echo "Development environment setup complete!"
25+
echo "To activate the virtual environment in the future, run: source venv/bin/activate"

src/avisengine/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
AVIS Engine Python API - A robust simulation platform for autonomous vehicle development.
3+
"""
4+
5+
from .avisengine import Car
6+
7+
__version__ = "0.1.3"
8+
__author__ = "Amirmohammad Zarif"
9+
__email__ = "[email protected]"
10+
11+
__all__ = ["Car"]

0 commit comments

Comments
 (0)