Skip to content

Commit

Permalink
Merged the 5.0 changes (#130)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: David Brochart <[email protected]>
  • Loading branch information
agronholm and davidbrochart authored Dec 30, 2024
1 parent 759fe93 commit 9d22542
Show file tree
Hide file tree
Showing 65 changed files with 6,324 additions and 4,436 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Create packages
run: python -m build
- name: Archive packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
Expand All @@ -36,7 +36,7 @@ jobs:
id-token: write
steps:
- name: Retrieve packages
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
- name: Upload packages
uses: pypa/gh-action-pypi-publish@release/v1

Expand Down
29 changes: 23 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,38 @@ on:
pull_request:

jobs:
pyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-pyright
- name: Install dependencies
run: pip install -e . pyright
- name: Run pyright
run: pyright --verifytypes asphalt.core

test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.10"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]
include:
- os: macos-latest
python-version: "3.10"
python-version: "3.9"
- os: macos-latest
python-version: "3.12"
python-version: "3.13"
- os: windows-latest
python-version: "3.8"
python-version: "3.9"
- os: windows-latest
python-version: "3.12"
python-version: "3.13"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -32,7 +49,7 @@ jobs:
cache: pip
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: pip install .[test]
run: pip install -e .[test]
- name: Test with pytest
run: coverage run -m pytest -v
- name: Generate coverage report
Expand Down
19 changes: 15 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# * Run "pre-commit install".
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-toml
- id: check-yaml
Expand All @@ -16,14 +16,25 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.5
rev: v0.8.3
hooks:
- id: ruff
args: [--fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies: ["pytest"]
additional_dependencies:
- anyio
- click
- pytest
- types-PyYAML

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:target: https://asphalt.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

Asphalt is an asyncio_ based microframework for network oriented applications.
Asphalt is an asynchronous application microframework.

Its highlight features are:

Expand All @@ -18,8 +18,8 @@ Its highlight features are:
configuration
* A sophisticated signal system that lets you connect different services to create complex
event-driven interactions
* Supports uvloop_ and tokio_ as event loop policy providers (though YMMV with the last one)
* Elegant handling of blocking APIs through the use of thread pooling
* Built on top of AnyIO_ to work with both Trio_ and asyncio_
* Designed for `Structured Concurrency`_ from the ground up
* `Type hints`_ and `semantic versioning`_ used throughout the core and all component libraries

Asphalt can be used to make any imaginable kind of networked application, ranging from trivial
Expand All @@ -34,8 +34,8 @@ with relatively little effort.

Full documentation: https://asphalt.readthedocs.io/

.. _Structured Concurrency: https://en.wikipedia.org/wiki/Structured_concurrency
.. _asyncio: https://docs.python.org/3/library/asyncio.html
.. _uvloop: https://github.com/MagicStack/uvloop
.. _tokio: https://github.com/PyO3/tokio
.. _Trio: https://github.com/python-trio/trio
.. _Type hints: https://www.python.org/dev/peps/pep-0484/
.. _semantic versioning: http://semver.org/
1 change: 1 addition & 0 deletions docs/acknowledgements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Acknowledgements
Many thanks to following people for the time spent helping with Asphalt's development:

* Alice Bevan-McGregor (brainstorming and documentation QA)
* David Brochart (brainstorming and practical testing on Asphalt 5)
* Guillaume "Cman" Brun (brainstorming)
* Darin Gordon (brainstorming and documentation QA)
* Antti Haapala (brainstorming)
Expand Down
63 changes: 63 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
API reference
=============

.. py:currentmodule:: asphalt.core
Components
----------

.. autoclass:: Component
.. autoclass:: CLIApplicationComponent
.. autofunction:: start_component
.. autoexception:: ComponentStartError

Concurrency
-----------

.. autofunction:: start_background_task_factory
.. autofunction:: start_service_task
.. autoclass:: TaskFactory
.. autoclass:: TaskHandle

Contexts and resources
----------------------

.. autoclass:: Context
.. autoclass:: ResourceEvent
.. autofunction:: current_context
.. autofunction:: context_teardown
.. autofunction:: add_resource
.. autofunction:: add_resource_factory
.. autofunction:: add_teardown_callback
.. autofunction:: get_resource
.. autofunction:: get_resource_nowait
.. autofunction:: inject
.. autofunction:: resource
.. autoexception:: AsyncResourceError
.. autoexception:: NoCurrentContext
.. autoexception:: ResourceConflict
.. autoexception:: ResourceNotFound

Events
------

.. autoclass:: Event
.. autoclass:: Signal
.. autoclass:: SignalQueueFull
.. autofunction:: stream_events
.. autofunction:: wait_event
.. autoexception:: UnboundSignal

Application runner
------------------

.. autofunction:: run_application

Utilities
---------

.. autoclass:: PluginContainer
.. autofunction:: callable_name
.. autofunction:: merge_config
.. autofunction:: qualified_name
.. autofunction:: resolve_reference
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx_autodoc_typehints",
"sphinx_rtd_theme",
]

templates_path = ["_templates"]
Expand All @@ -24,16 +25,15 @@

exclude_patterns = ["_build"]
pygments_style = "sphinx"
autodoc_default_options = {"members": True, "show-inheritance": True}
highlight_language = "python3"
todo_include_todos = False

html_theme = "sphinx_rtd_theme"
htmlhelp_basename = "asphaltdoc"

intersphinx_mapping = {
"anyio": ("https://anyio.readthedocs.io/en/stable/", None),
"asphalt-mailer": ("https://asphalt-mailer.readthedocs.io/en/stable/", None),
"python": ("https://docs.python.org/3/", None),
"asphalt-mailer": (
"https://asphalt.readthedocs.io/projects/mailer/en/latest/",
None,
),
}
3 changes: 1 addition & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Table of contents

tutorials/index
userguide/index
api
versionhistory
acknowledgements

* :ref:`API reference <modindex>`
5 changes: 0 additions & 5 deletions docs/modules/component.rst

This file was deleted.

5 changes: 0 additions & 5 deletions docs/modules/context.rst

This file was deleted.

5 changes: 0 additions & 5 deletions docs/modules/event.rst

This file was deleted.

5 changes: 0 additions & 5 deletions docs/modules/runner.rst

This file was deleted.

5 changes: 0 additions & 5 deletions docs/modules/utils.rst

This file was deleted.

Loading

0 comments on commit 9d22542

Please sign in to comment.