diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2cd8629..ebff1e6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @afparsons @Hironsan +* @Hironsan diff --git a/.github/workflows/mkdocs-deployment.yml b/.github/workflows/mkdocs-deployment.yml new file mode 100644 index 0000000..38fe823 --- /dev/null +++ b/.github/workflows/mkdocs-deployment.yml @@ -0,0 +1,19 @@ +name: Publish docs via GitHub Pages +on: + push: + branches: + - master + +jobs: + build: + name: Deploy docs + runs-on: ubuntu-latest + steps: + - name: Checkout main + uses: actions/checkout@v2 + - name: Deploy docs + uses: mhausenblas/mkdocs-deploy-gh-pages@1.16 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CONFIG_FILE: docs/mkdocs.yml + REQUIREMENTS: docs/requirements.txt diff --git a/README.md b/README.md index c612d5f..a0759b3 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ pip install doccano-client - All methods return a `requests.models.Response` object. ```python -from doccano_api_client import DoccanoClient +from doccano_client import DoccanoClient # instantiate a client and log in to a Doccano instance doccano_client = DoccanoClient( - 'http://doccano.example.com', - 'username', - 'password' + 'http://doccano.example.com', + 'username', + 'password' ) # get basic information about the authorized user @@ -93,4 +93,4 @@ Endpoint Names: We're introducing a newly revamped Doccano API Client that features more Pythonic interaction as well as more testing and documentation. It also adds more regulated compatibility with specific Doccano release versions. -You can find the documentation on usage of the beta client [here](./doccano_api_client/beta/README.md). +You can find the documentation on usage of the beta client [here](doccano_client/beta/README.md). diff --git a/doccano_api_client/__init__.py b/doccano_client/__init__.py similarity index 100% rename from doccano_api_client/__init__.py rename to doccano_client/__init__.py diff --git a/doccano_api_client/beta/README.md b/doccano_client/beta/README.md similarity index 96% rename from doccano_api_client/beta/README.md rename to doccano_client/beta/README.md index d3b7358..e39cf5b 100644 --- a/doccano_api_client/beta/README.md +++ b/doccano_client/beta/README.md @@ -9,7 +9,7 @@ Currently tested for compatibility against Doccano v1.5.0-1.5.5. The client can be instatiated with a base URL referring to the target Doccano instance. Once instantiated, you can login using your Doccano username and password. ```python -from doccano_api_client.beta import DoccanoClient, controllers +from doccano_client.beta import DoccanoClient, controllers client = DoccanoClient("your_instance_url_here") client.login("my_username", "my_password") diff --git a/doccano_api_client/beta/__init__.py b/doccano_client/beta/__init__.py similarity index 100% rename from doccano_api_client/beta/__init__.py rename to doccano_client/beta/__init__.py diff --git a/doccano_api_client/beta/client.py b/doccano_client/beta/client.py similarity index 100% rename from doccano_api_client/beta/client.py rename to doccano_client/beta/client.py diff --git a/doccano_api_client/beta/controllers/__init__.py b/doccano_client/beta/controllers/__init__.py similarity index 100% rename from doccano_api_client/beta/controllers/__init__.py rename to doccano_client/beta/controllers/__init__.py diff --git a/doccano_api_client/beta/controllers/annotation.py b/doccano_client/beta/controllers/annotation.py similarity index 93% rename from doccano_api_client/beta/controllers/annotation.py rename to doccano_client/beta/controllers/annotation.py index 2b27110..7b2e4f2 100644 --- a/doccano_api_client/beta/controllers/annotation.py +++ b/doccano_client/beta/controllers/annotation.py @@ -43,7 +43,11 @@ def annotations_url(self) -> str: return f"{self._example_url}" def all(self) -> Iterable[AnnotationController]: - """Return a sequence of AnnotationControllers.""" + """Return a sequence of AnnotationControllers. + + Yields: + AnnotationController: The next annotation controller. + """ response = self.client_session.get(self.annotations_url) verbose_raise_for_status(response) annotation_dicts = response.json()["annotations"] diff --git a/doccano_api_client/beta/controllers/comment.py b/doccano_client/beta/controllers/comment.py similarity index 95% rename from doccano_api_client/beta/controllers/comment.py rename to doccano_client/beta/controllers/comment.py index d478bc1..4a073ac 100644 --- a/doccano_api_client/beta/controllers/comment.py +++ b/doccano_client/beta/controllers/comment.py @@ -51,7 +51,11 @@ def comments_url(self) -> str: return f"{self._parent_url}/comments" def all(self) -> Iterable[CommentController]: - """Return a sequence of Comments for a given controller, which maps to an object""" + """Return a sequence of Comments for a given controller, which maps to an object + + Yields: + CommentController: The next comment controller. + """ response = self.client_session.get(self.comments_url) verbose_raise_for_status(response) comment_dicts = response.json() diff --git a/doccano_api_client/beta/controllers/example.py b/doccano_client/beta/controllers/example.py similarity index 98% rename from doccano_api_client/beta/controllers/example.py rename to doccano_client/beta/controllers/example.py index 7066b43..679da1e 100644 --- a/doccano_api_client/beta/controllers/example.py +++ b/doccano_client/beta/controllers/example.py @@ -93,7 +93,11 @@ def get(self, example_id: int) -> ExampleController: ) def all(self, confirmed=None) -> Iterable[ExampleController]: - """Return a sequence of Examples for a given controller, which maps to a Project""" + """Return a sequence of Examples for a given controller, which maps to a Project + + Yields: + ExampleController: The next example controller. + """ response = self.client_session.get(f"{self.examples_url}?confirmed={confirmed}") while True: diff --git a/doccano_api_client/beta/controllers/label.py b/doccano_client/beta/controllers/label.py similarity index 98% rename from doccano_api_client/beta/controllers/label.py rename to doccano_client/beta/controllers/label.py index 6cafafe..d557ec7 100644 --- a/doccano_api_client/beta/controllers/label.py +++ b/doccano_client/beta/controllers/label.py @@ -122,7 +122,11 @@ def labels_url(self) -> str: return f"{self._project_url}/labels" def all(self) -> Iterable[LabelController]: - """Return a sequence of all labels for a given controller, which maps to a project""" + """Return a sequence of all labels for a given controller, which maps to a project + + Yields: + LabelController: The next label controller. + """ response = self.client_session.get(self.labels_url) verbose_raise_for_status(response) label_dicts = response.json() diff --git a/doccano_api_client/beta/controllers/project.py b/doccano_client/beta/controllers/project.py similarity index 96% rename from doccano_api_client/beta/controllers/project.py rename to doccano_client/beta/controllers/project.py index 17995b8..9fa3cf9 100644 --- a/doccano_api_client/beta/controllers/project.py +++ b/doccano_client/beta/controllers/project.py @@ -57,7 +57,11 @@ def relation_types(self) -> RelationTypesController: return RelationTypesController(self.project_url, self.client_session) def download(self, api_url: str, only_approved: bool = True) -> Iterable[Any]: - """Trigger a download of all approved and labelled texts in jsonl format. It's zipped""" + """Trigger a download of all approved and labelled texts in jsonl format. It's zipped + + Yields: + binary: The binary data. + """ download_json = {"exportApproved": only_approved, "format": "JSONL"} responseCreateExportTask = self.client_session.post( @@ -114,7 +118,11 @@ def get(self, project_id: int) -> ProjectController: ) def all(self) -> Iterable[ProjectController]: - """Return a sequence of projects for a given controller, assigned to the user""" + """Return a sequence of projects for a given controller, assigned to the user + + Yields: + ProjectController: The next project controller. + """ response = self.client_session.get(self.projects_url) while True: diff --git a/doccano_api_client/beta/controllers/relation.py b/doccano_client/beta/controllers/relation.py similarity index 93% rename from doccano_api_client/beta/controllers/relation.py rename to doccano_client/beta/controllers/relation.py index e11953b..4e6508f 100644 --- a/doccano_api_client/beta/controllers/relation.py +++ b/doccano_client/beta/controllers/relation.py @@ -42,7 +42,11 @@ def relations_url(self) -> str: return f"{self._example_url}/relations" def all(self) -> Iterable[RelationController]: - """Return a sequence of RelationControllers.""" + """Return a sequence of RelationControllers. + + Yields: + RelationController: The next relation controller. + """ response = self.client_session.get(self.relations_url) verbose_raise_for_status(response) diff --git a/doccano_api_client/beta/controllers/relation_type.py b/doccano_client/beta/controllers/relation_type.py similarity index 96% rename from doccano_api_client/beta/controllers/relation_type.py rename to doccano_client/beta/controllers/relation_type.py index 8630918..71cd853 100644 --- a/doccano_api_client/beta/controllers/relation_type.py +++ b/doccano_client/beta/controllers/relation_type.py @@ -38,7 +38,11 @@ def relation_types_url(self) -> str: return f"{self._project_url}/relation-types" def all(self) -> Iterable[RelationTypeController]: - """Return a sequence of all span-types for a given controller, which maps to a project""" + """Return a sequence of all span-types for a given controller, which maps to a project + + Yields: + RelationTypeController: The next relation type controller. + """ response = self.client_session.get(self.relation_types_url) verbose_raise_for_status(response) label_dicts = response.json() diff --git a/doccano_api_client/beta/controllers/span.py b/doccano_client/beta/controllers/span.py similarity index 95% rename from doccano_api_client/beta/controllers/span.py rename to doccano_client/beta/controllers/span.py index 32cc3a1..3cee1b2 100644 --- a/doccano_api_client/beta/controllers/span.py +++ b/doccano_client/beta/controllers/span.py @@ -42,7 +42,11 @@ def spans_url(self) -> str: return f"{self._example_url}/spans" def all(self) -> Iterable[SpanController]: - """Return a sequence of SpanControllers.""" + """Return a sequence of SpanControllers. + + Yields: + SpanController: The next span controller. + """ response = self.client_session.get(self.spans_url) verbose_raise_for_status(response) span_dicts = response.json() diff --git a/doccano_api_client/beta/controllers/span_type.py b/doccano_client/beta/controllers/span_type.py similarity index 96% rename from doccano_api_client/beta/controllers/span_type.py rename to doccano_client/beta/controllers/span_type.py index ab564b8..73c5962 100644 --- a/doccano_api_client/beta/controllers/span_type.py +++ b/doccano_client/beta/controllers/span_type.py @@ -38,7 +38,11 @@ def span_types_url(self) -> str: return f"{self._project_url}/span-types" def all(self) -> Iterable[SpanTypeController]: - """Return a sequence of all span-types for a given controller, which maps to a project""" + """Return a sequence of all span-types for a given controller, which maps to a project + + Yields: + SpanTypeController: The next span type controller. + """ response = self.client_session.get(self.span_types_url) verbose_raise_for_status(response) label_dicts = response.json() diff --git a/doccano_api_client/beta/models/__init__.py b/doccano_client/beta/models/__init__.py similarity index 100% rename from doccano_api_client/beta/models/__init__.py rename to doccano_client/beta/models/__init__.py diff --git a/doccano_api_client/beta/models/annotations.py b/doccano_client/beta/models/annotations.py similarity index 100% rename from doccano_api_client/beta/models/annotations.py rename to doccano_client/beta/models/annotations.py diff --git a/doccano_api_client/beta/models/comments.py b/doccano_client/beta/models/comments.py similarity index 100% rename from doccano_api_client/beta/models/comments.py rename to doccano_client/beta/models/comments.py diff --git a/doccano_api_client/beta/models/examples.py b/doccano_client/beta/models/examples.py similarity index 100% rename from doccano_api_client/beta/models/examples.py rename to doccano_client/beta/models/examples.py diff --git a/doccano_api_client/beta/models/labels.py b/doccano_client/beta/models/labels.py similarity index 100% rename from doccano_api_client/beta/models/labels.py rename to doccano_client/beta/models/labels.py diff --git a/doccano_api_client/beta/models/projects.py b/doccano_client/beta/models/projects.py similarity index 93% rename from doccano_api_client/beta/models/projects.py rename to doccano_client/beta/models/projects.py index 19e9b66..1cb43aa 100644 --- a/doccano_api_client/beta/models/projects.py +++ b/doccano_client/beta/models/projects.py @@ -51,7 +51,11 @@ class Project(DataClassJsonMixin): use_relation: bool = False def __post_init__(self) -> None: - """Propogates resourcetype field based on project_type field, needed for project creation""" + """Propogates resourcetype field based on project_type field, needed for project creation + + Raises: + AssertionError: If project type is not in resource types. + """ if self.project_type not in PROJECT_TO_RESOURCE_TYPE: raise AssertionError(f"project_type not in: {PROJECT_TO_RESOURCE_TYPE.keys()}") self.resourcetype = PROJECT_TO_RESOURCE_TYPE.get(self.project_type, "NotAResource") diff --git a/doccano_api_client/beta/models/relation.py b/doccano_client/beta/models/relation.py similarity index 100% rename from doccano_api_client/beta/models/relation.py rename to doccano_client/beta/models/relation.py diff --git a/doccano_api_client/beta/models/relation_type.py b/doccano_client/beta/models/relation_type.py similarity index 100% rename from doccano_api_client/beta/models/relation_type.py rename to doccano_client/beta/models/relation_type.py diff --git a/doccano_api_client/beta/models/span.py b/doccano_client/beta/models/span.py similarity index 100% rename from doccano_api_client/beta/models/span.py rename to doccano_client/beta/models/span.py diff --git a/doccano_api_client/beta/models/span_type.py b/doccano_client/beta/models/span_type.py similarity index 100% rename from doccano_api_client/beta/models/span_type.py rename to doccano_client/beta/models/span_type.py diff --git a/doccano_api_client/beta/py.typed b/doccano_client/beta/py.typed similarity index 100% rename from doccano_api_client/beta/py.typed rename to doccano_client/beta/py.typed diff --git a/doccano_api_client/beta/tests/__init__.py b/doccano_client/beta/tests/__init__.py similarity index 100% rename from doccano_api_client/beta/tests/__init__.py rename to doccano_client/beta/tests/__init__.py diff --git a/doccano_api_client/beta/tests/conftest.py b/doccano_client/beta/tests/conftest.py similarity index 100% rename from doccano_api_client/beta/tests/conftest.py rename to doccano_client/beta/tests/conftest.py diff --git a/doccano_api_client/beta/tests/controllers/__init__.py b/doccano_client/beta/tests/controllers/__init__.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/__init__.py rename to doccano_client/beta/tests/controllers/__init__.py diff --git a/doccano_api_client/beta/tests/controllers/mock_api_responses/__init__.py b/doccano_client/beta/tests/controllers/mock_api_responses/__init__.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/mock_api_responses/__init__.py rename to doccano_client/beta/tests/controllers/mock_api_responses/__init__.py diff --git a/doccano_api_client/beta/tests/controllers/mock_api_responses/annotations.py b/doccano_client/beta/tests/controllers/mock_api_responses/annotations.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/mock_api_responses/annotations.py rename to doccano_client/beta/tests/controllers/mock_api_responses/annotations.py diff --git a/doccano_api_client/beta/tests/controllers/mock_api_responses/bad.py b/doccano_client/beta/tests/controllers/mock_api_responses/bad.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/mock_api_responses/bad.py rename to doccano_client/beta/tests/controllers/mock_api_responses/bad.py diff --git a/doccano_api_client/beta/tests/controllers/mock_api_responses/comments.py b/doccano_client/beta/tests/controllers/mock_api_responses/comments.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/mock_api_responses/comments.py rename to doccano_client/beta/tests/controllers/mock_api_responses/comments.py diff --git a/doccano_api_client/beta/tests/controllers/mock_api_responses/examples.py b/doccano_client/beta/tests/controllers/mock_api_responses/examples.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/mock_api_responses/examples.py rename to doccano_client/beta/tests/controllers/mock_api_responses/examples.py diff --git a/doccano_api_client/beta/tests/controllers/mock_api_responses/labels.py b/doccano_client/beta/tests/controllers/mock_api_responses/labels.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/mock_api_responses/labels.py rename to doccano_client/beta/tests/controllers/mock_api_responses/labels.py diff --git a/doccano_api_client/beta/tests/controllers/mock_api_responses/projects.py b/doccano_client/beta/tests/controllers/mock_api_responses/projects.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/mock_api_responses/projects.py rename to doccano_client/beta/tests/controllers/mock_api_responses/projects.py diff --git a/doccano_api_client/beta/tests/controllers/test_annotation.py b/doccano_client/beta/tests/controllers/test_annotation.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/test_annotation.py rename to doccano_client/beta/tests/controllers/test_annotation.py diff --git a/doccano_api_client/beta/tests/controllers/test_comment.py b/doccano_client/beta/tests/controllers/test_comment.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/test_comment.py rename to doccano_client/beta/tests/controllers/test_comment.py diff --git a/doccano_api_client/beta/tests/controllers/test_example.py b/doccano_client/beta/tests/controllers/test_example.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/test_example.py rename to doccano_client/beta/tests/controllers/test_example.py diff --git a/doccano_api_client/beta/tests/controllers/test_label.py b/doccano_client/beta/tests/controllers/test_label.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/test_label.py rename to doccano_client/beta/tests/controllers/test_label.py diff --git a/doccano_api_client/beta/tests/controllers/test_project.py b/doccano_client/beta/tests/controllers/test_project.py similarity index 100% rename from doccano_api_client/beta/tests/controllers/test_project.py rename to doccano_client/beta/tests/controllers/test_project.py diff --git a/doccano_api_client/beta/tests/test_client.py b/doccano_client/beta/tests/test_client.py similarity index 100% rename from doccano_api_client/beta/tests/test_client.py rename to doccano_client/beta/tests/test_client.py diff --git a/doccano_api_client/beta/tests/test_full_integration_tests.py b/doccano_client/beta/tests/test_full_integration_tests.py similarity index 100% rename from doccano_api_client/beta/tests/test_full_integration_tests.py rename to doccano_client/beta/tests/test_full_integration_tests.py diff --git a/doccano_api_client/beta/tests/utils/__init__.py b/doccano_client/beta/tests/utils/__init__.py similarity index 100% rename from doccano_api_client/beta/tests/utils/__init__.py rename to doccano_client/beta/tests/utils/__init__.py diff --git a/doccano_api_client/beta/tests/utils/test_response.py b/doccano_client/beta/tests/utils/test_response.py similarity index 100% rename from doccano_api_client/beta/tests/utils/test_response.py rename to doccano_client/beta/tests/utils/test_response.py diff --git a/doccano_api_client/beta/utils/__init__.py b/doccano_client/beta/utils/__init__.py similarity index 100% rename from doccano_api_client/beta/utils/__init__.py rename to doccano_client/beta/utils/__init__.py diff --git a/doccano_api_client/beta/utils/response.py b/doccano_client/beta/utils/response.py similarity index 74% rename from doccano_api_client/beta/utils/response.py rename to doccano_client/beta/utils/response.py index 2b3687a..4e7002a 100644 --- a/doccano_api_client/beta/utils/response.py +++ b/doccano_client/beta/utils/response.py @@ -7,8 +7,12 @@ def __init__(self, response: Response): super().__init__(str(response.json()), response=response) -def verbose_raise_for_status(response: Response) -> None: - """Output a bad response's text before raising for verbosity, return response otherwise""" +def verbose_raise_for_status(response: Response) -> Response: + """Output a bad response's text before raising for verbosity, return response otherwise + + Raises: + DoccanoAPIError: if request raises HTTPError. + """ try: response.raise_for_status() except exceptions.HTTPError as err: diff --git a/doccano_api_client/cli/__init__.py b/doccano_client/cli/__init__.py similarity index 100% rename from doccano_api_client/cli/__init__.py rename to doccano_client/cli/__init__.py diff --git a/doccano_api_client/cli/commands.py b/doccano_client/cli/commands.py similarity index 95% rename from doccano_api_client/cli/commands.py rename to doccano_client/cli/commands.py index 3120e6d..5dc1013 100644 --- a/doccano_api_client/cli/commands.py +++ b/doccano_client/cli/commands.py @@ -6,9 +6,9 @@ import sys from pathlib import Path -from doccano_api_client.beta import DoccanoClient -from doccano_api_client.cli.estimators import select_estimator_class -from doccano_api_client.cli.usecases import build_annotator +from doccano_client.beta import DoccanoClient +from doccano_client.cli.estimators import select_estimator_class +from doccano_client.cli.usecases import build_annotator DOCCANO_HOME = os.path.expanduser(os.environ.get("DOCCANO_HOME", "~/doccano")) Path(DOCCANO_HOME).mkdir(parents=True, exist_ok=True) diff --git a/doccano_api_client/cli/entity.py b/doccano_client/cli/entity.py similarity index 100% rename from doccano_api_client/cli/entity.py rename to doccano_client/cli/entity.py diff --git a/doccano_api_client/cli/estimators.py b/doccano_client/cli/estimators.py similarity index 92% rename from doccano_api_client/cli/estimators.py rename to doccano_client/cli/estimators.py index 2ace649..0a00be0 100644 --- a/doccano_api_client/cli/estimators.py +++ b/doccano_client/cli/estimators.py @@ -2,7 +2,7 @@ from typing import Iterator -from doccano_api_client.cli.entity import Entity +from doccano_client.cli.entity import Entity class SpaCyEntityEstimator: diff --git a/doccano_api_client/cli/usecases.py b/doccano_client/cli/usecases.py similarity index 93% rename from doccano_api_client/cli/usecases.py rename to doccano_client/cli/usecases.py index f2d81e5..e86fad8 100644 --- a/doccano_api_client/cli/usecases.py +++ b/doccano_client/cli/usecases.py @@ -6,9 +6,9 @@ from tqdm import tqdm -from doccano_api_client.beta.controllers import ProjectController -from doccano_api_client.beta.models import Span -from doccano_api_client.cli.entity import Entity +from doccano_client.beta.controllers import ProjectController +from doccano_client.beta.models import Span +from doccano_client.cli.entity import Entity def load_mapping(filepath: str, encoding="utf-8") -> dict[str, str]: diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..07dd0c5 --- /dev/null +++ b/docs/index.md @@ -0,0 +1 @@ +# Overview diff --git a/docs/install.md b/docs/install.md new file mode 100644 index 0000000..55af1c5 --- /dev/null +++ b/docs/install.md @@ -0,0 +1 @@ +# Install diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml new file mode 100644 index 0000000..e9755d6 --- /dev/null +++ b/docs/mkdocs.yml @@ -0,0 +1,35 @@ +# Project information +site_name: "doccano-client" +site_description: "A simple client wrapper for doccano API." +site_author: "Hiroki Nakayama" +site_url: "https://doccano.github.io/doccano-client/" +docs_dir: . + +# Repository +repo_name: "doccano/doccano-client" +repo_url: "https://github.com/doccano/doccano-client" + +# Copyright +copyright: "Copyright © 2018 - 2019 Hiroki Nakayama" + +theme: + name: "material" + palette: + primary: "cyan" + accent: "cyan" + show_sidebar: true + +extra: + social: + - icon: "fontawesome/brands/github" + link: "https://github.com/Hironsan" + - icon: "fontawesome/brands/twitter" + link: "https://twitter.com/Hironsan13" + +plugins: + - same-dir + +# Page tree +nav: + - Overview: index.md + - Install: install.md diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..fbee236 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1 @@ +mkdocs-same-dir diff --git a/poetry.lock b/poetry.lock index 0fd7f3a..80bad04 100644 --- a/poetry.lock +++ b/poetry.lock @@ -144,8 +144,8 @@ optional = true python-versions = ">=3.7" [package.extras] -testing = ["pytest-timeout (>=2.1)", "pytest-cov (>=3)", "pytest (>=7.1.2)", "coverage (>=6.4.2)", "covdefaults (>=2.2)"] -docs = ["sphinx-autodoc-typehints (>=1.19.1)", "sphinx (>=5.1.1)", "furo (>=2022.6.21)"] +docs = ["furo (>=2022.6.21)", "sphinx (>=5.1.1)", "sphinx-autodoc-typehints (>=1.19.1)"] +testing = ["covdefaults (>=2.2)", "coverage (>=6.4.2)", "pytest (>=7.1.2)", "pytest-cov (>=3)", "pytest-timeout (>=2.1)"] [[package]] name = "flake8" @@ -160,6 +160,20 @@ mccabe = ">=0.7.0,<0.8.0" pycodestyle = ">=2.9.0,<2.10.0" pyflakes = ">=2.5.0,<2.6.0" +[[package]] +name = "ghp-import" +version = "2.1.0" +description = "Copy your docs directly to the gh-pages branch." +category = "dev" +optional = false +python-versions = "*" + +[package.dependencies] +python-dateutil = ">=2.8.1" + +[package.extras] +dev = ["wheel", "flake8", "markdown", "twine"] + [[package]] name = "huggingface-hub" version = "0.9.1" @@ -193,6 +207,22 @@ category = "main" optional = false python-versions = ">=3.5" +[[package]] +name = "importlib-metadata" +version = "4.12.0" +description = "Read metadata from Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +zipp = ">=0.5" + +[package.extras] +testing = ["importlib-resources (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-black (>=0.3.7)", "pytest-perf (>=0.9.2)", "flufl.flake8", "pyfakefs", "packaging", "pytest-enabler (>=1.3)", "pytest-cov", "pytest-flake8", "pytest-checkdocs (>=2.4)", "pytest (>=6)"] +perf = ["ipython"] +docs = ["rst.linker (>=1.9)", "jaraco.packaging (>=9)", "sphinx"] + [[package]] name = "iniconfig" version = "1.1.1" @@ -220,7 +250,7 @@ name = "jinja2" version = "3.1.2" description = "A very fast and expressive template engine." category = "main" -optional = true +optional = false python-versions = ">=3.7" [package.dependencies] @@ -240,12 +270,26 @@ python-versions = ">=3.6" [package.extras] data = ["language-data (>=1.1,<2.0)"] +[[package]] +name = "markdown" +version = "3.3.7" +description = "Python implementation of Markdown." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +importlib-metadata = {version = ">=4.4", markers = "python_version < \"3.10\""} + +[package.extras] +testing = ["coverage", "pyyaml"] + [[package]] name = "markupsafe" version = "2.1.1" description = "Safely add untrusted strings to HTML/XML markup." category = "main" -optional = true +optional = false python-versions = ">=3.7" [[package]] @@ -284,6 +328,73 @@ category = "dev" optional = false python-versions = ">=3.6" +[[package]] +name = "mergedeep" +version = "1.3.4" +description = "A deep merge function for 🐍." +category = "dev" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "mkdocs" +version = "1.3.1" +description = "Project documentation with Markdown." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +click = ">=3.3" +ghp-import = ">=1.0" +importlib-metadata = ">=4.3" +Jinja2 = ">=2.10.2" +Markdown = ">=3.2.1,<3.4" +mergedeep = ">=1.3.4" +packaging = ">=20.5" +PyYAML = ">=3.10" +pyyaml-env-tag = ">=0.1" +watchdog = ">=2.0" + +[package.extras] +i18n = ["babel (>=2.9.0)"] + +[[package]] +name = "mkdocs-material" +version = "8.5.3" +description = "Documentation that simply works" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +jinja2 = ">=3.0.2" +markdown = ">=3.2" +mkdocs = ">=1.3.0" +mkdocs-material-extensions = ">=1.0.3" +pygments = ">=2.12" +pymdown-extensions = ">=9.4" +requests = ">=2.26" + +[[package]] +name = "mkdocs-material-extensions" +version = "1.0.3" +description = "Extension pack for Python Markdown." +category = "dev" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "mkdocs-same-dir" +version = "0.1.1" +description = "MkDocs plugin to allow placing mkdocs.yml in the same directory as documentation" +category = "dev" +optional = false +python-versions = ">=3.6,<4.0" + +[package.dependencies] +mkdocs = ">=1.0.3,<2.0.0" + [[package]] name = "mslex" version = "0.3.0" @@ -468,6 +579,28 @@ category = "dev" optional = false python-versions = ">=3.6" +[[package]] +name = "pygments" +version = "2.13.0" +description = "Pygments is a syntax highlighting package written in Python." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.extras] +plugins = ["importlib-metadata"] + +[[package]] +name = "pymdown-extensions" +version = "9.5" +description = "Extension pack for Python Markdown." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +markdown = ">=3.2" + [[package]] name = "pyparsing" version = "3.0.9" @@ -511,6 +644,17 @@ tomli = ">=1.0.0" [package.extras] testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] +[[package]] +name = "python-dateutil" +version = "2.8.2" +description = "Extensions to the standard Python datetime module" +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" + +[package.dependencies] +six = ">=1.5" + [[package]] name = "pytokenizations" version = "0.8.4" @@ -524,9 +668,20 @@ name = "pyyaml" version = "6.0" description = "YAML parser and emitter for Python" category = "main" -optional = true +optional = false python-versions = ">=3.6" +[[package]] +name = "pyyaml-env-tag" +version = "0.1" +description = "A custom YAML tag for referencing environment variables in YAML files. " +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +pyyaml = "*" + [[package]] name = "regex" version = "2022.9.13" @@ -568,6 +723,14 @@ urllib3 = ">=1.25.10" [package.extras] tests = ["pytest (>=7.0.0)", "coverage (>=6.0.0)", "pytest-cov", "pytest-asyncio", "pytest-localserver", "flake8", "types-mock", "types-requests", "mypy"] +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" + [[package]] name = "smart-open" version = "5.2.1" @@ -961,13 +1124,36 @@ category = "main" optional = true python-versions = "*" +[[package]] +name = "watchdog" +version = "2.1.9" +description = "Filesystem events monitoring" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.extras] +watchmedo = ["PyYAML (>=3.10)"] + +[[package]] +name = "zipp" +version = "3.8.1" +description = "Backport of pathlib-compatible object wrapper for zip files" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +testing = ["pytest-mypy (>=0.9.1)", "pytest-black (>=0.3.7)", "func-timeout", "jaraco.itertools", "pytest-enabler (>=1.3)", "pytest-cov", "pytest-flake8", "pytest-checkdocs (>=2.4)", "pytest (>=6)"] +docs = ["jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "jaraco.packaging (>=9)", "sphinx"] + [extras] spacy = ["spacy", "spacy-partial-tagger", "tqdm"] [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "c9ffbb7046541b94061450d9c6595af7ef16fbb9aebc1775e7c8132689a72210" +content-hash = "38b339e312e4c779bea6aadb237fa0f9f35a9dbadbd77776c6415a63a6479640" [metadata.files] attrs = [] @@ -1007,8 +1193,10 @@ darglint = [] dataclasses-json = [] filelock = [] flake8 = [] +ghp-import = [] huggingface-hub = [] idna = [] +importlib-metadata = [] iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, @@ -1025,6 +1213,7 @@ langcodes = [ {file = "langcodes-3.3.0-py3-none-any.whl", hash = "sha256:4d89fc9acb6e9c8fdef70bcdf376113a3db09b67285d9e1d534de6d8818e7e69"}, {file = "langcodes-3.3.0.tar.gz", hash = "sha256:794d07d5a28781231ac335a1561b8442f8648ca07cd518310aeb45d6f0807ef6"}, ] +markdown = [] markupsafe = [ {file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812"}, {file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a"}, @@ -1070,10 +1259,12 @@ markupsafe = [ marshmallow = [] marshmallow-enum = [] mccabe = [] -mslex = [ - {file = "mslex-0.3.0-py2.py3-none-any.whl", hash = "sha256:380cb14abf8fabf40e56df5c8b21a6d533dc5cbdcfe42406bbf08dda8f42e42a"}, - {file = "mslex-0.3.0.tar.gz", hash = "sha256:4a1ac3f25025cad78ad2fe499dd16d42759f7a3801645399cce5c404415daa97"}, -] +mergedeep = [] +mkdocs = [] +mkdocs-material = [] +mkdocs-material-extensions = [] +mkdocs-same-dir = [] +mslex = [] murmurhash = [] mypy = [] mypy-extensions = [ @@ -1105,17 +1296,28 @@ py = [ pycodestyle = [] pydantic = [] pyflakes = [] +pygments = [] +pymdown-extensions = [] pyparsing = [ {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, {file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"}, ] pyproject-flake8 = [] pytest = [] +python-dateutil = [ + {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, + {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, +] pytokenizations = [] pyyaml = [] +pyyaml-env-tag = [] regex = [] requests = [] responses = [] +six = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] smart-open = [ {file = "smart_open-5.2.1-py3-none-any.whl", hash = "sha256:71d14489da58b60ce12fc3ecb823facc59a8b23cd1b58edb97175640350d3a62"}, {file = "smart_open-5.2.1.tar.gz", hash = "sha256:75abf758717a92a8f53aa96953f0c245c8cedf8e1e4184903db3659b419d4c17"}, @@ -1144,3 +1346,5 @@ typing-extensions = [] typing-inspect = [] urllib3 = [] wasabi = [] +watchdog = [] +zipp = [] diff --git a/pyproject.toml b/pyproject.toml index 08b761e..c75af8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: Implementation :: CPython", ] -packages = [{include = "doccano_api_client"}] +packages = [{include = "doccano_client"}] [tool.poetry.dependencies] python = "^3.8" @@ -36,6 +36,9 @@ types-requests = "^2.28.10" pytest = "^7.1.3" pyproject-flake8 = "^5.0.4" taskipy = "^1.10.3" +mkdocs = "^1.3.1" +mkdocs-material = "^8.5.3" +mkdocs-same-dir = "^0.1.1" [tool.poetry.extras] spacy = ["spacy", "spacy-partial-tagger", "tqdm"] @@ -45,7 +48,7 @@ requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" [tool.poetry.scripts] -docli = 'doccano_api_client.cli.commands:main' +docli = 'doccano_client.cli.commands:main' [tool.black] line-length = 120 @@ -55,7 +58,7 @@ include = '\.pyi?$' [tool.flake8] max-line-length = 120 max-complexity = 18 -ignore = "E203,E266,W503,DAR101,DAR201,DAR301,DAR401" # Todo: remove DAR* +ignore = "E203,E266,W503,DAR101,DAR201" # Todo: remove DAR* filename = "*.py" [tool.isort] @@ -70,8 +73,8 @@ show_error_codes = true [tool.taskipy.tasks] isort = "isort . -c" -flake8 = "pflake8 doccano_api_client" +flake8 = "pflake8 doccano_client" black = "black --check ." darglint = "darglint" -mypy = "mypy doccano_api_client" +mypy = "mypy doccano_client" test = "python -m pytest"