Skip to content

Commit

Permalink
improve docstrings and add py.typed
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueGlassBlock committed Jun 24, 2022
1 parent 39d8174 commit fb37c19
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Python package
on:
push:
tags:
- "v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
name: Ensure Python Runtime
with:
python-version: '3.x'
architecture: 'x64'
- name: Ensure PDM & twine
run: |
python3 -m pip install pdm twine
- name: Build Package
run: |
pdm build
- name: Publish to PyPI
run: |
twine upload dist/* --non-interactive -u __token__ -p ${{ secrets.PYPI_TOKEN }}
22 changes: 21 additions & 1 deletion creart/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,44 @@

@dataclass
class CreateTargetInfo:
"""Information of create target."""

module: str
"""dotted name of target's module"""

identify: str

"""target's qualified name"""

# info for cli
humanized_name: str | None = None
"""humanized name"""

description: str | None = None
"""description of target"""

author: list[str] | None = None
"""list of authors"""


T = TypeVar("T")


class AbstractCreator(metaclass=ABCMeta):
"""factory of `targets` class attributes
add `entry points` in your distribution to support auto discovery.
"""

targets: ClassVar[tuple[CreateTargetInfo, ...]]
"""Supported targets' creation info, as a tuple."""

@staticmethod
def available() -> bool:
"""This function will be called to determine whether the targets could be created."""
return True

@staticmethod
@abstractmethod
def create(create_type: type[T]) -> T:
"""Actual creation implementation."""
...
Empty file added creart/py.typed
Empty file.

0 comments on commit fb37c19

Please sign in to comment.