* bump

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* some fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* YOYO NEW API SPEC!

* reformat

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixups

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* for now force true

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* run the tests on generations

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add tests

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix some types

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* float to top

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix mypy

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* more noqa

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixups

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* ruff pass

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add docs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* even less mypy errors

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add test

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixups

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* cleanup

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* new path

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes for mypy

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* skip tests

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Jess Frazelle
2023-05-04 00:58:06 -07:00
committed by GitHub
parent 8877a3c146
commit fcd317aae4
3187 changed files with 349073 additions and 84754 deletions

38
.github/workflows/black.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Black
on:
push:
branches: main
paths:
- '**.py'
- .github/workflows/black.yml
- 'pyproject.toml'
pull_request:
paths:
- '**.py'
- .github/workflows/black.yml
- 'pyproject.toml'
jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
# Installation instructions are from: https://python-poetry.org/docs/
- name: Install dependencies
shell: bash
run: |
pip install \
poetry
- name: Build
shell: bash
run: |
poetry install
poetry build
- name: Run black
shell: bash
run: |
poetry run black --check --diff .

View File

@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: [3.7, 3.8, 3.9] python-version: [3.8, 3.9]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -41,14 +41,6 @@ jobs:
poetry install poetry install
poetry build poetry build
- name: Lint with flake8
shell: bash
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
#poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run pytest - name: Run pytest
shell: bash shell: bash
run: | run: |

View File

@ -23,6 +23,8 @@ jobs:
shell: bash shell: bash
run: | run: |
make generate make generate
env:
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
- name: Check for modified files - name: Check for modified files
id: git-check id: git-check

19
.github/workflows/ruff.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: Ruff
on:
push:
branches: main
paths:
- '**.py'
- .github/workflows/ruff.yml
- 'pyproject.toml'
pull_request:
paths:
- '**.py'
- .github/workflows/ruff.yml
- 'pyproject.toml'
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1

5
.gitignore vendored
View File

@ -24,3 +24,8 @@ dmypy.json
poetry.lock poetry.lock
testing testing
# Sphinx documentation
docs/_build/
docs/_autosummary/
docs/html/_sources/

View File

@ -13,6 +13,7 @@ VERSION := $(shell toml get $(CURDIR)/pyproject.toml tool.poetry.version | jq -r
generate: docker-image ## Generate the api client. generate: docker-image ## Generate the api client.
docker run --rm -i $(DOCKER_FLAGS) \ docker run --rm -i $(DOCKER_FLAGS) \
--name python-generator \ --name python-generator \
-e KITTYCAD_API_TOKEN \
--disable-content-trust \ --disable-content-trust \
-v $(CURDIR):/home/user/src \ -v $(CURDIR):/home/user/src \
--workdir /home/user/src \ --workdir /home/user/src \

View File

@ -0,0 +1,33 @@
{{ fullname | escape | underline}}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
:members:
:show-inheritance:
:inherited-members:
{% block methods %}
.. automethod:: __init__
{% if methods %}
.. rubric:: {{ _('Methods') }}
.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}
.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,67 @@
{{ fullname | escape | underline}}
.. automodule:: {{ fullname }}
{% block attributes %}
{% if attributes %}
.. rubric:: Module Attributes
.. autosummary::
:toctree:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}
.. autosummary::
:toctree:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}
.. autosummary::
:toctree:
:template: custom-class-template.rst
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}
.. autosummary::
:toctree:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block modules %}
{% if modules %}
.. rubric:: Modules
.. autosummary::
:toctree:
:template: custom-module-template.rst
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

View File

@ -1,27 +0,0 @@
Client
======
.. currentmodule:: kittycad
.. autoclass:: Client
:show-inheritance:
.. rubric:: Methods Summary
.. autosummary::
~Client.get_cookies
~Client.get_headers
~Client.get_timeout
~Client.with_cookies
~Client.with_headers
~Client.with_timeout
.. rubric:: Methods Documentation
.. automethod:: get_cookies
.. automethod:: get_headers
.. automethod:: get_timeout
.. automethod:: with_cookies
.. automethod:: with_headers
.. automethod:: with_timeout

View File

@ -1,17 +0,0 @@
ClientFromEnv
=============
.. currentmodule:: kittycad
.. autoclass:: ClientFromEnv
:show-inheritance:
.. rubric:: Methods Summary
.. autosummary::
~ClientFromEnv.get_headers
.. rubric:: Methods Documentation
.. automethod:: get_headers

View File

@ -4,36 +4,39 @@
# list see the documentation: # list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html # https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup -------------------------------------------------------------- import datetime
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os import os
import pathlib
import sys import sys
from typing import List
import toml
# The full version, including alpha/beta/rc tags
# Get the version from the pyproject file.
ROOT = pathlib.Path(__file__).parent.parent
PACKAGE_SRC = ROOT / "kittycad"
sys.path.insert(1, os.path.dirname(os.path.abspath(__file__))) sys.path.insert(1, os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.abspath('../kittycad')) sys.path.append(os.path.abspath("../kittycad"))
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
project = 'kittycad' project = "kittycad"
author = 'KittyCAD Team Members' author = "KittyCAD Team Members"
copyright = author year = datetime.date.today().year
copyright = str(year) + ", " + author
# The full version, including alpha/beta/rc tags with open(os.path.abspath("../pyproject.toml"), "r") as f:
# Get the version from the poetry file.
import toml
with open(os.path.abspath('../pyproject.toml'), 'r') as f:
parsed_toml = toml.load(f) parsed_toml = toml.load(f)
version = parsed_toml['tool']['poetry']['version'] version = parsed_toml["tool"]["poetry"]["version"]
version = 'v'+version version = "v" + version
release = version release = version
language = "en"
default_role = "any"
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
@ -42,25 +45,34 @@ release = version
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = [ extensions = [
'sphinx.ext.autodoc', "autoclasstoc",
'sphinx_autodoc_typehints', "sphinx.ext.autodoc",
'sphinx.ext.intersphinx', "sphinx.ext.autosectionlabel",
'sphinx.ext.linkcode', "sphinx.ext.autosummary",
'sphinx_automodapi.automodapi', "sphinx.ext.coverage",
'sphinx_rtd_theme' "sphinx.ext.doctest",
"sphinx.ext.graphviz",
"sphinx.ext.imgconverter",
"sphinx.ext.intersphinx",
"sphinx.ext.linkcode",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx_autodoc_typehints",
"sphinx_rtd_theme",
"sphinx_copybutton",
"sphinxext.opengraph",
] ]
numpydoc_show_class_members = False numpydoc_show_class_members = False
automodapi_inheritance_diagram = False
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ["_templates"]
# List of patterns, relative to source directory, that match files and # List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files. # directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path. # This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
# -- Options for HTML output ------------------------------------------------- # -- Options for HTML output -------------------------------------------------
@ -68,35 +80,61 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
# #
html_theme = 'sphinx_rtd_theme' html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom themes here, relative to this directory. # Add any paths that contain custom themes here, relative to this directory.
html_theme_path = [ html_theme_path: List[str] = []
]
# Add any paths that contain custom static files (such as style sheets) here, # Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = [] html_static_path: List[str] = []
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'trac' pygments_style = "trac"
# pygments_style = "lovelace"
# pygments_dark_style = "one-dark"
# -- autodoc --
autodoc_default_options = {
"members": True,
"special-members": True,
"private-members": True,
"inherited-members": True,
"undoc-members": True,
"exclude-members": "__weakref__",
}
autodoc_inherit_docstrings = True
# -- autosummary --
autosummary_generate = True
autoclass_content = "both"
html_show_sourcelink = False
set_type_checking_flag = True
# -- autosectionlabel --
autosectionlabel_prefix_document = True
# -- intersphinx --
# Intersphinx configuration.
# FROM: https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#module-sphinx.ext.intersphinx
intersphinx_mapping = { intersphinx_mapping = {
'python': ('https://python.readthedocs.io/en/latest/', None), "python": ("https://docs.python.org/3", None),
} }
# This is a function linkcode_resolve(domain, info), which should return the URL # This is a function linkcode_resolve(domain, info), which should return the URL
# to source code corresponding to the object in given domain with given information. # to source code corresponding to the object in given domain with given information.
# FROM: https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html # FROM: https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html
def linkcode_resolve(domain, info): def linkcode_resolve(domain, info):
if domain != 'py': if domain != "py":
return None return None
if not info['module']: if not info["module"]:
return None return None
filename = info['module'].replace('.', '/') filename = info["module"].replace(".", "/")
return "https://github.com/kittycad/kittycad.py/%s.py" % filename return "https://github.com/kittycad/kittycad.py/%s.py" % filename
@ -104,10 +142,10 @@ def linkcode_resolve(domain, info):
try: try:
import enchant # noqa # pylint: disable=unused-import import enchant # noqa # pylint: disable=unused-import
except ImportError as ex: except ImportError as ex:
print("enchant module import failed:\n" print(
"{0}\n" "enchant module import failed:\n" "{0}\n" "Spell checking disabled.".format(ex),
"Spell checking disabled.".format(ex), file=sys.stderr,
file=sys.stderr) )
else: else:
extensions.append('sphinxcontrib.spelling') extensions.append("sphinxcontrib.spelling")
spelling_show_suggestions = True spelling_show_suggestions = True

View File

@ -1,4 +1,4 @@
# Sphinx build info version 1 # Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 4b9674dd05f426997ea93164c4dd9b06 config: c4d9784d0d7faa3c4bde65c9f259c1f0
tags: 645f666f9bcd5a90fca523b33c5a78b7 tags: 645f666f9bcd5a90fca523b33c5a78b7

Some files were not shown because too many files have changed in this diff Show More