Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work/bd808/modern packaging #16

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -8,5 +8,4 @@
/.venv/
/build/
/dist/
/docs/
__pycache__/
12 changes: 12 additions & 0 deletions .readthedocs.yaml
@@ -0,0 +1,12 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

sphinx:
configuration: docs/conf.py
fail_on_warning: true
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

8 changes: 4 additions & 4 deletions README.rst
Expand Up @@ -22,12 +22,12 @@ inheritance`_::

Installation
============
* ``pip install ib3`` (recommended)
* ``python setup.py install`` (from source distribution)
* ``python3 -m pip install --upgrade ib3`` (recommended)
* ``python3 -m pip install .`` (from source distribution)

License
=======
IB3 is licensed under the `GNU GPLv3+`_ license.
IB3 is licensed under the `GPL-3.0-or-later`_ license.

Credits
=======
Expand All @@ -37,7 +37,7 @@ Some code and much inspiration taken from Wikimedia irc bots `Adminbot`_,
.. _irc: https://pypi.org/project/irc/
.. _mixin: https://en.wikipedia.org/wiki/Mixin
.. _multiple inheritance: https://docs.python.org/3/tutorial/classes.html#multiple-inheritance
.. _GNU GPLv3+: https://www.gnu.org/copyleft/gpl.html
.. _GPL-3.0-or-later: https://www.gnu.org/copyleft/gpl.html
.. _Adminbot: https://phabricator.wikimedia.org/diffusion/ODAC/
.. _Jouncebot: https://phabricator.wikimedia.org/diffusion/GJOU/
.. _Stashbot: https://phabricator.wikimedia.org/diffusion/LTST/
File renamed without changes.
File renamed without changes.
23 changes: 6 additions & 17 deletions doc/conf.py → docs/conf.py
@@ -1,18 +1,10 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import datetime
import os
import subprocess
import sys
import importlib.metadata

import sphinx_rtd_theme

if 'check_output' not in dir(subprocess):
import subprocess32 as subprocess

sys.path.insert(0, os.path.abspath('../'))

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
Expand All @@ -25,18 +17,15 @@
}

# General information about the project.
root = os.path.join(os.path.dirname(__file__), '..')
setup_script = os.path.join(root, 'setup.py')
fields = ['--name', '--version', '--author']
dist_info_cmd = [sys.executable, setup_script] + fields
output_bytes = subprocess.check_output(dist_info_cmd, cwd=root)
project, version, author = output_bytes.decode('utf-8').strip().split('\n')
metadata = importlib.metadata.metadata("ib3")
project = metadata["name"]
version = metadata["version"]
author = "Bryan Davis"

_origin_date = datetime.date(2017, 2, 19)
_today = datetime.date.today()

copyright = '{_origin_date.year}-{_today.year} {author}'.format(**locals())

copyright = f'{_origin_date.year}-{_today.year} {author} and contributors'
release = version

master_doc = 'index'
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions doc/index.rst → docs/index.rst
Expand Up @@ -6,8 +6,8 @@ IRC bot framework using mixins to provide commonly desired functionality.
.. image:: https://img.shields.io/pypi/v/ib3.svg
:target: https://pypi.org/project/ib3

.. image:: https://img.shields.io/travis/bd808/python-ib3/master.svg
:target: http://travis-ci.org/bd808/python-ib3
.. image:: https://img.shields.io/github/actions/workflow/status/bd808/python-ib3/tox.yml?logo=github
:target: https://github.com/bd808/python-ib3/actions/workflows/tox.yml

.. image:: https://readthedocs.org/projects/python-ib3/badge/?version=latest
:target: https://python-ib3.readthedocs.io
Expand Down
54 changes: 54 additions & 0 deletions pyproject.toml
@@ -0,0 +1,54 @@
[build-system]
build-backend = "hatchling.build"
requires = [
"hatchling>=1.13",
"hatch-vcs>=0.3",
]

[project]
name = "ib3"
description = "IRC bot framework using mixins to provide common functionality"
readme = "README.rst"
license = "GPL-3.0-or-later"
authors = [
{ name = "Bryan Davis", email = "bd808@bd808.com" },
]
requires-python = ">=3.7"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"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 :: Communications :: Chat :: Internet Relay Chat",
]
dynamic = [
"version",
]
dependencies = [
"irc>=20.0.0",
]

[project.urls]
Homepage = "https://python-ib3.readthedocs.io/en/latest/"
"Bug Tracker" = "https://github.com/bd808/python-ib3/issues"
Source = "https://github.com/bd808/python-ib3"

[tool.hatch]
build.dev-mode-dirs = ["src"]
build.targets.sdist.include = [
"/COPYING",
"/doc",
"/examples",
"/src",
"/tests",
"/tox.ini",
]

[tool.hatch.version]
source = "vcs"
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

13 changes: 0 additions & 13 deletions setup.cfg

This file was deleted.

66 changes: 0 additions & 66 deletions setup.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 25 additions & 5 deletions tox.ini
@@ -1,26 +1,38 @@
[tox]
minversion = 4.0
envlist = flake8,py37,py38,py39,py310,py311,docs
envlist = flake8,py37,py38,py39,py310,py311,docs,pkg_meta
skip_missing_interpreters = true

[testenv]
deps=
-r{toxinidir}/requirements.txt
pytest
pytest-cov
pytest-mock
setenv=
PYTHONDONTWRITEBYTECODE=true
commands=
pytest ib3/
pytest tests/

[testenv:docs]
deps=
-r{toxinidir}/requirements.txt
sphinx
sphinx_rtd_theme
commands=
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
sphinx-build -q -W -b html -d "{envtmpdir}{/}doctree" docs "{toxinidir}{/}dist{/}docs"
python -c 'print(r"documentation available under file://{toxinidir}{/}dist{/}docs{/}index.html")'

[testenv:pkg_meta]
description = check that generated pacakges are valid
base_python = py311
skip_install = true
deps =
build[virtualenv]>=1.0.3
check-wheel-contents>=0.4
twine>=4.0.2
commands =
python3 -m build --outdir {envtmpdir} --sdist --wheel .
twine check --strict {envtmpdir}{/}*
check-wheel-contents {envtmpdir}

[testenv:flake8]
base_python = py311
Expand Down Expand Up @@ -49,3 +61,11 @@ directory = dist/htmlcov

[coverage:xml]
output = dist/coverage.xml

[gh]
python =
3.7 = py37
3.8 = py38
3.9 = py39
3.10 = py310
3.11 = flake8, py311, docs, pkg_meta