diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..a511e9b --- /dev/null +++ b/.coveragerc @@ -0,0 +1,20 @@ +[report] +fail_under = 60 +exclude_lines = + if TYPE_CHECKING: + pragma: no cover + def __repr__ + raise AssertionError + raise NotImplementedError + if __name__ == .__main__.: + if sys.version_info + class .*\(.*(Error|Exception)\): + ^ *\.\.\.$ + +[run] +branch = true +omit = + tests/data/* + tests/util/* + .* + venv/* diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..6d03f6f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,12 @@ +FROM mcr.microsoft.com/devcontainers/python:3.11 + +RUN \ + pipx uninstall pydocstyle \ + && pipx uninstall pycodestyle \ + && pipx uninstall mypy \ + && pipx uninstall pylint \ + && pipx uninstall pytest \ + && pipx uninstall flake8 \ + && pipx uninstall black + +ENV SHELL /bin/bash diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..f570257 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,48 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "Python 3", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "dockerFile": "./Dockerfile", + "context": "..", + "features": { + "ghcr.io/devcontainers-contrib/features/zsh-plugins:0": { + "omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions" + } + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pip3 install -Ur requirements.txt", + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root", + "customizations": { + "vscode": { + "extensions": [ + "tamasfe.even-better-toml", + "ms-python.python", + "ms-python.vscode-pylance", + "EditorConfig.EditorConfig", + "GitHub.vscode-pull-request-github" + ], + "settings": { + "python.pythonPath": "/usr/local/bin/python", + "python.testing.pytestArgs": ["--no-cov"], + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "/usr/bin/zsh" + } + }, + "terminal.integrated.defaultProfile.linux": "zsh" + } + } + } +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c9da32b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# This is the top-most .editorconfig file; do not search in parent directories. +root = true + +# All files. +[*] +end_of_line = LF +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{yml,yaml}] +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7e5ef54 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,83 @@ +exclude: ^\.vscode/.*$ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0 + hooks: + - id: trailing-whitespace + args: ['--markdown-linebreak-ext=md,markdown'] + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: check-ast + - id: check-byte-order-marker + - id: check-merge-conflict + - id: debug-statements + - id: detect-private-key + exclude: tests/data/.* + - id: check-builtin-literals + - id: check-case-conflict + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-json + exclude: '.devcontainer/.*' + - id: pretty-format-json + exclude: '.devcontainer/.*' + args: + - --indent + - '4' + - --autofix + - --no-sort-keys + - id: check-toml + - id: fix-encoding-pragma + args: + - --remove +- repo: https://github.com/psf/black + rev: 6fdf8a4af28071ed1d079c01122b34c5d587207a # frozen: 24.2.0 + hooks: + - id: black +- repo: https://github.com/pycqa/isort + rev: c235f5e450b4b84e58d114ed4c589cbf454175a3 # frozen: 5.13.2 + hooks: + - id: isort +- repo: https://github.com/pre-commit/pygrep-hooks + rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 # frozen: v1.10.0 + hooks: + - id: python-no-eval + - id: python-no-log-warn +- repo: https://github.com/asottile/pyupgrade + rev: df17dfa3911b81b4a27190b0eea5b1debc7ffa0a # frozen: v3.15.1 + hooks: + - id: pyupgrade + args: + - "--py38-plus" + +- repo: local + hooks: + - id: mypy + name: mypy + entry: mypy + language: system + types: [python] + - id: pylint + name: pylint + entry: pylint + args: + - '-s' + - 'no' + language: system + types: [python] +- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 8d1b9cadaf854cb25bb0b0f5870e1cc66a083d6b # frozen: 0.2.3 + hooks: + - id: yamlfmt + args: + - --mapping + - '2' + - --sequence + - '2' + - --offset + - '0' + - --width + - '120' + - -e + - -p diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..801fa63 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "github.vscode-pull-request-github" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..788d6f2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "python.testing.pytestArgs": [ + "." + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, +} diff --git a/asyncirc/__init__.py b/asyncirc/__init__.py index 016d450..991ce44 100644 --- a/asyncirc/__init__.py +++ b/asyncirc/__init__.py @@ -4,3 +4,5 @@ """ __all__ = ("protocol", "server") + +__version__ = '0.1.8' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3ac3085 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,101 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "async-irc" +dynamic = ["version"] +description = "A simple asyncio.Protocol implementation designed for IRC" +readme = "README.md" +license = "MIT" +requires-python = ">=3.8" +authors = [ + { name = "linuxdaemon", email = "linuxdaemon@snoonet.org" }, +] +keywords = [ + "async-irc", + "asyncio", + "asyncirc", + "irc", + "irc-framework", +] +classifiers = [ + "Development Status :: 3 - Alpha", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3.8", +] +dependencies = [ + "py-irclib", +] + +[project.urls] +Homepage = "https://github.com/TotallyNotRobots/async-irc" + +[tool.hatch.version] +path = "asyncirc/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/asyncirc", +] + +[tool.hatch.build.targets.wheel] +packages = [ + "asyncirc", +] + +[tool.isort] +line_length = 80 +multi_line_output = 3 +include_trailing_comma = true +use_parentheses = true +known_first_party = ["asyncirc", "tests"] +float_to_top = true + +[tool.black] +line-length = 80 +target-version = ['py38'] +include = '\.pyi?$' +exclude = ''' +( + /( + \.eggs # exclude a few common directories in the + | \.git # root of the project + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | _build + | buck-out + | build + | dist + | venv + )/ +) +''' + +[tool.pylint.main] +analyse-fallback-blocks = true +py-version = "3.8" + +[tool.pylint.messages_control] +disable = [ +] + +enable = ["c-extension-no-member"] + +[tool.pylint.typecheck] +generated-members = "(requests\\.)?codes\\.[a-zA-Z0-9_]+" + +[tool.mypy] +namespace_packages = true +python_version = "3.8" +warn_unused_configs = true +strict = false +strict_optional = false +ignore_missing_imports = true +check_untyped_defs = true +show_error_codes = true +warn_unused_ignores = true +warn_redundant_casts = true +# strict_equality = true diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..66a1ec4 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,14 @@ +[pytest] +addopts = + --ignore=venv + --ignore=.* + --cov . + --cov-report=xml + --cov-report=html + --doctest-modules +testpaths = . +filterwarnings = + error + ignore:pkg_resources is deprecated as an API:DeprecationWarning + ignore:datetime.*:DeprecationWarning:sqlalchemy.* +asyncio_mode = auto diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 42b1684..0000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[aliases] -test=pytest - -[tool:pytest] -testpaths = tests \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index ea11363..0000000 --- a/setup.py +++ /dev/null @@ -1,28 +0,0 @@ -from setuptools import setup -from pathlib import Path - -this_directory = Path(__file__).parent -long_description = (this_directory / "README.md").read_text() - -setup( - name='async-irc', - version='0.1.8', - python_requires=">=3.6", - description="A simple asyncio.Protocol implementation designed for IRC", - long_description=long_description, - long_description_content_type='text/markdown', - url='https://github.com/TotallyNotRobots/async-irc', - author='linuxdaemon', - author_email='linuxdaemon@snoonet.org', - license='MIT', - classifiers=[ - 'Development Status :: 3 - Alpha', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 3.6', - ], - keywords='asyncio irc asyncirc async-irc irc-framework', - packages=['asyncirc', 'asyncirc.util'], - install_requires=['py-irclib'], - setup_requires=['pytest-runner'], - tests_require=['pytest'], -)