Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyElaina committed Jun 24, 2022
2 parents 5ad10ed + fb37c19 commit b43993a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
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 }}
19 changes: 19 additions & 0 deletions creart/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,45 @@

@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 b43993a

Please sign in to comment.