Skip to main content

Requirements

  • Python 3.8+
  • Flit to put Python packages and modules on PyPI
  • Pydantic for the data parts.

Installation

pip install flit
pip install pyimporters-dummy

Publish the Python Package to PyPI

  • Increment the version of your package in the __init__.py file:
"""An amazing package!"""

__version__ = 'x.y.z'
  • Publish
flit publish

Write your own pyimporters plugin

  • Git clone the pyimporters_dummy project
git clone git@bitbucket.org:kairntech/pyimporters_dummy.git
  • Rename the project with your own format name <new_format>
mv pyimporters_dummy pyimporters_<new_format>
  • Delete the .git directory
rm -r -f pyimporters_<new_format>/.git
  • Change to the new pyimporters_<new_format> directory
cd pyimporters_<new_format>
  • Rename the package directory project
mv pyimporters_dummy pyimporters_<new_format>
  • Rename the python file implementation
mv pyimporters_<new_format>/dummy.py pyimporters_<new_format>/<new_format>.py
  • Rename the python tests file implementation
mv tests/test_dummy.py tests/test_<new_format>.py
  • Edit the pyproject.toml file to change a few lines and add your additional requirements
[tool.flit.metadata]
module = "pyimporters_<new_format>"
...
requires = [
    "pyimporters_plugins>=0.1.61",
    "additional_requirement1",
    "additional_requirement2",
    ...
    "additional_requirementN",
]
dist-name = "pyimporters-<new_format>"
...
[tool.flit.entrypoints."pyimporters.plugins"]
<new_format> = "pyimporters_<new_format>.<new_format>:NewFormatKnowledgeParser"
  • Write the implementation and test of your new format in python using your favorite IDE
@dataclass
class NewFormatOptions(KnowledgeParserOptions):
    """
    Options for the new format knowledge import
    """
    foo : str = Query("bar", description="Dummy parameter")

NewFormatOptionsModel = NewFormatOptions.__pydantic_model__

class NewFormatKnowledgeParser(KnowledgeParserBase):
    def parse(self, source : Path, options: Union[KnowledgeParserOptions, Dict[str, Any]], bar : Bar) -> Generator[Term, None, None]:
        options = NewFormatOptions(**options) if isinstance(options, dict) else options
        # Initialize the progress indicator number of terms to read so that the progress indicator can send feedback to the end user
        bar.max = 100 
        bar.start()
        # yield as many terms as you want, advancing the progress indicator each time
        bar.next()
        yield Term(identifier=options.foo, preferredForm=options.foo)
        # Terminate the progress indicator
        bar.finish()

    @classmethod
    def get_schema(cls) -> KnowledgeParserOptions:
        return NewFormatOptions

    @classmethod
    def get_model(cls) -> Type[BaseModel]:
        return NewFormatOptionsModel

Metadata

Release files for pyimporters-dummy 0.1.306

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyimporters-dummy 0.1.306
File Size Uploaded
pyimporters-dummy-0.1.306.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyimporters-dummy 0.1.306
File Interpreter ABI Platform
pyimporters_dummy-0.1.306-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / pyimporters-dummy-0.1.306.tar.gz

Download URL pyimporters-dummy-0.1.306.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ee7bffc0fed21676843a973e0ce15f7a3fa275dcc1def2e581f7e8b0d1ef52b5
BLAKE2b-256 checksum
How to use checksums
1a99d9f71838f2be13e45f4f996d5277e1a2cfdb2ebfbf5f96daf51e3e566e09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Release files / pyimporters_dummy-0.1.306-py3-none-any.whl

Download URL pyimporters_dummy-0.1.306-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
427f492a3bd29371f85abf76545013de7e6c28e4a6db545f0bca8cf05967729c
BLAKE2b-256 checksum
How to use checksums
2c6156699cb1a41ddb6e22d248e1406cd1fb288668d260c47f0e193cff99ff39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Release history Release notifications | RSS feed

This release

0.1.306 This release

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page