diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b34eba6..76ba762 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,10 +50,10 @@ jobs: #---------------------------------------------- - name: Black check run: | - poetry run black src/ --check + poetry run black clientele/ --check - name: Ruff check run: | - poetry run ruff src/ + poetry run ruff clientele/ - name: Test with pytest run: | poetry run pytest -vv diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b778e3..6504357 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change log +## 0.6.3 + +* Packaged application installs in the correct location. Resolving [#6](https://github.com/phalt/clientele/issues/6) +* Updated pyproject.toml to include a better selection of links. + ## 0.6.2 * Ignore optional URL query parameters if they are `None`. diff --git a/Makefile b/Makefile index 670879f..2b879be 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ release: ## Build a new version and release it poetry publish mypy: ## Run a static syntax check - poetry run mypy src/ + poetry run mypy . lint: ## Format the code correctly poetry run black . diff --git a/src/cli.py b/clientele/cli.py similarity index 97% rename from src/cli.py rename to clientele/cli.py index 45cb322..9e114ee 100644 --- a/src/cli.py +++ b/clientele/cli.py @@ -14,7 +14,7 @@ def version(): """ Print the current version of clientele """ - from src.settings import VERSION + from clientele.settings import VERSION print(f"clientele {VERSION}") @@ -81,7 +81,7 @@ def generate(url, file, output, asyncio): console = Console() - from src.generator import Generator + from clientele.generator import Generator assert url or file, "Must pass either a URL or a file" diff --git a/src/client_template/MANIFEST.md b/clientele/client_template/MANIFEST.md similarity index 100% rename from src/client_template/MANIFEST.md rename to clientele/client_template/MANIFEST.md diff --git a/src/__init__.py b/clientele/client_template/__init__.py similarity index 100% rename from src/__init__.py rename to clientele/client_template/__init__.py diff --git a/src/client_template/client.py b/clientele/client_template/client.py similarity index 100% rename from src/client_template/client.py rename to clientele/client_template/client.py diff --git a/src/client_template/http.py b/clientele/client_template/http.py similarity index 100% rename from src/client_template/http.py rename to clientele/client_template/http.py diff --git a/src/client_template/schemas.py b/clientele/client_template/schemas.py similarity index 100% rename from src/client_template/schemas.py rename to clientele/client_template/schemas.py diff --git a/src/constants_template.py b/clientele/constants_template.py similarity index 100% rename from src/constants_template.py rename to clientele/constants_template.py diff --git a/src/generator.py b/clientele/generator.py similarity index 89% rename from src/generator.py rename to clientele/generator.py index 644c604..66b8826 100644 --- a/src/generator.py +++ b/clientele/generator.py @@ -5,11 +5,11 @@ from openapi_core import Spec -from src.generators.clients import ClientsGenerator -from src.generators.http import HTTPGenerator -from src.generators.schemas import SchemasGenerator -from src.settings import CLIENT_TEMPLATE_ROOT, CONSTANTS_ROOT, VERSION -from src.writer import write_to_manifest +from clientele.generators.clients import ClientsGenerator +from clientele.generators.http import HTTPGenerator +from clientele.generators.schemas import SchemasGenerator +from clientele.settings import CLIENT_TEMPLATE_ROOT, CONSTANTS_ROOT, VERSION +from clientele.writer import write_to_manifest class Generator: diff --git a/src/client_template/__init__.py b/clientele/generators/__init__.py similarity index 100% rename from src/client_template/__init__.py rename to clientele/generators/__init__.py diff --git a/src/generators/clients.py b/clientele/generators/clients.py similarity index 97% rename from src/generators/clients.py rename to clientele/generators/clients.py index cd35fa0..65000c5 100644 --- a/src/generators/clients.py +++ b/clientele/generators/clients.py @@ -5,10 +5,10 @@ from pydantic import BaseModel from rich.console import Console -from src.generators.http import HTTPGenerator -from src.generators.schemas import SchemasGenerator -from src.settings import templates -from src.utils import ( +from clientele.generators.http import HTTPGenerator +from clientele.generators.schemas import SchemasGenerator +from clientele.settings import templates +from clientele.utils import ( class_name_titled, clean_prop, create_query_args, @@ -17,7 +17,7 @@ get_type, schema_ref, ) -from src.writer import write_to_client +from clientele.writer import write_to_client console = Console() diff --git a/src/generators/http.py b/clientele/generators/http.py similarity index 97% rename from src/generators/http.py rename to clientele/generators/http.py index 92dbc51..b663b50 100644 --- a/src/generators/http.py +++ b/clientele/generators/http.py @@ -3,8 +3,8 @@ from openapi_core import Spec from rich.console import Console -from src.settings import templates -from src.writer import write_to_http +from clientele.settings import templates +from clientele.writer import write_to_http console = Console() diff --git a/src/generators/schemas.py b/clientele/generators/schemas.py similarity index 98% rename from src/generators/schemas.py rename to clientele/generators/schemas.py index 0a92b08..65fe842 100644 --- a/src/generators/schemas.py +++ b/clientele/generators/schemas.py @@ -3,15 +3,15 @@ from openapi_core import Spec from rich.console import Console -from src.settings import templates -from src.utils import ( +from clientele.settings import templates +from clientele.utils import ( class_name_titled, clean_prop, get_schema_from_ref, get_type, schema_ref, ) -from src.writer import write_to_schemas +from clientele.writer import write_to_schemas console = Console() diff --git a/clientele/settings.py b/clientele/settings.py new file mode 100644 index 0000000..271be48 --- /dev/null +++ b/clientele/settings.py @@ -0,0 +1,12 @@ +from os.path import abspath, dirname + +from jinja2 import Environment, PackageLoader + +CLIENT_TEMPLATE_ROOT = ( + dirname(dirname(abspath(__file__))) + "/clientele/client_template/" +) +TEMPLATES_ROOT = dirname(dirname(abspath(__file__))) + "/clientele/templates/" +CONSTANTS_ROOT = dirname(dirname(abspath(__file__))) + "/clientele/" +VERSION = "0.6.3" + +templates = Environment(loader=PackageLoader("clientele", "templates")) diff --git a/src/templates/async_methods.jinja2 b/clientele/templates/async_methods.jinja2 similarity index 100% rename from src/templates/async_methods.jinja2 rename to clientele/templates/async_methods.jinja2 diff --git a/src/templates/basic_client.jinja2 b/clientele/templates/basic_client.jinja2 similarity index 100% rename from src/templates/basic_client.jinja2 rename to clientele/templates/basic_client.jinja2 diff --git a/src/templates/bearer_client.jinja2 b/clientele/templates/bearer_client.jinja2 similarity index 100% rename from src/templates/bearer_client.jinja2 rename to clientele/templates/bearer_client.jinja2 diff --git a/src/templates/client.jinja2 b/clientele/templates/client.jinja2 similarity index 100% rename from src/templates/client.jinja2 rename to clientele/templates/client.jinja2 diff --git a/src/templates/get_method.jinja2 b/clientele/templates/get_method.jinja2 similarity index 100% rename from src/templates/get_method.jinja2 rename to clientele/templates/get_method.jinja2 diff --git a/src/templates/post_method.jinja2 b/clientele/templates/post_method.jinja2 similarity index 100% rename from src/templates/post_method.jinja2 rename to clientele/templates/post_method.jinja2 diff --git a/src/templates/schema_class.jinja2 b/clientele/templates/schema_class.jinja2 similarity index 100% rename from src/templates/schema_class.jinja2 rename to clientele/templates/schema_class.jinja2 diff --git a/src/templates/schema_helpers.jinja2 b/clientele/templates/schema_helpers.jinja2 similarity index 100% rename from src/templates/schema_helpers.jinja2 rename to clientele/templates/schema_helpers.jinja2 diff --git a/src/templates/sync_methods.jinja2 b/clientele/templates/sync_methods.jinja2 similarity index 100% rename from src/templates/sync_methods.jinja2 rename to clientele/templates/sync_methods.jinja2 diff --git a/src/utils.py b/clientele/utils.py similarity index 100% rename from src/utils.py rename to clientele/utils.py diff --git a/src/writer.py b/clientele/writer.py similarity index 100% rename from src/writer.py rename to clientele/writer.py diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 8b778e3..6504357 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,10 @@ # Change log +## 0.6.3 + +* Packaged application installs in the correct location. Resolving [#6](https://github.com/phalt/clientele/issues/6) +* Updated pyproject.toml to include a better selection of links. + ## 0.6.2 * Ignore optional URL query parameters if they are `None`. diff --git a/pyproject.toml b/pyproject.toml index 80982ce..8637b12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,15 +1,20 @@ [tool.poetry] name = "clientele" -version = "0.6.2" +version = "0.6.3" description = "Generate loveable Python HTTP API Clients" authors = ["Paul Hallett "] license = "MIT" readme = "README.md" -packages = [{include = "src"}] +packages = [{include = "clientele"}] homepage = "https://phalt.github.io/clientele/" +[tool.poetry.urls] +changelog = "https://phalt.github.io/clientele/CHANGELOG/" +documentation = "https://phalt.github.io/clientele/" +issues = "https://github.com/phalt/clientele/issues" + [tool.poetry.scripts] -clientele = "src.cli:cli_group" +clientele = "clientele.cli:cli_group" [tool.poetry.dependencies] python = "^3.9" diff --git a/src/generators/__init__.py b/src/generators/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/settings.py b/src/settings.py deleted file mode 100644 index 6682bae..0000000 --- a/src/settings.py +++ /dev/null @@ -1,10 +0,0 @@ -from os.path import abspath, dirname - -from jinja2 import Environment, PackageLoader - -CLIENT_TEMPLATE_ROOT = dirname(dirname(abspath(__file__))) + "/src/client_template/" -TEMPLATES_ROOT = dirname(dirname(abspath(__file__))) + "/src/templates/" -CONSTANTS_ROOT = dirname(dirname(abspath(__file__))) + "/src/" -VERSION = "0.6.2" - -templates = Environment(loader=PackageLoader("src", "templates")) diff --git a/tests/async_test_client/MANIFEST.md b/tests/async_test_client/MANIFEST.md index d58d8e3..6fae34b 100644 --- a/tests/async_test_client/MANIFEST.md +++ b/tests/async_test_client/MANIFEST.md @@ -9,7 +9,7 @@ pipx install clientele API VERSION: 0.1.0 OPENAPI VERSION: 3.0.2 -CLIENTELE VERSION: 0.6.2 +CLIENTELE VERSION: 0.6.3 Generated using this command: diff --git a/tests/test_client/MANIFEST.md b/tests/test_client/MANIFEST.md index 4a683df..6558e7c 100644 --- a/tests/test_client/MANIFEST.md +++ b/tests/test_client/MANIFEST.md @@ -9,7 +9,7 @@ pipx install clientele API VERSION: 0.1.0 OPENAPI VERSION: 3.0.2 -CLIENTELE VERSION: 0.6.2 +CLIENTELE VERSION: 0.6.3 Generated using this command: