Skip to content

Commit

Permalink
Migrate to more standard repo setup
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdaemon committed Mar 29, 2024
1 parent 51d0239 commit 422d3e7
Show file tree
Hide file tree
Showing 13 changed files with 307 additions and 33 deletions.
20 changes: 20 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -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/*
12 changes: 12 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
48 changes: 48 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
83 changes: 83 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"github.vscode-pull-request-github"
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"."
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
}
2 changes: 2 additions & 0 deletions asyncirc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
"""

__all__ = ("protocol", "server")

__version__ = '0.1.8'
101 changes: 101 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -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
5 changes: 0 additions & 5 deletions setup.cfg

This file was deleted.

28 changes: 0 additions & 28 deletions setup.py

This file was deleted.

0 comments on commit 422d3e7

Please sign in to comment.