Skip to content

Commit

Permalink
Version cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
smurfix committed Jul 18, 2024
1 parent 2d5a80c commit fd86b3e
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 57 deletions.
1 change: 0 additions & 1 deletion asyncping3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from . import errors
from .enums import ICMP_DEFAULT_CODE, IcmpType, IcmpTimeExceededCode, IcmpDestinationUnreachableCode

__version__ = "4.0.8"
DEBUG = False # DEBUG: Show debug info for developers. (default False)
EXCEPTIONS = False # EXCEPTIONS: Raise exception when delay is not available.
LOGGER = None # LOGGER: Record logs into console or file. Logger object should have .debug() method.
Expand Down
43 changes: 0 additions & 43 deletions asyncping3/_main.py

This file was deleted.

1 change: 0 additions & 1 deletion asyncping3/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def main(assigned_args = None) -> None:
Formatted ping results printed.
"""
parser = argparse.ArgumentParser(prog="pping", description="A pure python3 version of ICMP ping implementation using raw socket.", epilog="!!Note: ICMP messages can only be sent from processes running as root.")
parser.add_argument("-v", "--version", action="version", version=asyncping3.__version__)
parser.add_argument(dest="dest_addr", metavar="DEST_ADDR", nargs="*", default=("example.com", "8.8.8.8"), help="The destination address, can be an IP address or a domain name. Ex. 192.168.1.1/example.com.")
parser.add_argument("-c", "--count", dest="count", metavar="COUNT", type=int, default=4, help="How many pings should be sent. Default is 4.")
parser.add_argument("-t", "--timeout", dest="timeout", metavar="TIMEOUT", type=float, default=4, help="Time to wait for a response, in seconds. Default is 4.")
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=61.0.0", "wheel"]
requires = ["setuptools>=61.0.0", "wheel", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -40,8 +40,7 @@ ping3 = "asyncping3.command_line:main"
[tool.setuptools]
py-modules = ["asyncping3"]

[tool.setuptools.dynamic]
version = {attr = "asyncping3.__version__"}

[tool.setuptools.packages.find]
exclude = ["contrib", "docs", "tests"]

[tool.setuptools_scm]
4 changes: 1 addition & 3 deletions tests/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
stmt = "anyio.run(ping3.ping,'127.0.0.1')"

if __name__ == "__main__":
print(ping3.__version__)

setup = "import anyio, sys; sys.path.insert(0, '{}'); import asyncping3 as ping3; print('ping3 version:', ping3.__version__)".format(dev_dir)
setup = f"import anyio, sys; sys.path.insert(0, {dev_dir !r}); import asyncping3 as ping3"
for count in (1, 10, 100, 1000, 5000):
print("Testing `{stmt}` {num} times...".format(stmt=stmt, num=count))
duration = timeit.timeit(stmt, setup=setup, number=count)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from unittest.mock import patch

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from asyncping3 import _main as command_line # noqa: linter (pycodestyle) should not lint this line.
from asyncping3 import command_line # noqa: linter (pycodestyle) should not lint this line.
from asyncping3 import errors # noqa: linter (pycodestyle) should not lint this line.
import asyncping3 as ping3

Expand Down
1 change: 0 additions & 1 deletion tests/test_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import asyncping3 as ping3 # noqa: linter (pycodestyle) should not lint this line.


# print("ping3=", ping3.__version__)
# ping3.DEBUG = True
HOSTS = ['baidu.com', 'example.com', '8.8.8.8', '1.1.1.1', '9.9.9.9', '127.0.0.1']

Expand Down
3 changes: 0 additions & 3 deletions tests/test_ping3.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
class TestPing3:
"""ping3 unittest"""

def test_version(self):
self.assertIsInstance(ping3.__version__, str)

@pytest.mark.anyio
async def test_ping_normal(self):
delay = await ping3.ping(DEST_DOMAIN)
Expand Down

0 comments on commit fd86b3e

Please sign in to comment.