Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error details & Generator improvements #22

Merged
merged 13 commits into from
Nov 22, 2023
Merged
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ repos:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- repo: https://github.com/psf/black
rev: 23.10.1
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.3
rev: v0.1.4
hooks:
- id: ruff
args:
Expand All @@ -48,7 +48,7 @@ repos:
hooks:
- id: poetry-sort
- repo: https://github.com/python-poetry/poetry
rev: "1.6.0"
rev: "1.7.0"
hooks:
- id: poetry-check

Expand Down
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"recommendations": [
"editorconfig.editorconfig",
"ms-python.isort",
"ms-python.python",
"ms-python.vscode-pylance",
"redhat.vscode-yaml",
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ Roadmap:

How-to:
=============
- [pyConnectWise - An API library for ConnectWise Manage and ConnectWise Automate, written in Python](#pyconnectwise---an-api-library-for-connectwise-manage-and-connectwise-automate-written-in-python)
- [Features:](#features)
- [Known Issues:](#known-issues)
- [Roadmap:](#roadmap)
- [How-to:](#how-to)
- [Install](#install)
- [Initializing the API Clients](#initializing-the-api-clients)
- [ConnectWise Manage](#connectwise-manage)
Expand All @@ -60,6 +65,7 @@ How-to:
- [Quick dependencies install on apt-based systems (using pipx to manage python tools)](#quick-dependencies-install-on-apt-based-systems-using-pipx-to-manage-python-tools)
- [Setting up your development environment](#setting-up-your-development-environment)
- [Testing](#testing)
- [Running code generation](#running-code-generation)
- [Supporting the project](#supporting-the-project)

# Install
Expand Down Expand Up @@ -254,6 +260,11 @@ pre-commit install
poetry run pytest
```

## Running code generation
```bash
poetry run python -m pyconnectwise_generator <path to schema file>
```

# Supporting the project
:heart: the project and would like to show your support? Please consider donating to the following charities:
- [Black Dog](https://donate.blackdoginstitute.org.au/)
Expand Down
9 changes: 0 additions & 9 deletions generate_models.sh

This file was deleted.

615 changes: 613 additions & 2 deletions poetry.lock

Large diffs are not rendered by default.

53 changes: 50 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[tool.black]
line-length = 120
skip-string-normalization = false

[tool.isort]
line_length = 120

[tool.poetry]
name = "pyconnectwise"
version = "0.5.1"
Expand Down Expand Up @@ -41,10 +48,39 @@ typing-extensions = "^4.8.0"
[tool.poetry.group.dev.dependencies]
astunparse = "^1.6"
black = "^23.7"
datamodel-code-generator = "^0.23.0"
isort = "^5.12"
pytest = "^7.1"
pytest-timeout = "^2.1"
requests-mock = "^1.11"
typer = "^0.9.0"

[tool.datamodel-codegen]
# These options are ordered/grouped to match documentation:
output-model-type = "pydantic_v2.BaseModel"

# Typing customization
base-class = "pyconnectwise.models.base.connectwise_model.ConnectWiseModel"
enum-field-as-literal = "all"
field-constraints = true
set-default-enum-member = true
use-annotated = true
use-standard-collections = true
use-union-operator = true

#Field customization
capitalise-enum-members = true
remove-special-field-name-prefix = true
snake-case-field = true
use-default = true
use-field-description = true

# Model customization
disable-timestamp = true
collapse-rool-models = true
reuse-model = true
target-python-version = "3.10"
use-title-as-name = true

[build-system]
requires = ["poetry-core"]
Expand All @@ -67,18 +103,29 @@ select = [
"ASYNC",
"B",
"C",
"C90",
"DTZ",
"E",
"F",
"FBT",
"FIX",
"FLY",
"FURB",
"I",
"INP",
"N8",
"PERF",
"PT",
"PTH",
"RET",
"RUF",
"S",
"SIM",
"T10",
"TCH",
"TID",
"TRY",
"UP",
]
# ANN101,ANN102 annotating self,cls is silly
# E501 is replaced by flake8-bugbear B950
Expand All @@ -87,8 +134,7 @@ ignore = ["ANN101", "ANN102", "E402", "E501", "E722"]

src = ["src", "tests"]

# Match black default
line-length = 88
line-length = 120

[tool.ruff.isort]
combine-as-imports = true
Expand All @@ -99,4 +145,5 @@ combine-as-imports = true
"src/pyconnectwise/endpoints/**" = ["A003"]
"src/pyconnectwise/models/**" = ["A003"]
# Documenting return types on pytest tests is pointless
"tests/**" = ["ANN201"]
# S101 - Using assert in tests is fine
"tests/**" = ["ANN201", "S101"]
Loading
Loading