Skip to content

Commit e21891e

Browse files
author
Tamerlan Abilov
committed
github workflows, versioning, tests, refactor
1 parent 9986ef3 commit e21891e

File tree

12 files changed

+197
-2
lines changed

12 files changed

+197
-2
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Tests
5+
6+
on:
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: [3.7, 3.8, 3.9]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
python -m pip install flake8 pytest
30+
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
31+
32+
- name: Test with pytest
33+
run: |
34+
pytest
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Pypi Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: '3.x'
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install setuptools wheel twine
22+
- name: Build and publish
23+
env:
24+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
25+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
26+
run: |
27+
python setup.py sdist bdist_wheel
28+
twine upload dist/*

MANIFEST.in

Whitespace-only changes.

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
![Pygame integration example](example/sm-example.gif)
55

6-
7-
#### TL;DR: Some basic 3D world playground with animations and [camera](#camera-keys-example) completely from scratch(only 2D pixels).
6+
[![Tests](https://github.com/timabilov/python-play3d/actions/workflows/python-package.yml/badge.svg?event=push)](https://github.com/timabilov/python-play3d/actions/workflows/python-package.yml)
7+
#### TL;DR: Basic 3D world playground with animations and [camera](#camera-keys-example) completely from scratch(only 2D pixels).
88
This implementation / API only for demonstration and *playground* purposes based on [Perspective projection](https://en.wikipedia.org/wiki/3D_projection#Perspective_projection).
99
Can be used on top of **any** 2d graphics engine/lib(frame buffers, sdl and etc.)
1010

@@ -17,6 +17,8 @@ Not implemented features due to low performance:
1717

1818
Also you can plot any function on 3D scene.
1919

20+
21+
* [Install](#intall)
2022
* [How to use](#how-to-use)
2123
* [Model View Projection](#model-view-projection)
2224
* [Projection](#projection)
@@ -30,6 +32,10 @@ Also you can plot any function on 3D scene.
3032
* [Trajectory API](#trajectory-api)
3133
* [Pygame Example](#pygame-example)
3234

35+
## Install
36+
37+
`pip install play3d`
38+
3339
## How to use
3440

3541
There is only one requirement - to provide 2D pixel and line renderer(drawer)

play3d/__about__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
__version__ = "0.1.0"
2+
__author__ = "timabilov"
3+
__email__ = "timabilov33@gmail.com"
4+
__url__ = " https://github.com/timabilov/python-play3d"
5+
__license__ = "MIT License"

play3d/matrix.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ def __add__(self, other):
7676
def __str__(self):
7777
return str(self.matrix)
7878

79+
def __eq__(self, other: 'Matrix'):
80+
print('EHE?', self)
81+
print(other)
82+
return (self.matrix == other.matrix).all()
83+
7984

8085
def matmul(matrix1, matrix2):
8186
"""

requirements-dev.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-r requirements.txt
2+
pytest

setup.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from os.path import abspath, dirname, join
2+
3+
import setuptools
4+
5+
with open("README.md", "r") as fh:
6+
long_description = fh.read()
7+
8+
about: dict = {}
9+
here = abspath(dirname(__file__))
10+
with open(join(here, "play3d", "__about__.py")) as f:
11+
exec(f.read(), about)
12+
13+
setuptools.setup(
14+
name="play3d",
15+
version=about["__version__"],
16+
author=about["__author__"],
17+
author_email=about["__email__"],
18+
url=about["__url__"],
19+
license=about["__license__"],
20+
packages=['play3d'],
21+
install_requires=[line.strip() for line in open(join(here, "requirements.txt")).readlines()],
22+
description="Basic 3D world playground with animations and completely from scratch.",
23+
long_description=open(join(dirname(__file__), "README.md")).read(),
24+
long_description_content_type="text/markdown",
25+
keywords="python 3d play3d three_d projection mvp",
26+
classifiers=[
27+
"Development Status :: 1 - Planning",
28+
"Intended Audience :: Developers",
29+
"License :: OSI Approved :: MIT License",
30+
"Operating System :: OS Independent",
31+
"Topic :: Software Development",
32+
"Topic :: Education",
33+
"Topic :: Scientific/Engineering :: Visualization",
34+
"Programming Language :: Python",
35+
"Programming Language :: Python :: 3",
36+
"Programming Language :: Python :: 3.6",
37+
"Programming Language :: Python :: 3.7",
38+
"Programming Language :: Python :: 3.8",
39+
"Programming Language :: Python :: 3.9",
40+
],
41+
)

tests/__init__.py

Whitespace-only changes.

tests/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pytest import fixture
2+
3+
from play3d.models import Cube
4+
5+
6+
@fixture
7+
def cube():
8+
return Cube()

0 commit comments

Comments
 (0)