Skip to content

Commit

Permalink
Merge pull request #166 from micheles/pyproject
Browse files Browse the repository at this point in the history
Replaced setup.py with pyproject.toml
  • Loading branch information
micheles authored Feb 22, 2025
2 parents 0a1832e + 24af8c8 commit c996292
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
python -m pip install -e .
- run: codespell --ignore-words-list="assertIn,ba,claus,vas" --quiet-level=2
- run: flake8 . --count --ignore=E122,E226,E265,E741,E742 --max-complexity=22 --max-line-length=124 --show-source --statistics
- run: python src/tests/test.py -v
- run: python tests/test.py -v
16 changes: 15 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@ HISTORY

## Unreleased

Dropped support for Python < 3.7 and added support for Python 3.11 and 3.12.
## 5.2.0 (2025-02-22)

Changed the build procedure to use pyproject.toml and moved the tests
outside of the generated wheel/tarball.

Added official support for Python 3.11, 3.12, 3.13 (thanks to Hugo van
Kemenade).

Dropped official support for Python < 3.8: the module is
expected to work on older Python versions, but I cannot test such
versions on GitHub actions, so I cannot claim that it is officially
supported.

Dafu Wu provided support for decorating partial functions, i.e.
functions wrapped by functools.partial.

## 5.1.1 (2022-01-07)

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2005-2018, Michele Simionato
Copyright (c) 2005-2025, Michele Simionato
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include README.rst LICENSE.txt CHANGES.md performance.sh documentation.pdf
recursive-include src/tests *.py
include src/decorator.py
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
md: src/tests/documentation.py
python $(S)/ms/tools/py2md.py src/tests/documentation.py docs
md: tests/documentation.py
python $(S)/ms/tools/py2md.py tests/documentation.py docs

upload: README.rst
rm -rf build/* dist/* && python setup.py sdist bdist_wheel && twine upload dist/*
rm -rf build/* dist/* && python -m build && twine upload --verbose dist/*
16 changes: 8 additions & 8 deletions docs/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
|Author | Michele Simionato|
|---|---|
|E-mail | michele.simionato@gmail.com|
|Version| 5.1.1 (2022-01-07)|
|Supports| Python 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13|
|Download page| https://pypi.org/project/decorator/5.1.1|
|Version| 5.2.0 (2025-02-22)|
|Supports| Python 3.7, 3.8, 3.9, 3.10, 3.11, 3.12|
|Download page| https://pypi.org/project/decorator/5.2.0|
|Installation| ``pip install decorator``|
|License | BSD license|

Expand Down Expand Up @@ -1042,7 +1042,7 @@ write code like the following:
```python
import time
import logging
from asyncio import get_event_loop, sleep, wait
from asyncio import run, sleep, wait
from decorator import decorator

@decorator
Expand All @@ -1061,7 +1061,7 @@ async def make_task(n):
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
tasks = [make_task(3), make_task(2), make_task(1)]
get_event_loop().run_until_complete(wait(tasks))
run(wait(tasks))
```

and you will get an output like this:
Expand Down Expand Up @@ -1090,7 +1090,7 @@ into regular functions, such as the following:
@decorator
def coro_to_func(coro, *args, **kw):
"Convert a coroutine into a function"
return get_event_loop().run_until_complete(coro(*args, **kw))
return run(coro(*args, **kw))
```

Notice the difference: the caller in ``log_start_stop`` was a coroutine
Expand Down Expand Up @@ -1663,7 +1663,7 @@ penalty in your specific use case is to measure it.

## LICENSE (2-clause BSD)

Copyright (c) 2005-2020, Michele Simionato
Copyright (c) 2005-2025, Michele Simionato
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -1692,4 +1692,4 @@ DAMAGE.

If you use this software and you are happy with it, consider sending me a
note, just to gratify my ego. On the other hand, if you use this software and
you are unhappy with it, send me a patch!
you are unhappy with it, send me a patch!
34 changes: 34 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "decorator"
authors = [
{name = "Michele Simionato", email = "michele.simionato@gmail.com"},
]
description = "Decorators for Humans"
readme = "README.rst"
dynamic = ["version"]
requires-python = ">=3.8"
keywords = ["decorators"]
license = {text = "BSD-2-Clause"}
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Software Development :: Libraries',
'Topic :: Utilities']

[tool.setuptools.dynamic]
version.attr = "decorator.__version__"
39 changes: 0 additions & 39 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/decorator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ######################### LICENSE ############################ #

# Copyright (c) 2005-2021, Michele Simionato
# Copyright (c) 2005-2025, Michele Simionato
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -41,7 +41,7 @@
from contextlib import _GeneratorContextManager
from inspect import getfullargspec, iscoroutinefunction, isgeneratorfunction

__version__ = '5.1.1'
__version__ = '5.2.0'

DEF = re.compile(r'\s*def\s*([_\w][_\w\d]*)\s*\(')
POS = inspect.Parameter.POSITIONAL_OR_KEYWORD
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/tests/documentation.py → tests/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ def f():
## LICENSE (2-clause BSD)
Copyright (c) 2005-2020, Michele Simionato
Copyright (c) 2005-2025, Michele Simionato
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down
File renamed without changes.

0 comments on commit c996292

Please sign in to comment.