Skip to content

Commit

Permalink
Create setuptools package (#43)
Browse files Browse the repository at this point in the history
Allow users to install package via pip and run from anywhere using
python module syntax or console script.

    # pip3 install miniircd
    # miniircd --help
    # python3 -m miniircd --help
  • Loading branch information
pdxjohnny authored Mar 8, 2021
1 parent 6cd8dd7 commit 4f86554
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
*.pyc
*.egg-info
build/
dist/
pip-wheel-metadata/
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ Installation
None. Just run `./miniircd --help` (or `python3 miniircd --help`) to get some
help.

You can install from PyPI if you want:

# pip3 install miniircd

If you install as root you can run from anywhere:

# miniircd --help

If you don't install as root it may not be in your path, but you can invoke it
as a module from anywhere:

# python3 -m miniircd --help


Using `--chroot` and `--setuid`
-------------------------------
Expand Down Expand Up @@ -92,6 +105,34 @@ should look something like this:
crw-rw-rw- 1 root root 1, 9 Jun 10 16:19 urandom


Development
-----------

To install in development mode with all required development and testing
dependencies:

# pip3 install -e .[dev]

To run the tests:

# ./test


Packaging
---------

To build the wheel, first install in development mode with `[dev]` extras. This
will ensure that pep517 and twine are installed.

Build the wheel with pep517's build command:

# python3 -m pep517.build .

Upload new the version to PyPI:

# python3 -m twine upload dist/*


License
-------

Expand Down
2 changes: 2 additions & 0 deletions entry_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[console_scripts]
miniircd = miniircd:main
4 changes: 2 additions & 2 deletions miniircd
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ def irc_lower(s: bytes) -> bytes:
return s.translate(_ircstring_translation)


def main(argv: Sequence[str]) -> None:
def main() -> None:
ap = ArgumentParser(
description="miniircd is a small and limited IRC server.",
)
Expand Down Expand Up @@ -1248,4 +1248,4 @@ def main(argv: Sequence[str]) -> None:


if __name__ == "__main__":
main(sys.argv)
main()
1 change: 1 addition & 0 deletions miniircd.py
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[bdist_wheel]
universal = 1

[tool.black]
line-length = 79
40 changes: 40 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[metadata]
name = miniircd
version = attr: miniircd.VERSION
description = A very simple Internet Relay Chat (IRC) server
long_description = file: README.md
long_description_content_type = text/markdown
author = Joel Rosdahl
author_email = [email protected]
maintainer = Joel Rosdahl
maintainer_email = [email protected]
url = "https://github.com/jrosdahl/miniircd"
license = GPLv2
keywords = IRC
classifiers =
Development Status :: 6 - Mature
Intended Audience :: Developers
Intended Audience :: System Administrators
License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy

[options]
py_modules = miniircd
entry_points = file: entry_points.txt

[options.extras_require]
dev =
mypy
pyflakes
pycodestyle
nose
twine
pep517
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import setuptools

setuptools.setup()

0 comments on commit 4f86554

Please sign in to comment.