diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4fb6d7..b1af51a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,19 +25,17 @@ jobs: env: OS: ${{ matrix.os }} PYTHON: ${{ matrix.python-version }} + steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install setuptools - run: pip install -U setuptools - if: ${{ matrix.python-version == '3.12' }} - name: Install test requirements - run: pip install -r test-requirements.txt + run: pip install -e .[dev] - name: Run tests - run: python setup.py test + run: pytest - name: Upload coverage uses: codecov/codecov-action@v4 with: @@ -53,13 +51,11 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.11 - - name: Build source distribution - run: python setup.py sdist - - name: Build wheel + python-version: 3.8 + - name: Build wheel and source distribution run: | - pip install wheel - python setup.py bdist_wheel + pip install build + python -m build --sdist --wheel - name: Publish source package on PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 13bbf1f..457da44 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,12 +6,12 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/ambv/black - rev: 23.3.0 + rev: 24.3.0 hooks: - id: black language_version: python3 - repo: https://github.com/pycqa/flake8 - rev: 5.0.4 + rev: 7.0.0 hooks: - id: flake8 - repo: https://github.com/astral-sh/ruff-pre-commit @@ -19,4 +19,4 @@ repos: rev: v0.0.272 hooks: - id: ruff - args: [ --fix, --exit-non-zero-on-fix, --ignore, "E501,F403" ] + args: [ --fix, --exit-non-zero-on-fix] diff --git a/aioconsole/__init__.py b/aioconsole/__init__.py index e4c39a1..1c8f441 100644 --- a/aioconsole/__init__.py +++ b/aioconsole/__init__.py @@ -12,6 +12,9 @@ from .server import start_interactive_server from .apython import run_apython + +__version__ = "0.7.2.dev0" + __all__ = [ "aexec", "ainput", diff --git a/aioconsole/events.py b/aioconsole/events.py index 094fc2c..df21e4b 100644 --- a/aioconsole/events.py +++ b/aioconsole/events.py @@ -19,7 +19,7 @@ def __init__( locals=None, banner=None, serve=None, - prompt_control=None + prompt_control=None, ): self.console = None self.console_task = None diff --git a/aioconsole/rlwrap.py b/aioconsole/rlwrap.py index 9a79337..62115dc 100644 --- a/aioconsole/rlwrap.py +++ b/aioconsole/rlwrap.py @@ -21,7 +21,7 @@ def rlwrap_process(args, prompt_control, use_stderr=False): bufsize=0, universal_newlines=True, stdin=subprocess.PIPE, - **{"stderr" if use_stderr else "stdout": subprocess.PIPE} + **{"stderr" if use_stderr else "stdout": subprocess.PIPE}, ) # Readline wrapping return _rlwrap(process, prompt_control, use_stderr) diff --git a/docs/conf.py b/docs/conf.py index 55a4199..431a0bc 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,8 @@ """Sphinx configuration for aioconsole documentation.""" -VERSION = open("../setup.py").read().split('version="')[1].split('"')[0] +VERSION = ( + open("../aioconsole/__init__.py").read().split('__version__ = "')[1].split('"')[0] +) project = "aioconsole" version = VERSION diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1e39fc4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,59 @@ +[build-system] +requires = ["setuptools >= 69.5"] +build-backend = "setuptools.build_meta" + +[project] +name = "aioconsole" +dynamic = ["version"] +description = "Asynchronous console and interfaces for asyncio" +readme = {file = "README.rst", content-type = "text/x-rst"} +license = {file = "LICENSE"} +requires-python = ">=3.8" +authors = [ + { name = "Vincent Michel", email = "vxgmichel@gmail.com" }, +] +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "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", + "Programming Language :: Python :: 3 :: Only", +] + +[project.optional-dependencies] +dev = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-repeat", + 'uvloop; python_implementation != "PyPy" and sys_platform != "win32"', +] + +[tool.setuptools] +packages = ["aioconsole"] + +[tool.setuptools.dynamic] +version = {attr = "aioconsole.__version__"} + +[project.scripts] +apython = "aioconsole:run_apython" + +[project.urls] +Homepage = "https://github.com/vxgmichel/aioconsole" + +[tool.pytest.ini_options] +addopts = "--strict-markers --cov aioconsole" +testpaths = ["tests"] + +[tool.black] +line-length = 88 +target_version = ["py38", "py39", "py310", "py311", "py312"] + +[tool.coverage.report] +exclude_also = ["if TYPE_CHECKING:", "assert False"] + +[tool.ruff] +ignore = ["E501", "F403"] diff --git a/setup.py b/setup.py deleted file mode 100644 index d0b1932..0000000 --- a/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python3 - -import sys -from setuptools import setup - -TESTING = any(x in sys.argv for x in ["test", "pytest"]) - -README = open("README.rst").read() - -CLASSIFIERS = """\ -Programming Language :: Python -Programming Language :: Python :: 3 -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 -Programming Language :: Python :: 3 :: Only -""".splitlines() - -setup( - name="aioconsole", - version="0.7.2.dev0", - packages=["aioconsole"], - entry_points={"console_scripts": ["apython = aioconsole:run_apython"]}, - setup_requires=["pytest-runner" if TESTING else ""], - tests_require=[ - "pytest", - "pytest-asyncio", - "pytest-cov", - "pytest-repeat", - 'uvloop; python_implementation != "PyPy" and sys_platform != "win32"', - ], - license="GPLv3", - python_requires=">=3.8", - classifiers=CLASSIFIERS, - description="Asynchronous console and interfaces for asyncio", - long_description=README, - author="Vincent Michel", - author_email="vxgmichel@gmail.com", - url="https://github.com/vxgmichel/aioconsole", - download_url="https://pypi.org/project/aioconsole/", -) diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index a7c21a3..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -pytest -pytest-asyncio -pytest-cov -pytest-repeat -uvloop; python_implementation != "PyPy" and sys_platform != "win32"