Releases: treykeown/arguably
v1.3.0 - Add 3.12, drop 3.8, fixes
- Add support for Python 3.12
- Drop support for Python 3.8
- Remove dependency on
typing_extensions
- Update dependencies
- Fix missing
factory
argument insubtype()
- Fix
asyncio.get_event_loop()
deprecation warning
Full Changelog: v1.2.5...v1.3.0
v1.2.5 - More flexible [-o/--option] config
--option
s are now able to be configured four different ways:
[-o]
→-o
is the short name[--option]
→--option
is the long name[-o/--option]
→-o
is the short name,--option
is the long name (this can also be[--option/-o]
)[-o/]
→-o
is the short name, the default long name is removed.
Additionally, there are now warnings if this sort of format is incorrectly specified.
Full Changelog: v1.2.4...v1.2.5
v1.2.4 - Fix logging for command function calls
In addition to argparse
-related calls, function invocations for @arguably.command
are now also logged. This can be seen if using python3 -m arguably --debug your_script.py
, or if you set up logging in your script that utilizes arguably
.
This was intended behavior from the start, but was not implemented.
Full Changelog: v1.2.3...v1.2.4
v1.2.3 - Override option name
Allows long option names to be overriden - instead of writing the docstring as some_arg: [-s]
, write it as some_arg: [-s/--long-name]
Full Changelog: v1.2.2...v1.2.3
v1.2.2 - Fail faster on bad configs
arguably
will now fail much faster if a bad configuration is given to @arguably.command
. The validation logic was shifted around to fix some cases that caused arguably
to fail if invoked directly on a script via python3 -m arguably your_script.py
.
Full Changelog: v1.2.1...v1.2.2
v1.2.1 - Async support
This release adds support for decorating async
functions with @arguably.command
.
Full Changelog: v1.2.0...v1.2.1
v1.2.0 - Public Release
1.2.0 Release
v1.1.0 - Ability to run arbitrary files, added warnings, added debug logging
Files can now be run without any integration with arguably
. Simply call it like this: python3 -m arguably file_to_run.py
. You'll get a help message with all callable functions. This includes staticmethod
s and classmethod
s for classes in the file. As an example:
# test_script.py
def test(name: str, age: int) -> None:
"""
just a test
:param name: the name
:param age: the age
"""
print(f"name: {name}, age+1: {age + 1}")
class Foo:
def __init__(self, bar: int):
"""
foo!
:param bar: bar!
"""
print(f"{type(self).__name__} initialized with {bar}")
@staticmethod
def sm(name: str) -> None:
"""
staticmethod test func
:param name: the name
"""
print(f"{name}")
@classmethod
def cm(cls, name: str = "testname") -> None:
"""classmethod test func"""
print(f"{cls}, {name}")
def normal(self, foo: int) -> None:
"""a normal method, should not appear"""
print(f"{self}, foo+1: {foo+1}")
Run it like this:
user@machine:~$ python3 -m arguably test_script.py
usage: test_script [-h] command ...
positional arguments:
command
test just a test
foo foo!
foo.sm staticmethod test func
foo.cm classmethod test func
options:
-h, --help show this help message and exit
v1.0.2 - Python 3.8 support, tests with nox
Bump version to 1.0.2