diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 0000000..76cad04 --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -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 }} \ No newline at end of file diff --git a/creart/creator.py b/creart/creator.py index 7b972c2..05b5011 100644 --- a/creart/creator.py +++ b/creart/creator.py @@ -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.""" ... diff --git a/creart/py.typed b/creart/py.typed new file mode 100644 index 0000000..e69de29