From 15195823e0ba47ae7c39178797aab48c739d517c Mon Sep 17 00:00:00 2001 From: ethan92429 Date: Thu, 2 Aug 2018 16:03:29 -0400 Subject: [PATCH 1/5] preparing for deployment as onshapepy --- .travis.yml | 45 +- docs/conf.py | 14 +- docs/modules.rst | 7 + docs/onshape.rst | 54 ++ featuure_list_example.json | 672 ---------------------- import_part.py | 28 - {onshape => onshapepy}/__init__.py | 4 +- {onshape => onshapepy}/assembly.py | 0 {onshape => onshapepy}/client.py | 0 {onshape => onshapepy}/onshape.py | 0 {onshape => onshapepy}/part.py | 4 +- {onshape => onshapepy}/utils.py | 0 setup.py | 8 +- tests/test_app.py | 4 +- tests/test_assembly.py | 6 +- tests/{test_basic.py => test_client} | 2 +- tests/test_exportstl.py | 4 +- tests/test_part.py | 2 +- update_configuration_example_payload.json | 167 ------ 19 files changed, 118 insertions(+), 903 deletions(-) create mode 100644 docs/modules.rst create mode 100644 docs/onshape.rst delete mode 100644 featuure_list_example.json delete mode 100644 import_part.py rename {onshape => onshapepy}/__init__.py (85%) rename {onshape => onshapepy}/assembly.py (100%) rename {onshape => onshapepy}/client.py (100%) rename {onshape => onshapepy}/onshape.py (100%) rename {onshape => onshapepy}/part.py (94%) rename {onshape => onshapepy}/utils.py (100%) rename tests/{test_basic.py => test_client} (97%) delete mode 100644 update_configuration_example_payload.json diff --git a/.travis.yml b/.travis.yml index 7e0042b..b337b8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,20 +2,41 @@ language: python sudo: false python: - '3.6' +before_install: + - export NOKOGIRI_USE_SYSTEM_LIBRARIES=true + - openssl aes-256-cbc -K $encrypted_0b30f5022c54_key -iv $encrypted_0b30f5022c54_iv + -in creds.json.enc -out creds.json -d +addons: + apt: + packages: + - libcurl4-openssl-dev # required to avoid SSL errors install: -- pip install -r requirements-dev.txt + - pip install -r requirements-dev.txt + - gem install html-proofer + - cd docs + - make html + - make doctest + - htmlproofer _build/html --allow_hash_href --file_ignore "_build/html/search.html" script: - pytest --cov=./ -deploy: - provider: pypi - user: "$PYPI_USERNAME" - password: "$PYPI_PASSWORD" - on: - tags: true - branch: master - distributions: sdist after_success: - codecov -before_install: -- openssl aes-256-cbc -K $encrypted_0b30f5022c54_key -iv $encrypted_0b30f5022c54_iv - -in creds.json.enc -out creds.json -d +deploy: + - provider: pypi + user: "$PYPI_USERNAME" + password: "$PYPI_PASSWORD" + on: + tags: true + branch: master + distributions: sdist + - provider: pages # Deploy to to gh-pages + skip-cleanup: true + github-token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable + keep-history: true + local-dir: _build + target-branch: gh-pages + on: + tags: true + + + diff --git a/docs/conf.py b/docs/conf.py index a6da2e6..2547489 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,14 +12,14 @@ # 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 sys -# sys.path.insert(0, os.path.abspath('.')) +import os +import sys +sys.path.insert(0, os.path.abspath('..')) # -- Project information ----------------------------------------------------- -project = u'onshape' +project = u'onshapepy' copyright = u'2018, Ethan Keller' author = u'Ethan Keller' @@ -136,7 +136,7 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'aguaclaraonshape.tex', u'aguaclara.onshape Documentation', + (master_doc, 'aguaclaraonshape.tex', u'aguaclara.onshapepy Documentation', u'Ethan Keller', 'manual'), ] @@ -146,7 +146,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'aguaclaraonshape', u'aguaclara.onshape Documentation', + (master_doc, 'aguaclaraonshape', u'aguaclara.onshapepy Documentation', [author], 1) ] @@ -157,7 +157,7 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'aguaclaraonshape', u'aguaclara.onshape Documentation', + (master_doc, 'aguaclaraonshape', u'aguaclara.onshapepy Documentation', author, 'aguaclaraonshape', 'One line description of project.', 'Miscellaneous'), ] diff --git a/docs/modules.rst b/docs/modules.rst new file mode 100644 index 0000000..72e4d79 --- /dev/null +++ b/docs/modules.rst @@ -0,0 +1,7 @@ +onshape +======= + +.. toctree:: + :maxdepth: 4 + + onshape diff --git a/docs/onshape.rst b/docs/onshape.rst new file mode 100644 index 0000000..b7716cb --- /dev/null +++ b/docs/onshape.rst @@ -0,0 +1,54 @@ +onshape package +=============== + +Submodules +---------- + +onshape.assembly module +----------------------- + +.. automodule:: onshape.assembly + :members: + :undoc-members: + :show-inheritance: + +onshape.client module +--------------------- + +.. automodule:: onshape.client + :members: + :undoc-members: + :show-inheritance: + +onshape.onshape module +---------------------- + +.. automodule:: onshape.onshape + :members: + :undoc-members: + :show-inheritance: + +onshape.part module +------------------- + +.. automodule:: onshape.part + :members: + :undoc-members: + :show-inheritance: + +onshape.utils module +-------------------- + +.. automodule:: onshape.utils + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: onshape + :members: + :undoc-members: + :show-inheritance: diff --git a/featuure_list_example.json b/featuure_list_example.json deleted file mode 100644 index 33ef489..0000000 --- a/featuure_list_example.json +++ /dev/null @@ -1,672 +0,0 @@ -{ - "features" : [ { - "type" : 64, - "typeName" : "BTMMate", - "message" : { - "mateConnectors" : [ { - "type" : 66, - "typeName" : "BTMMateConnector", - "message" : { - "isHidden" : true, - "implicit" : true, - "version" : 3, - "featureType" : "mateConnector", - "featureId" : "MIBkzg10adpiy/8Gw", - "name" : "Mate connector", - "parameters" : [ { - "type" : 145, - "typeName" : "BTMParameterEnum", - "message" : { - "enumName" : "Origin type", - "value" : "ON_ENTITY", - "namespace" : "", - "parameterId" : "originType", - "hasUserCode" : false, - "nodeId" : "MsvunlPGiQJ8PJ4RH" - } - }, { - "type" : 67, - "typeName" : "BTMParameterQueryWithOccurrenceList", - "message" : { - "queries" : [ { - "type" : 1083, - "typeName" : "BTMInferenceQueryWithOccurrence", - "message" : { - "secondGeometryId" : "", - "inferenceType" : "CENTROID", - "geometryIds" : [ "JHS" ], - "path" : [ "MLER6gjKXbnv2zVXS" ], - "hasUserCode" : false, - "nodeId" : "FPaSKloopoDPTuT" - } - } ], - "parameterId" : "originQuery", - "hasUserCode" : false, - "nodeId" : "M6VXCCTNreH1jgcy4" - } - }, { - "type" : 67, - "typeName" : "BTMParameterQueryWithOccurrenceList", - "message" : { - "queries" : [ ], - "parameterId" : "originAdditionalQuery", - "hasUserCode" : false, - "nodeId" : "M4nt6z5CBXAkgms2Y" - } - }, { - "type" : 144, - "typeName" : "BTMParameterBoolean", - "message" : { - "value" : false, - "parameterId" : "flipPrimary", - "hasUserCode" : false, - "nodeId" : "MLpv8ZR3LAEXng52g" - } - }, { - "type" : 145, - "typeName" : "BTMParameterEnum", - "message" : { - "enumName" : "Reorient secondary axis", - "value" : "PLUS_X", - "namespace" : "", - "parameterId" : "secondaryAxisType", - "hasUserCode" : false, - "nodeId" : "M2xSQzxU0nuiWPkHx" - } - }, { - "type" : 144, - "typeName" : "BTMParameterBoolean", - "message" : { - "value" : false, - "parameterId" : "realign", - "hasUserCode" : false, - "nodeId" : "MQ9qzVq93fivKWnMH" - } - }, { - "type" : 67, - "typeName" : "BTMParameterQueryWithOccurrenceList", - "message" : { - "queries" : [ ], - "parameterId" : "primaryAxisQuery", - "hasUserCode" : false, - "nodeId" : "MLQUi6/P96n1Qt1Lo" - } - }, { - "type" : 67, - "typeName" : "BTMParameterQueryWithOccurrenceList", - "message" : { - "queries" : [ ], - "parameterId" : "secondaryAxisQuery", - "hasUserCode" : false, - "nodeId" : "MAn1ruy9MqSOxSnIM" - } - }, { - "type" : 144, - "typeName" : "BTMParameterBoolean", - "message" : { - "value" : false, - "parameterId" : "transform", - "hasUserCode" : false, - "nodeId" : "M51BesmOzKPHS88qX" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "", - "value" : 0.0, - "expression" : "0.0*in", - "isInteger" : false, - "parameterId" : "translationX", - "hasUserCode" : false, - "nodeId" : "MiijwY3Th557jrew0" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "", - "value" : 0.0, - "expression" : "0.0*in", - "isInteger" : false, - "parameterId" : "translationY", - "hasUserCode" : false, - "nodeId" : "M/YIDXYnODYkaT/sk" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "", - "value" : 0.0, - "expression" : "0.0*in", - "isInteger" : false, - "parameterId" : "translationZ", - "hasUserCode" : false, - "nodeId" : "Mhn80+vwKNmbwa3Fg" - } - }, { - "type" : 145, - "typeName" : "BTMParameterEnum", - "message" : { - "enumName" : "Rotation axis", - "value" : "ABOUT_Z", - "namespace" : "", - "parameterId" : "rotationType", - "hasUserCode" : false, - "nodeId" : "MQ2omBwHCfDgOGzpH" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "", - "value" : 0.0, - "expression" : "0.0*deg", - "isInteger" : false, - "parameterId" : "rotation", - "hasUserCode" : false, - "nodeId" : "MSJBL2DvJOBl1990O" - } - } ], - "suppressed" : false, - "namespace" : "", - "subFeatures" : [ ], - "returnAfterSubfeatures" : false, - "suppressionState" : { - "type" : 0 - }, - "hasUserCode" : false, - "nodeId" : "MIBkzg10adpiy/8Gw" - } - }, { - "type" : 66, - "typeName" : "BTMMateConnector", - "message" : { - "isHidden" : true, - "implicit" : true, - "version" : 3, - "featureType" : "mateConnector", - "featureId" : "MzEj/zYfKZpTqjEKl", - "name" : "Mate connector", - "parameters" : [ { - "type" : 145, - "typeName" : "BTMParameterEnum", - "message" : { - "enumName" : "Origin type", - "value" : "ON_ENTITY", - "namespace" : "", - "parameterId" : "originType", - "hasUserCode" : false, - "nodeId" : "Mw6fcIzh+CkPM2NsE" - } - }, { - "type" : 67, - "typeName" : "BTMParameterQueryWithOccurrenceList", - "message" : { - "queries" : [ { - "type" : 157, - "typeName" : "BTMFeatureQueryWithOccurrence", - "message" : { - "featureId" : "Origin", - "queryData" : "ORIGIN_X", - "path" : [ ], - "hasUserCode" : false, - "nodeId" : "Fen7DPQ6Di2PHsQ" - } - } ], - "parameterId" : "originQuery", - "hasUserCode" : false, - "nodeId" : "MyXj+ZefHb42Gn6xm" - } - }, { - "type" : 67, - "typeName" : "BTMParameterQueryWithOccurrenceList", - "message" : { - "queries" : [ ], - "parameterId" : "originAdditionalQuery", - "hasUserCode" : false, - "nodeId" : "MhJHca0osizexsfQ+" - } - }, { - "type" : 144, - "typeName" : "BTMParameterBoolean", - "message" : { - "value" : false, - "parameterId" : "flipPrimary", - "hasUserCode" : false, - "nodeId" : "MPM0uXU8H+AvRr7e7" - } - }, { - "type" : 145, - "typeName" : "BTMParameterEnum", - "message" : { - "enumName" : "Reorient secondary axis", - "value" : "PLUS_X", - "namespace" : "", - "parameterId" : "secondaryAxisType", - "hasUserCode" : false, - "nodeId" : "Mz1xN3buqtQ5mtH10" - } - }, { - "type" : 144, - "typeName" : "BTMParameterBoolean", - "message" : { - "value" : false, - "parameterId" : "realign", - "hasUserCode" : false, - "nodeId" : "MUPcHXeSBbm77QBrQ" - } - }, { - "type" : 67, - "typeName" : "BTMParameterQueryWithOccurrenceList", - "message" : { - "queries" : [ ], - "parameterId" : "primaryAxisQuery", - "hasUserCode" : false, - "nodeId" : "MpXqYzISFVGHaas/F" - } - }, { - "type" : 67, - "typeName" : "BTMParameterQueryWithOccurrenceList", - "message" : { - "queries" : [ ], - "parameterId" : "secondaryAxisQuery", - "hasUserCode" : false, - "nodeId" : "McxB/zrUygtlHUkqq" - } - }, { - "type" : 144, - "typeName" : "BTMParameterBoolean", - "message" : { - "value" : false, - "parameterId" : "transform", - "hasUserCode" : false, - "nodeId" : "MC5ev37eUJkY41Q5W" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "", - "value" : 0.0, - "expression" : "0.0*in", - "isInteger" : false, - "parameterId" : "translationX", - "hasUserCode" : false, - "nodeId" : "M7UQxAE22VZf80oQU" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "", - "value" : 0.0, - "expression" : "0.0*in", - "isInteger" : false, - "parameterId" : "translationY", - "hasUserCode" : false, - "nodeId" : "M9NygG6tOJhKps4uh" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "", - "value" : 0.0, - "expression" : "0.0*in", - "isInteger" : false, - "parameterId" : "translationZ", - "hasUserCode" : false, - "nodeId" : "M/BSFEwJ6Sx1h9qcL" - } - }, { - "type" : 145, - "typeName" : "BTMParameterEnum", - "message" : { - "enumName" : "Rotation axis", - "value" : "ABOUT_Z", - "namespace" : "", - "parameterId" : "rotationType", - "hasUserCode" : false, - "nodeId" : "MKH8Al/jNR/8LwUNG" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "", - "value" : 0.0, - "expression" : "0.0*deg", - "isInteger" : false, - "parameterId" : "rotation", - "hasUserCode" : false, - "nodeId" : "MAy2CIqx8rlFmdHZQ" - } - } ], - "suppressed" : false, - "namespace" : "", - "subFeatures" : [ ], - "returnAfterSubfeatures" : false, - "suppressionState" : { - "type" : 0 - }, - "hasUserCode" : false, - "nodeId" : "MzEj/zYfKZpTqjEKl" - } - } ], - "version" : 1, - "featureType" : "mate", - "featureId" : "MlTa8KcaRJHusPw3d", - "name" : "Fastened 1", - "parameters" : [ { - "type" : 145, - "typeName" : "BTMParameterEnum", - "message" : { - "enumName" : "Mate type", - "value" : "FASTENED", - "namespace" : "", - "parameterId" : "mateType", - "hasUserCode" : false, - "nodeId" : "QXNa9O16O+DbCBQ8" - } - }, { - "type" : 67, - "typeName" : "BTMParameterQueryWithOccurrenceList", - "message" : { - "queries" : [ { - "type" : 157, - "typeName" : "BTMFeatureQueryWithOccurrence", - "message" : { - "featureId" : "MIBkzg10adpiy/8Gw", - "queryData" : "", - "path" : [ ], - "hasUserCode" : false, - "nodeId" : "MqWo1q8AiFqZ+0AIk" - } - }, { - "type" : 157, - "typeName" : "BTMFeatureQueryWithOccurrence", - "message" : { - "featureId" : "MzEj/zYfKZpTqjEKl", - "queryData" : "", - "path" : [ ], - "hasUserCode" : false, - "nodeId" : "MlknwfatPJkiP7uIw" - } - } ], - "parameterId" : "mateConnectorsQuery", - "hasUserCode" : false, - "nodeId" : "njOPrYDxS6aIoefb" - } - }, { - "type" : 145, - "typeName" : "BTMParameterEnum", - "message" : { - "enumName" : "Reorient secondary axis", - "value" : "PLUS_X", - "namespace" : "", - "parameterId" : "secondaryAxisAlignment", - "hasUserCode" : false, - "nodeId" : "qZ5C2x3yRiuwt7hW" - } - }, { - "type" : 144, - "typeName" : "BTMParameterBoolean", - "message" : { - "value" : false, - "parameterId" : "primaryAxisAlignment", - "hasUserCode" : false, - "nodeId" : "+nDSMKq8AdaPn/f2" - } - }, { - "type" : 144, - "typeName" : "BTMParameterBoolean", - "message" : { - "value" : false, - "parameterId" : "mateOffsetEnabled", - "hasUserCode" : false, - "nodeId" : "9zhpaYzCpuQJi3H0" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "", - "value" : 0.0, - "expression" : "0 in", - "isInteger" : false, - "parameterId" : "mateOffsetDistanceX", - "hasUserCode" : false, - "nodeId" : "umqnY5iHH1Wm/ILH" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "", - "value" : 0.0, - "expression" : "0 in", - "isInteger" : false, - "parameterId" : "mateOffsetDistanceY", - "hasUserCode" : false, - "nodeId" : "HNGdbxt/+WMNO+pC" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "", - "value" : 0.0, - "expression" : "0 in", - "isInteger" : false, - "parameterId" : "mateOffsetDistanceZ", - "hasUserCode" : false, - "nodeId" : "q9m5RN+vrpuDdmTV" - } - }, { - "type" : 144, - "typeName" : "BTMParameterBoolean", - "message" : { - "value" : false, - "parameterId" : "limitsEnabled", - "hasUserCode" : false, - "nodeId" : "a8YEMA9IpDxERRlx" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No minimum", - "units" : "", - "value" : 0.0, - "expression" : "0 in", - "isInteger" : false, - "parameterId" : "limitXMin", - "hasUserCode" : false, - "nodeId" : "ns1unVRXTGOqowwO" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No maximum", - "units" : "", - "value" : 0.0, - "expression" : "0 in", - "isInteger" : false, - "parameterId" : "limitXMax", - "hasUserCode" : false, - "nodeId" : "3NDtcyQtvD6EafcH" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No minimum", - "units" : "", - "value" : 0.0, - "expression" : "0 in", - "isInteger" : false, - "parameterId" : "limitYMin", - "hasUserCode" : false, - "nodeId" : "iSCbm0g6HHRty20Z" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No maximum", - "units" : "", - "value" : 0.0, - "expression" : "0 in", - "isInteger" : false, - "parameterId" : "limitYMax", - "hasUserCode" : false, - "nodeId" : "+V2Z6HrddnlBE0hl" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No minimum", - "units" : "", - "value" : 0.0, - "expression" : "0 in", - "isInteger" : false, - "parameterId" : "limitZMin", - "hasUserCode" : false, - "nodeId" : "7vHgJsRlvxNwBlcB" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No maximum", - "units" : "", - "value" : 0.0, - "expression" : "0 in", - "isInteger" : false, - "parameterId" : "limitZMax", - "hasUserCode" : false, - "nodeId" : "3Z+uMOB0l+t6R7D3" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No minimum", - "units" : "", - "value" : 0.0, - "expression" : "0 deg", - "isInteger" : false, - "parameterId" : "limitAxialXMin", - "hasUserCode" : false, - "nodeId" : "u+rhypoOTD5nFBce" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No maximum", - "units" : "", - "value" : 0.0, - "expression" : "0 deg", - "isInteger" : false, - "parameterId" : "limitAxialXMax", - "hasUserCode" : false, - "nodeId" : "DYUa3sr1e3iX24SZ" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No minimum", - "units" : "", - "value" : 0.0, - "expression" : "0 deg", - "isInteger" : false, - "parameterId" : "limitAxialYMin", - "hasUserCode" : false, - "nodeId" : "d/v3MAPpV9mUIUDu" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No maximum", - "units" : "", - "value" : 0.0, - "expression" : "0 deg", - "isInteger" : false, - "parameterId" : "limitAxialYMax", - "hasUserCode" : false, - "nodeId" : "vC/dBskvzwpMzLDK" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No minimum", - "units" : "", - "value" : 0.0, - "expression" : "0 deg", - "isInteger" : false, - "parameterId" : "limitAxialZMin", - "hasUserCode" : false, - "nodeId" : "AH7+t3KsUYCq5V5H" - } - }, { - "type" : 807, - "typeName" : "BTMParameterNullableQuantity", - "message" : { - "isNull" : false, - "nullValue" : "No maximum", - "units" : "", - "value" : 0.0, - "expression" : "0 deg", - "isInteger" : false, - "parameterId" : "limitAxialZMax", - "hasUserCode" : false, - "nodeId" : "zA08ZuW9pgXH9/Qs" - } - } ], - "suppressed" : false, - "namespace" : "", - "subFeatures" : [ ], - "returnAfterSubfeatures" : false, - "suppressionState" : { - "type" : 0 - }, - "hasUserCode" : false, - "nodeId" : "MlTa8KcaRJHusPw3d" - } - } ], - "featureStates" : [ { - "key" : "MlTa8KcaRJHusPw3d", - "value" : { - "type" : 1688, - "typeName" : "BTFeatureState", - "message" : { - "featureStatus" : "OK" - } - } - } ], - "isComplete" : true, - "serializationVersion" : "1.1.12", - "sourceMicroversion" : "da31f9f69fdca72928235905", - "rejectMicroversionSkew" : false, - "microversionSkew" : false, - "libraryVersion" : 0 -} diff --git a/import_part.py b/import_part.py deleted file mode 100644 index e987566..0000000 --- a/import_part.py +++ /dev/null @@ -1,28 +0,0 @@ -from onshape.client import Client - -# assembly to import into -assembly_id = "6f1f9c485ff1e639f4db63c0" -did = "8ec353ba00f37f447b5a61f5" -wid = "04c36c786829759832bd3d1a" - -payload = r"""{ - "documentId": "8ec353ba00f37f447b5a61f5", - "elementId": "2918f0f5adfa39d3047f19d0", - "versionId": "", - "microversionId": "", - "isAssembly": false, - "isWholePartStudio": true, - "partId": "", - "featureId": "", - "configuration": "height=20+meter;poo=true" -}""" - -# stacks to choose from -stacks = { - 'cad': 'https://cad.onshape.com' -} - -# create instance of the onshape client; change key to test on another stack -c = Client(stack=stacks['cad'], logging=True) - -c._api.request('post', "/api/assemblies/d/8ec353ba00f37f447b5a61f5/w/04c36c786829759832bd3d1a/e/6f1f9c485ff1e639f4db63c0/instances", body=payload) diff --git a/onshape/__init__.py b/onshapepy/__init__.py similarity index 85% rename from onshape/__init__.py rename to onshapepy/__init__.py index 99ee101..f99a211 100644 --- a/onshape/__init__.py +++ b/onshapepy/__init__.py @@ -1,5 +1,5 @@ ''' -onshape +onshapepy ====== Demonstrates usage of API keys for the Onshape REST API @@ -7,5 +7,5 @@ __copyright__ = 'Copyright (c) 2016 Onshape, Inc.' __license__ = 'All rights reserved.' -__title__ = 'onshape' +__title__ = 'onshapepy' __all__ = ['onshape', 'client', 'utils'] diff --git a/onshape/assembly.py b/onshapepy/assembly.py similarity index 100% rename from onshape/assembly.py rename to onshapepy/assembly.py diff --git a/onshape/client.py b/onshapepy/client.py similarity index 100% rename from onshape/client.py rename to onshapepy/client.py diff --git a/onshape/onshape.py b/onshapepy/onshape.py similarity index 100% rename from onshape/onshape.py rename to onshapepy/onshape.py diff --git a/onshape/part.py b/onshapepy/part.py similarity index 94% rename from onshape/part.py rename to onshapepy/part.py index 55e5425..a86ae5f 100644 --- a/onshape/part.py +++ b/onshapepy/part.py @@ -2,10 +2,10 @@ part ==== -OnShape part that maps to an element of a part studio +OnShape part that maps to a part studio ''' -from onshape.client import Client +from onshapepy.client import Client import json class Part(): diff --git a/onshape/utils.py b/onshapepy/utils.py similarity index 100% rename from onshape/utils.py rename to onshapepy/utils.py diff --git a/setup.py b/setup.py index 3e1cf43..91b7ad8 100644 --- a/setup.py +++ b/setup.py @@ -6,15 +6,15 @@ from distutils.core import setup config = { - 'name': 'onshape', - 'version': '1.0.0', + 'name': 'onshapepy', + 'version': '0.0.0', 'description': 'Sample package to demonstrate using Onshape API keys', 'long_description': open('README.md').read(), 'author': 'Ty-Lucas Kelley', - 'url': 'https://github.com/onshape/onshape/tree/master/python', + 'url': 'https://github.com/onshapepy/onshapepy/tree/master/python', 'license': open('LICENSE').read(), 'packages': [ - 'onshape' + 'onshapepy' ], 'install_requires': ['requests'], 'classifiers': [ diff --git a/tests/test_app.py b/tests/test_app.py index 86ca70e..d948346 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -5,14 +5,14 @@ Demos basic usage of the Onshape API ''' -from onshape.client import Client +from onshapepy.client import Client # stacks to choose from stacks = { 'cad': 'https://cad.onshape.com' } -# create instance of the onshape client; change key to test on another stack +# create instance of the onshapepy client; change key to test on another stack c = Client(stack=stacks['cad'], logging=True) # make a new document and grab the document ID and workspace ID diff --git a/tests/test_assembly.py b/tests/test_assembly.py index a1c20bc..780fda6 100644 --- a/tests/test_assembly.py +++ b/tests/test_assembly.py @@ -1,6 +1,6 @@ -from onshape.part import Part -from onshape.assembly import Assembly -from onshape.client import Client +from onshapepy.part import Part +from onshapepy.assembly import Assembly +from onshapepy.client import Client # load the client for this part my_cube = Part("2d47b6abec9d1de1d2538372", "f2d396ba0762dc1f1dab3de1", "0639ea3c439aa0947744d29a") diff --git a/tests/test_basic.py b/tests/test_client similarity index 97% rename from tests/test_basic.py rename to tests/test_client index 5b292d6..a81a966 100644 --- a/tests/test_basic.py +++ b/tests/test_client @@ -1,4 +1,4 @@ -from onshape.client import Client +from onshapepy.client import Client # This is from a test document on OnShape, publicly available. It is a standard cube in a partStudio. # https://cad.onshape.com/documents/8ec353ba00f37f447b5a61f5/w/04c36c786829759832bd3d1a/e/2918f0f5adfa39d3047f19d0 diff --git a/tests/test_exportstl.py b/tests/test_exportstl.py index 2acb127..df092cd 100644 --- a/tests/test_exportstl.py +++ b/tests/test_exportstl.py @@ -5,14 +5,14 @@ Demos 307 redirects with the Onshape API ''' -from onshape.client import Client +from onshapepy.client import Client # stacks to choose from stacks = { 'cad': 'https://cad.onshape.com' } -# create instance of the onshape client; change key to test on another stack +# create instance of the onshapepy client; change key to test on another stack c = Client(stack=stacks['cad'], logging=True) # get features for doc diff --git a/tests/test_part.py b/tests/test_part.py index cc501fc..fdf1e2a 100644 --- a/tests/test_part.py +++ b/tests/test_part.py @@ -1,5 +1,5 @@ from tests.test_basic import setup_client -from onshape.part import Part +from onshapepy.part import Part from tests.test_basic import assembly from tests.test_basic import part diff --git a/update_configuration_example_payload.json b/update_configuration_example_payload.json deleted file mode 100644 index 68de04e..0000000 --- a/update_configuration_example_payload.json +++ /dev/null @@ -1,167 +0,0 @@ -{ - "configurationParameters": [ { - "type" : 2550, - "typeName" : "BTMConfigurationParameterBoolean", - "message" : { - "defaultValue" : true, - "parameterId" : "poo", - "parameterName" : "poo", - "hasUserCode" : false, - "nodeId" : "MyHDRtn7UwYx8RJ1g" - } - }, { - "type" : 1826, - "typeName" : "BTMConfigurationParameterQuantity", - "message" : { - "quantityType" : "LENGTH", - "rangeAndDefault" : { - "type" : 181, - "typeName" : "BTQuantityRange", - "message" : { - "units" : "inch", - "minValue" : 0.0, - "maxValue" : 100000.0, - "defaultValue" : 1.0, - "location" : { - "type" : 226, - "typeName" : "BTLocationInfo", - "message" : { - "document" : "", - "version" : "", - "topLevel" : "", - "parseNodeId" : "", - "character" : 0, - "line" : 0, - "column" : 0, - "endCharacter" : 0, - "endLine" : 0, - "endColumn" : 0, - "languageVersion" : 0, - "moduleIds" : { - "type" : 1897, - "typeName" : "BTDocumentVersionElementIds", - "message" : { - "documentId" : "", - "versionId" : "", - "elementId" : "" - } - }, - "elementMicroversion" : "", - "nodeId" : "txWzGqHpRB3cBQkN" - } - } - } - }, - "parameterId" : "height", - "parameterName" : "height", - "hasUserCode" : false, - "nodeId" : "MUbsipn+tCISk54vF" - } - } ], - "configurationParameters.0": [ { - "type" : 2550, - "typeName" : "BTMConfigurationParameterBoolean", - "message" : { - "defaultValue" : true, - "parameterId" : "poo", - "parameterName" : "poo", - "hasUserCode" : false, - "nodeId" : "MyHDRtn7UwYx8RJ1g" - } - }, { - "type" : 1826, - "typeName" : "BTMConfigurationParameterQuantity", - "message" : { - "quantityType" : "LENGTH", - "rangeAndDefault" : { - "type" : 181, - "typeName" : "BTQuantityRange", - "message" : { - "units" : "inch", - "minValue" : 0.0, - "maxValue" : 100000.0, - "defaultValue" : 1.0, - "location" : { - "type" : 226, - "typeName" : "BTLocationInfo", - "message" : { - "document" : "", - "version" : "", - "topLevel" : "", - "parseNodeId" : "", - "character" : 0, - "line" : 0, - "column" : 0, - "endCharacter" : 0, - "endLine" : 0, - "endColumn" : 0, - "languageVersion" : 0, - "moduleIds" : { - "type" : 1897, - "typeName" : "BTDocumentVersionElementIds", - "message" : { - "documentId" : "", - "versionId" : "", - "elementId" : "" - } - }, - "elementMicroversion" : "", - "nodeId" : "txWzGqHpRB3cBQkN" - } - } - } - }, - "parameterId" : "height", - "parameterName" : "height", - "hasUserCode" : false, - "nodeId" : "MUbsipn+tCISk54vF" - } - } ], - "currentConfiguration" : [ { - "type" : 144, - "typeName" : "BTMParameterBoolean", - "message" : { - "value" : true, - "parameterId" : "poo", - "hasUserCode" : false, - "nodeId" : "MV5TJYGmgguksFb3I" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "inch", - "value" : 35.0, - "expression" : "1 in", - "isInteger" : false, - "parameterId" : "height", - "hasUserCode" : false, - "nodeId" : "MtAktgwx5XmCqiuM5" - } - } ], - "currentConfiguration.0": [ { - "type" : 144, - "typeName" : "BTMParameterBoolean", - "message" : { - "value" : true, - "parameterId" : "poo", - "hasUserCode" : false, - "nodeId" : "MV5TJYGmgguksFb3I" - } - }, { - "type" : 147, - "typeName" : "BTMParameterQuantity", - "message" : { - "units" : "inch", - "value" : 25.0, - "expression" : "1 in", - "isInteger" : false, - "parameterId" : "height", - "hasUserCode" : false, - "nodeId" : "MtAktgwx5XmCqiuM5" - } - } ], - "serializationVersion": "1.1.12", - "sourceMicroversion": "e948bc1ade7c5ab16ae07f95", - "rejectMicroversionSkew": false -} \ No newline at end of file From 82fd452a4083542c2afa6621a8c9c3743b299625 Mon Sep 17 00:00:00 2001 From: ethan92429 Date: Thu, 2 Aug 2018 16:32:18 -0400 Subject: [PATCH 2/5] switched themes and fixed sphinx --- .travis.yml | 2 +- docs/.nojekyll | 0 docs/conf.py | 6 ++--- docs/modules.rst | 6 ++--- docs/{onshape.rst => onshapepy.rst} | 36 ++++++++++++++--------------- onshapepy/__init__.py | 2 +- onshapepy/onshape.py | 2 +- 7 files changed, 27 insertions(+), 27 deletions(-) create mode 100644 docs/.nojekyll rename docs/{onshape.rst => onshapepy.rst} (54%) diff --git a/.travis.yml b/.travis.yml index b337b8f..b0b3c71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ deploy: skip-cleanup: true github-token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable keep-history: true - local-dir: _build + local-dir: docs/_build target-branch: gh-pages on: tags: true diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/docs/conf.py b/docs/conf.py index 2547489..9481e52 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,7 +14,7 @@ # import os import sys -sys.path.insert(0, os.path.abspath('..')) +sys.path.append(os.path.join(os.path.dirname(__name__), '..')) # -- Project information ----------------------------------------------------- @@ -46,7 +46,6 @@ 'sphinx.ext.coverage', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode', - 'sphinx.ext.githubpages', ] # Add any paths that contain templates here, relative to this directory. @@ -72,6 +71,7 @@ # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path . exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store'] +html_extra_path = [".nojekyll"] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' @@ -82,7 +82,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/docs/modules.rst b/docs/modules.rst index 72e4d79..20299bf 100644 --- a/docs/modules.rst +++ b/docs/modules.rst @@ -1,7 +1,7 @@ -onshape -======= +onshapepy +========= .. toctree:: :maxdepth: 4 - onshape + onshapepy diff --git a/docs/onshape.rst b/docs/onshapepy.rst similarity index 54% rename from docs/onshape.rst rename to docs/onshapepy.rst index b7716cb..8ebfd6e 100644 --- a/docs/onshape.rst +++ b/docs/onshapepy.rst @@ -1,45 +1,45 @@ -onshape package -=============== +onshapepy package +================= Submodules ---------- -onshape.assembly module ------------------------ +onshapepy.assembly module +------------------------- -.. automodule:: onshape.assembly +.. automodule:: onshapepy.assembly :members: :undoc-members: :show-inheritance: -onshape.client module ---------------------- +onshapepy.client module +----------------------- -.. automodule:: onshape.client +.. automodule:: onshapepy.client :members: :undoc-members: :show-inheritance: -onshape.onshape module ----------------------- +onshapepy.onshape module +------------------------ -.. automodule:: onshape.onshape +.. automodule:: onshapepy.onshape :members: :undoc-members: :show-inheritance: -onshape.part module -------------------- +onshapepy.part module +--------------------- -.. automodule:: onshape.part +.. automodule:: onshapepy.part :members: :undoc-members: :show-inheritance: -onshape.utils module --------------------- +onshapepy.utils module +---------------------- -.. automodule:: onshape.utils +.. automodule:: onshapepy.utils :members: :undoc-members: :show-inheritance: @@ -48,7 +48,7 @@ onshape.utils module Module contents --------------- -.. automodule:: onshape +.. automodule:: onshapepy :members: :undoc-members: :show-inheritance: diff --git a/onshapepy/__init__.py b/onshapepy/__init__.py index f99a211..eaf72c6 100644 --- a/onshapepy/__init__.py +++ b/onshapepy/__init__.py @@ -1,6 +1,6 @@ ''' onshapepy -====== +========= Demonstrates usage of API keys for the Onshape REST API ''' diff --git a/onshapepy/onshape.py b/onshapepy/onshape.py index 189563b..7c7745c 100644 --- a/onshapepy/onshape.py +++ b/onshapepy/onshape.py @@ -1,6 +1,6 @@ ''' onshape -====== +======= Provides access to the Onshape REST API ''' From 5ce2e696111f97209ac88726c59f228ec8caf021 Mon Sep 17 00:00:00 2001 From: ethan92429 Date: Thu, 2 Aug 2018 16:35:52 -0400 Subject: [PATCH 3/5] switched to python 3.5 --- .travis.yml | 2 +- requirements-dev.txt | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b0b3c71..56bdcfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: python sudo: false python: -- '3.6' +- '3.5' before_install: - export NOKOGIRI_USE_SYSTEM_LIBRARIES=true - openssl aes-256-cbc -K $encrypted_0b30f5022c54_key -iv $encrypted_0b30f5022c54_iv diff --git a/requirements-dev.txt b/requirements-dev.txt index 617d7b6..9f352fc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,11 +1,9 @@ ##########sphinx stuff############### Sphinx +sphinx-rtd-theme==0.4.0 ##########codecov################### codecov coverage ##########pytest################### pytest -ruamel.yaml -aide_design -scipy pytest-cov \ No newline at end of file From bddafecd3de42f0d6414a888dff662a1900d7b85 Mon Sep 17 00:00:00 2001 From: ethan92429 Date: Thu, 2 Aug 2018 16:40:27 -0400 Subject: [PATCH 4/5] fixing travis --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 56bdcfb..c3c6038 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,14 +13,14 @@ addons: install: - pip install -r requirements-dev.txt - gem install html-proofer - - cd docs +script: + - pytest --cov=./ + - cd docs # build the docs... should be moved to before_deploy? - make html - make doctest - htmlproofer _build/html --allow_hash_href --file_ignore "_build/html/search.html" -script: -- pytest --cov=./ after_success: -- codecov + - codecov deploy: - provider: pypi user: "$PYPI_USERNAME" From 68aba949d0ac75742ba8daa2736cae344ee50da5 Mon Sep 17 00:00:00 2001 From: ethan92429 Date: Thu, 2 Aug 2018 16:49:22 -0400 Subject: [PATCH 5/5] fixed typo with test_client --- tests/{test_client => test_client.py} | 0 tests/test_exportstl.py | 27 --------------------------- tests/test_part.py | 6 +++--- 3 files changed, 3 insertions(+), 30 deletions(-) rename tests/{test_client => test_client.py} (100%) delete mode 100644 tests/test_exportstl.py diff --git a/tests/test_client b/tests/test_client.py similarity index 100% rename from tests/test_client rename to tests/test_client.py diff --git a/tests/test_exportstl.py b/tests/test_exportstl.py deleted file mode 100644 index df092cd..0000000 --- a/tests/test_exportstl.py +++ /dev/null @@ -1,27 +0,0 @@ -''' -exportstl -=== - -Demos 307 redirects with the Onshape API -''' - -from onshapepy.client import Client - -# stacks to choose from -stacks = { - 'cad': 'https://cad.onshape.com' -} - -# create instance of the onshapepy client; change key to test on another stack -c = Client(stack=stacks['cad'], logging=True) - -# get features for doc -did = "8ec353ba00f37f447b5a61f5" -wid = "04c36c786829759832bd3d1a" -eid = "2918f0f5adfa39d3047f19d0" - -# get the STL export -stl = c.part_studio_stl(did, wid, eid) - -# print to the console -print(stl.text) diff --git a/tests/test_part.py b/tests/test_part.py index fdf1e2a..91429e1 100644 --- a/tests/test_part.py +++ b/tests/test_part.py @@ -1,7 +1,7 @@ -from tests.test_basic import setup_client +from tests.test_client import setup_client from onshapepy.part import Part -from tests.test_basic import assembly -from tests.test_basic import part +from tests.test_client import assembly +from tests.test_client import part my_cube = Part("2d47b6abec9d1de1d2538372", "f2d396ba0762dc1f1dab3de1", "0639ea3c439aa0947744d29a")