Skip to content

Commit

Permalink
Remove setup.py command and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sloria committed Jan 17, 2024
1 parent 93e5830 commit d16f6b1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 88 deletions.
61 changes: 0 additions & 61 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ To use a config file:
Get command-line arguments using ``konch.parse_args()``. ``konch`` uses `docopt`_ for arguments parsing.



.. code-block:: python
import konch
Expand All @@ -403,66 +402,6 @@ You can also use shell objects directly:
my_shell = konch.AutoShell(context={"foo": 42}, banner="My foo shell")
my_shell.start()
Integrating with setuptools / ``python setup.py shell``
=======================================================

You can integrate konch into your setuptools-based project using
the following ``Command`` class.

.. code-block:: python
# setup.py
import shlex
from setuptools import Command
class Shell(Command):
user_options = [
("name=", "n", "Named config to use."),
("shell=", "s", "Shell to use."),
("file=", "f", "File path of konch config file to execute."),
]
def initialize_options(self):
self.name = None
self.shell = None
self.file = None
def finalize_options(self):
pass
def run(self):
import konch
argv = []
for each in ("name", "shell", "file"):
opt = getattr(self, each)
if opt:
argv.append(f"--{each}={opt}")
konch.main(argv)
setup(
# ...,
cmdclass={"shell": Shell}
)
You can now run:

.. code-block:: bash
$ python setup.py shell
You can also pass a string of arguments:


.. code-block:: bash
$ python setup.py shell -a "--shell ipy"
..
"Praise the Magic Conch!"
Expand Down
27 changes: 0 additions & 27 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,6 @@
PYTHON_REQUIRES = ">=3.8"


class Shell(Command):
user_options = [
("name=", "n", "Named config to use."),
("shell=", "s", "Shell to use."),
("file=", "f", "File path of konch config file to execute."),
]

def initialize_options(self):
self.name = None
self.shell = None
self.file = None

def finalize_options(self):
pass

def run(self):
import konch

argv = []
for each in ("name", "shell", "file"):
opt = getattr(self, each)
if opt:
argv.append(f"--{each}={opt}")
konch.main(argv)


def find_version(fname):
"""Attempts to find the version number in the file names fname.
Raises RuntimeError if not found.
Expand Down Expand Up @@ -82,7 +56,6 @@ def read(fname):
author_email="sloria1@gmail.com",
url="https://github.com/sloria/konch",
install_requires=[],
cmdclass={"shell": Shell},
extras_require=EXTRAS_REQUIRE,
python_requires=PYTHON_REQUIRES,
license="MIT",
Expand Down

0 comments on commit d16f6b1

Please sign in to comment.