Skip to content

Commit

Permalink
Merge pull request #179 from JaskRendix/toml
Browse files Browse the repository at this point in the history
pyproject.toml + isort
  • Loading branch information
bitcraft authored Jan 15, 2024
2 parents 87c33f9 + 7137fa1 commit 145a52e
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 54 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ jobs:
strategy:
matrix:
python-version:
- 3.7.12
- 3.8.12
- 3.9.7
- 3.7
- 3.8
- 3.9
dependencies:
- pygame pyglet
- pygame
- pyglet
- "null"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Requirements
Expand Down
3 changes: 2 additions & 1 deletion apps/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ def run(self):


if __name__ == "__main__":
import os.path
import glob
import os.path

import pytmx

pygame.init()
Expand Down
6 changes: 2 additions & 4 deletions apps/pygame_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
from pygame.locals import *

import pytmx
from pytmx import TiledImageLayer
from pytmx import TiledObjectGroup
from pytmx import TiledTileLayer
from pytmx import TiledImageLayer, TiledObjectGroup, TiledTileLayer
from pytmx.util_pygame import load_pygame

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -221,8 +219,8 @@ def run(self):


if __name__ == "__main__":
import os.path
import glob
import os.path

pygame.init()
pygame.font.init()
Expand Down
2 changes: 1 addition & 1 deletion apps/pygame_sdl2_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def run(self):


if __name__ == "__main__":
import os.path
import glob
import os.path

pygame.init()
pygame.font.init()
Expand Down
5 changes: 3 additions & 2 deletions apps/pyglet_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
logger.addHandler(ch)
logger.setLevel(logging.INFO)

import pyglet

from pytmx import *
from pytmx.util_pyglet import load_pyglet
import pyglet


class TiledRenderer(object):
Expand Down Expand Up @@ -129,8 +130,8 @@ def draw(self):


def all_filenames():
import os.path
import glob
import os.path

_list = glob.glob(os.path.join("data", "*.tmx"))
try:
Expand Down
7 changes: 4 additions & 3 deletions apps/pysdl2_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@

os.environ["PYSDL2_DLL_PATH"] = os.path.dirname(__file__)

import sdl2.ext
from sdl2 import *

from pytmx import *
from pytmx.util_pysdl2 import load_pysdl2
from sdl2 import *
import sdl2.ext


class TiledRenderer(object):
Expand Down Expand Up @@ -126,8 +127,8 @@ def run(self, window):


def all_filenames():
import os.path
import glob
import os.path

return glob.glob(os.path.join("data", "*.tmx"))

Expand Down
47 changes: 47 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "PyTMX"
version = "3.32"
description = "Loads tiled tmx maps"
readme = "readme.md"
license = {file = "LICENSE"}
authors = [
{name = "bitcraft", email = "[email protected]"}
]
classifiers = [
"Intended Audience :: Developers",
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Games/Entertainment",
"Topic :: Multimedia :: Graphics",
"Topic :: Software Development :: Libraries :: pygame",
]
requires-python = ">=3.7"

[project.urls]
source = "https://github.com/bitcraft/PyTMX"

[tool.setuptools]
packages = ["pytmx"]

[project.optional-dependencies]
pygame = ["pygame>=2.0.0"]
pygame-ce = ["pygame-ce>=2.1.3"]

[tool.black]
line-length = 88
target-version = ["py37"]

[tool.isort]
line_length = 88
profile = "black"
skip_gitignore = true
6 changes: 3 additions & 3 deletions pytmx/pytmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
from __future__ import annotations

import gzip
import json
import logging
import os
import struct
import zlib
from base64 import b64decode
from collections import defaultdict, namedtuple
from copy import deepcopy
from itertools import chain, product
from math import cos, radians, sin
from operator import attrgetter
from typing import List, Tuple, Optional, Sequence, Union, Dict, Iterable
from typing import Dict, Iterable, List, Optional, Sequence, Tuple, Union
from xml.etree import ElementTree
import json
from copy import deepcopy

# for type hinting
try:
Expand Down
4 changes: 2 additions & 2 deletions pytmx/util_pygame.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
"""
import itertools
import logging
from typing import Optional, Union, List
from typing import List, Optional, Union

import pytmx
from pytmx.pytmx import ColorLike, PointLike

logger = logging.getLogger(__name__)

try:
from pygame.transform import flip, rotate
import pygame
from pygame.transform import flip, rotate
except ImportError:
logger.error("cannot import pygame (is it installed?)")
raise
Expand Down
2 changes: 1 addition & 1 deletion pytmx/util_pygame_sdl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
logger = logging.getLogger(__name__)

try:
from pygame._sdl2 import Texture, Image, Renderer, Window
import pygame
from pygame._sdl2 import Image, Renderer, Texture, Window
except ImportError:
logger.error("cannot import pygame (is it installed?)")
raise
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

29 changes: 1 addition & 28 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,4 @@
# python3 -m twine upload --repository pypi dist/*
from setuptools import setup

setup(
name="PyTMX",
version="3.32",
description="Loads tiled tmx maps",
author="bitcraft",
author_email="[email protected]",
packages=["pytmx"],
license="LGPLv3",
long_description="https://github.com/bitcraft/PyTMX",
python_requires=">=3.7",
extras_require={
"pygame": ["pygame>=2.0.0"],
"pygame-ce": ["pygame-ce>=2.1.3"],
},
classifiers=[
"Intended Audience :: Developers",
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Games/Entertainment",
"Topic :: Multimedia :: Graphics",
"Topic :: Software Development :: Libraries :: pygame",
],
)
setup()
3 changes: 1 addition & 2 deletions tests/pytmx/test_pytmx.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import unittest

import pytmx
from pytmx import TiledElement
from pytmx import convert_to_bool
from pytmx import TiledElement, convert_to_bool


class TestConvertToBool(unittest.TestCase):
Expand Down

0 comments on commit 145a52e

Please sign in to comment.