Skip to content

Commit 462bd42

Browse files
committed
housekeeping
1 parent 8764ea9 commit 462bd42

6 files changed

Lines changed: 9 additions & 36 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MILC - An Opinionated Batteries-Included Python 3 CLI Framework
22

3-
MILC is a framework for writing CLI applications in Python 3.8+. It gives you
3+
MILC is a framework for writing CLI applications in Python 3.9+. It gives you
44
all the features users expect from a modern CLI tool out of the box:
55

66
* CLI Argument Parsing, with or without subcommands

docs/breaking_changes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
This is a list of breaking changes that have been made to MILC. If your script stops working after a minor or major version upgrade this document will tell you how to fix it.
44

55
# Version 2.0.0
6-
76
* `cli.config_source` now returns `'env_var'` for arguments whose value came from an environment variable via `env_prefix`. Previously only `'argument'`, `'config_file'`, and `None` were possible values. Code that exhaustively checks `config_source` values will need to handle `'env_var'`.
87
* `cli.args_passed` has been removed from the public API. Use `cli.config_source` to determine where a value came from.
98
* `cli.milc_options()` now uses `is not None` checks for all parameters. Previously, passing a falsy value (e.g. `name=''`) would silently fall back to the previously set value. Now it is applied as-is.
9+
* The context manager code (with cli: aka `__enter__`/`__exit__`) has been removed. It added unnecessary complexity.
10+
* Removed support for `set_metadata()` and the `MILC_APP_NAME`, `MILC_APP_VERSION`, and `MILC_APP_AUTHOR` environment vars
1011

1112
# Version 1.9.0
1213
* Appdirs [has been deprecated](https://github.com/ActiveState/appdirs/issues/79#issuecomment-877645712) and replaced with [platformdirs](https://github.com/tox-dev/platformdirs).

docs/threading.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Thread Safety
22

3-
MILC provides a locking mechanism you can interact with for thread safety. It will acquire and release that lock when changing any objects in memory. You can utilize this same mechanism in your own programs as needed. Under the hood it uses an [RLock object](https://docs.python.org/3.8/library/threading.html#rlock-objects) to do the locking.
3+
MILC provides a locking mechanism you can interact with for thread safety. It will acquire and release that lock when changing any objects in memory. You can utilize this same mechanism in your own programs as needed. Under the hood it uses an [RLock object](https://docs.python.org/3.9/library/threading.html#rlock-objects) to do the locking.
44

55
## Acquire
66

milc/__init__.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,7 @@
2424
from .milc import MILC
2525
from .milc_interface import MILCInterface
2626

27-
if 'MILC_IGNORE_DEPRECATED' not in os.environ:
28-
for name in ('MILC_APP_NAME', 'MILC_APP_VERSION', 'MILC_APP_AUTHOR'):
29-
if name in os.environ:
30-
warnings.warn(f'Using environment variable {name} is deprecated and will not be supported in the future, please use cli.milc_options() instead.', stacklevel=2)
31-
3227
cli = MILCInterface()
3328

34-
35-
def set_metadata(
36-
*,
37-
name: Optional[str] = None,
38-
author: Optional[str] = None,
39-
version: Optional[str] = None,
40-
logger: Optional[logging.Logger] = None,
41-
) -> MILCInterface:
42-
"""Set metadata about your program.
43-
44-
Deprecated: Use `cli.milc_options()` instead.
45-
46-
This allows you to set the application's name, version, and/or author
47-
before executing your entrypoint. You can also pass your own logger here
48-
if you like.
49-
50-
It's best to run this only once, and it must be run before you call `cli()`.
51-
"""
52-
warnings.warn("milc.set_metadata has been deprecated, please use cli.milc_options() instead.", stacklevel=2)
53-
cli.milc_options(name=name, author=author, version=version, logger=logger)
54-
55-
return cli
56-
57-
5829
# Extra stuff people can import
5930
from ._sparkline import sparkline # noqa

milc/milc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ def __init__(self, name: Optional[str] = None, author: Optional[str] = None, ver
4141
"""
4242
# Set some defaults
4343
if not name:
44-
name = os.environ.get('MILC_APP_NAME') or self.argv_name()
44+
name = self.argv_name()
4545

4646
if not version:
47-
version = os.environ.get('MILC_APP_VERSION', 'unknown')
47+
version = 'unknown'
4848

4949
if not author:
50-
author = os.environ.get('MILC_APP_AUTHOR', name.upper())
50+
author = name.upper()
5151

5252
# Setup a lock for thread safety
5353
self._lock = threading.RLock()

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ classifiers = [
1919
"License :: OSI Approved :: MIT License",
2020
"Natural Language :: English",
2121
"Programming Language :: Python :: 3 :: Only",
22-
"Programming Language :: Python :: 3.8",
2322
"Programming Language :: Python :: 3.9",
2423
"Programming Language :: Python :: 3.10",
2524
"Programming Language :: Python :: 3.11",
2625
"Programming Language :: Python :: 3.12",
26+
"Programming Language :: Python :: 3.13",
27+
"Programming Language :: Python :: 3.14",
2728
"Topic :: Scientific/Engineering",
2829
"Topic :: Scientific/Engineering :: Human Machine Interfaces",
2930
"Topic :: Software Development",

0 commit comments

Comments
 (0)