Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-morel committed Jun 5, 2024
2 parents 3ef1f55 + 09a42dc commit 6a5dddf
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 3,261 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ lint:
test:
docker-compose run --rm dev pytest --cov --cov-report term-missing:skip-covered

test38:
docker-compose run --rm test38
test39:
docker-compose run --rm test39
test310:
docker-compose run --rm test310
test311:
docker-compose run --rm test311

test312:
docker-compose run --rm test312

ci: build lint test test311 test312
ci: build lint test test38 test39 test310 test311 test312

sdist:
docker-compose run --rm dev python setup.py sdist
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
[![PyPI package](https://badge.fury.io/py/pyoload.svg)](https://pypi.org/project/pyoload)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/pyoload)](https://pypi.org/project/pyoload)
[![Build Status](https://github.com/ken-morel/pyoload/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/ken-morel/pyoload/tree/mai)
[![Coverage Status](https://coveralls.io/repos/github/ken-morel/pyoload/badge.svg?branch=main)](https://coveralls.io/github/ken-morel/pyoload?branch=main)
[![Coverage Status](https://coveralls.io/repos/github/ken-morel/pyoload/badge.svg?branch=main&cache=3000)](https://coveralls.io/github/ken-morel/pyoload?branch=main)
[![Documentation Status](https://readthedocs.org/projects/pyoload/badge/?version=latest)](https://pyoload.readthedocs.io)
[![Pypi downloads](https://img.shields.io/pypi/dd/pyoload)](https://pypi.org/project/pyoload)
[![Pypi downloads](https://img.shields.io/pypi/dw/pyoload)](https://pypi.org/project/pyoload)

# pyoload

Expand Down Expand Up @@ -58,9 +59,9 @@ class Person:
self.name = name


djamago = Person(15, 'djamago') # {'age': <class 'int'>, 'name': <class 'str'>}
djamago = Person(15, 'djamago')

print(djamago.__annotations__)
print(djamago.__annotations__) # {'age': <class 'int'>}
```

## `pyoload.overload`
Expand All @@ -69,16 +70,16 @@ When decorating a function it:
- annotates the function with the special kwarg `is_overload=True`
- gets the function's name using `pyoload.get_name` and if needed
creates a new dictionarry value in
`pyoload.__overloads__[name]` where it stores all overloads and stores a copy in
`pyoload.__overloads__[name]` where it stores all ~~overloads~~dispatches and stores a copy in
the function's `.__pyod_overloads__` attribute.

And on each call it simply loops through each function entry, while
it catches a `pyoload.InternalAnnotationError` which is raised when
the special `is_overload` is set to true

> [!TIP]
> you may raise `pyoload.InternalAnnotationError` inside an overloaded
function after carrying out some other checks and pyoload will switch to the
> you may raise `pyoload.InternalAnnotationError` inside ~~an overloaded
function~~a multimethod after carrying out some other checks and pyoload will switch to the
next oveload.

```python
Expand All @@ -95,10 +96,6 @@ def foo_hello(d: dict[str, list[int]]):
...
```

> [!TIP]
> you may raise `pyoload.InternalAnnotationError` inside an overloaded
function after carrying out some other checks and pyoload will switch to the
next oveload.

## type checking with `pyoload.typeMatch(val, type)`

Expand Down
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,31 @@ services:
- ./src:/src
- ./README.rst:/src/README.rst
- ./LICENSE:/src/LICENSE

test38:
build:
context: .
dockerfile: dockerfiles/dev.dockerfile
args:
PYTHON_VERSION: '3.8'
command: pytest

test39:
build:
context: .
dockerfile: dockerfiles/dev.dockerfile
args:
PYTHON_VERSION: '3.9'
command: pytest

test310:
build:
context: .
dockerfile: dockerfiles/dev.dockerfile
args:
PYTHON_VERSION: '3.10'
command: pytest

test311:
build:
context: .
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
copyright = '2024, ken-morel'
author = 'ken-morel'

release = '1.1.3'
version = '1.1.3'
release = '2.0.0'
version = '2.0.0'

# -- General configuration

Expand Down
7 changes: 5 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Welcome to pyoload's documentation!
Welcome to pyoload v|version| documentation!
===================================

.. image:: https://github.com/ken-morel/pyoload/actions/workflows/python-publish.yml/badge.svg
Expand All @@ -20,9 +20,12 @@ Welcome to pyoload's documentation!
.. image:: https://readthedocs.org/projects/pyoload/badge/?version=latest
:target: https://pyoload.readthedocs.io
:alt: Documentation Status
.. image::https://img.shields.io/pypi/dd/pyoload
.. image:: https://img.shields.io/pypi/dd/pyoload
:target: https://pypi.org/project/pyoload
:alt: Pypi downloads
.. image:: https://ken-morel-api.up.railway.app/counters/pyoload-docs/add.svg
:target: https://portfolio-ken-morel-projects.vercel.app/
:alt: Hit count


welcome to pyoloads documentation, a python module for typechecking and
Expand Down
Loading

0 comments on commit 6a5dddf

Please sign in to comment.