Use flit and isort

This commit is contained in:
Nguyễn Gia Phong 2020-06-24 22:34:05 +07:00
parent a7658383ac
commit caa9421a2c
9 changed files with 66 additions and 53 deletions

View File

@ -1 +0,0 @@
include LICENSE

View File

@ -16,7 +16,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with Axuy. If not, see <https://www.gnu.org/licenses/>. # along with Axuy. If not, see <https://www.gnu.org/licenses/>.
__doc__ = """Axuy is a minimalist peer-to-peer first-person shooter. """Axuy is a minimalist peer-to-peer first-person shooter.
This package provides abstractions for writing custom front-ends and AIs. This package provides abstractions for writing custom front-ends and AIs.
All classes and helper functions are exposed at the package level. All classes and helper functions are exposed at the package level.
@ -25,11 +25,12 @@ Some superclasses may define abstract methods which must be overridden
in derived classes. Subclasses only document newly introduced attributes. in derived classes. Subclasses only document newly introduced attributes.
""" """
from .misc import *
from .pico import *
from .peer import *
from .display import *
from .control import * from .control import *
from .display import *
from .misc import *
from .peer import *
from .pico import *
__all__ = (misc.__all__ + pico.__all__ + peer.__all__ __all__ = (misc.__all__ + pico.__all__ + peer.__all__
+ display.__all__ + control.__all__) + display.__all__ + control.__all__)
__version__ = peer.__version__

View File

@ -19,7 +19,7 @@
__doc__ = 'Axuy main loop' __doc__ = 'Axuy main loop'
__all__ = ['main'] __all__ = ['main']
from .control import CtlConfig, Control from .control import Control, CtlConfig
def main(): def main():

View File

@ -32,9 +32,9 @@ import numpy as np
from PIL import Image from PIL import Image
from pyrr import matrix44 from pyrr import matrix44
from .peer import PeerConfig, Peer
from .pico import TETRAVERTICES, OCTOVERTICES, SHARD_LIFE
from .misc import abspath, color, mirror from .misc import abspath, color, mirror
from .peer import Peer, PeerConfig
from .pico import OCTOVERTICES, SHARD_LIFE, TETRAVERTICES
CONWAY = 1.303577269034 CONWAY = 1.303577269034
ABRTN_MAX = 0.42069 ABRTN_MAX = 0.42069

View File

@ -26,7 +26,7 @@ from configparser import ConfigParser
from os.path import join as pathjoin, pathsep from os.path import join as pathjoin, pathsep
from pickle import dumps, loads from pickle import dumps, loads
from queue import Empty, Queue from queue import Empty, Queue
from socket import socket, SOCK_DGRAM, SOL_SOCKET, SO_REUSEADDR from socket import SO_REUSEADDR, SOCK_DGRAM, SOL_SOCKET, socket
from sys import stdout from sys import stdout
from threading import Thread from threading import Thread
from typing import Iterator, Tuple from typing import Iterator, Tuple

34
pyproject.toml Normal file
View File

@ -0,0 +1,34 @@
[build-system]
requires = ['flit_core >=2,<3']
build-backend = 'flit_core.buildapi'
[tool.flit.metadata]
module = 'axuy'
author = 'Nguyễn Gia Phong'
author-email = 'mcsinyx@disroot.org'
home-page = 'https://github.com/McSinyx/axuy'
requires = ['appdirs', 'glfw>=1.8', 'moderngl',
'numpy', 'Pillow', 'pyrr', 'setuptools']
description-file = 'README.md'
classifiers = [
'Development Status :: 3 - Alpha',
'Environment :: MacOS X',
'Environment :: Win32 (MS Windows)',
'Environment :: X11 Applications',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Games/Entertainment :: First Person Shooters']
requires-python = '>=3.6'
keywords = 'fps,p2p,opengl,glfw'
license = 'AGPLv3+'
[tool.flit.entrypoints.console_scripts]
axuy = "axuy.__main__:main"

View File

@ -1,39 +0,0 @@
#!/usr/bin/env python3
from setuptools import setup
with open('README.md') as f:
long_description = f.read()
setup(
name='axuy',
version='0.0.10',
description='Minimalist first-person shooter',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/McSinyx/axuy',
author='Nguyễn Gia Phong',
author_email='vn.mcsinyx@gmail.com',
license='AGPLv3+',
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: MacOS X',
'Environment :: Win32 (MS Windows)',
'Environment :: X11 Applications',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Games/Entertainment :: First Person Shooters'],
keywords='fps p2p opengl glfw',
packages=['axuy'],
install_requires=['appdirs', 'numpy', 'pyrr',
'moderngl', 'glfw>=1.8', 'Pillow'],
package_data={'axuy': ['map.npy', 'shaders/*',
'icon.png', 'settings.ini']},
entry_points={'console_scripts': ['axuy = axuy.__main__:main']})

View File

@ -20,8 +20,8 @@
from itertools import chain from itertools import chain
from time import time from time import time
from axuy import (INV, RCOLL, PICO_SPEED, SHARD_LIFE, neighbors, from axuy import (INV, PICO_SPEED, RCOLL, SHARD_LIFE,
Shard, Peer, Display, DispConfig) DispConfig, Display, Peer, Shard, neighbors)
from numpy import floor from numpy import floor
from numpy.linalg import norm from numpy.linalg import norm

22
tox.ini
View File

@ -1,3 +1,21 @@
[tox]
envlist = py
minversion = 3.3
isolated_build = True
[testenv]
deps =
flake8-builtins
isort
commands =
flake8
isort -c --diff
[flake8] [flake8]
ignore = E226, E701, E704 ignore = E226, E701, E704, W503
exclude = setup.py, __init__.py exclude = __init__.py
[isort]
balanced_wrapping = True
combine_as_imports = True
known_third_party = axuy