Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: specklesystems/specklepy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.14.1
Choose a base ref
...
head repository: specklesystems/specklepy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 10,243 additions and 2,443 deletions.
  1. +63 −35 .circleci/config.yml
  2. +1 −1 .devcontainer/Dockerfile
  3. +0 −12 .github/workflows/close-issue.yml
  4. +0 −12 .github/workflows/open-issue.yml
  5. +9 −9 .pre-commit-config.yaml
  6. +5 −35 README.md
  7. +120 −0 docker-compose.yml
  8. +1,391 −1,027 poetry.lock
  9. +15 −11 pyproject.toml
  10. +24 −0 src/speckle_automate/__init__.py
  11. +436 −0 src/speckle_automate/automation_context.py
  12. +155 −0 src/speckle_automate/fixtures.py
  13. +193 −0 src/speckle_automate/runner.py
  14. +98 −0 src/speckle_automate/schema.py
  15. +3 −0 src/specklepy/__init__.py
  16. +109 −157 src/specklepy/api/client.py
  17. +16 −103 src/specklepy/api/credentials.py
  18. +73 −115 src/specklepy/api/host_applications.py
  19. +0 −198 src/specklepy/api/models.py
  20. +35 −0 src/specklepy/api/models/__init__.py
  21. +11 −67 src/specklepy/api/operations.py
  22. +9 −113 src/specklepy/api/resource.py
  23. +40 −8 src/specklepy/api/resources/__init__.py
  24. +144 −0 src/specklepy/api/resources/current/active_user_resource.py
  25. +74 −0 src/specklepy/api/resources/current/model_resource.py
  26. +104 −0 src/specklepy/api/resources/current/other_user_resource.py
  27. +54 −0 src/specklepy/api/resources/current/project_invite_resource.py
  28. +63 −0 src/specklepy/api/resources/current/project_resource.py
  29. +70 −0 src/specklepy/api/resources/current/server_resource.py
  30. +64 −0 src/specklepy/api/resources/current/subscription_resource.py
  31. +63 −0 src/specklepy/api/resources/current/version_resource.py
  32. +9 −0 src/specklepy/api/resources/deprecated/active_user.py
  33. +108 −0 src/specklepy/api/resources/deprecated/branch.py
  34. +134 −0 src/specklepy/api/resources/deprecated/commit.py
  35. +63 −0 src/specklepy/api/resources/deprecated/object.py
  36. +11 −0 src/specklepy/api/resources/deprecated/other_user.py
  37. +9 −0 src/specklepy/api/resources/deprecated/server.py
  38. +322 −0 src/specklepy/api/resources/deprecated/stream.py
  39. +107 −0 src/specklepy/api/resources/deprecated/subscriptions.py
  40. +153 −0 src/specklepy/api/resources/deprecated/user.py
  41. +13 −113 src/specklepy/api/wrapper.py
  42. 0 {tests/intergration → src/specklepy/core/api}/__init__.py
  43. +289 −0 src/specklepy/core/api/client.py
  44. +177 −0 src/specklepy/core/api/credentials.py
  45. +29 −0 src/specklepy/core/api/enums.py
  46. +116 −0 src/specklepy/core/api/host_applications.py
  47. +42 −0 src/specklepy/core/api/inputs/__init__.py
  48. +26 −0 src/specklepy/core/api/inputs/model_inputs.py
  49. +47 −0 src/specklepy/core/api/inputs/project_inputs.py
  50. +15 −0 src/specklepy/core/api/inputs/user_inputs.py
  51. +37 −0 src/specklepy/core/api/inputs/version_inputs.py
  52. +71 −0 src/specklepy/core/api/models/__init__.py
  53. +171 −0 src/specklepy/core/api/models/current.py
  54. +144 −0 src/specklepy/core/api/models/deprecated.py
  55. +36 −0 src/specklepy/core/api/models/subscription_messages.py
  56. +139 −0 src/specklepy/core/api/operations.py
  57. +165 −0 src/specklepy/core/api/resource.py
  58. +43 −0 src/specklepy/core/api/resources/__init__.py
  59. +197 −56 src/specklepy/{api/resources/active_user.py → core/api/resources/current/active_user_resource.py}
  60. +280 −0 src/specklepy/core/api/resources/current/model_resource.py
  61. +90 −26 src/specklepy/{api/resources/other_user.py → core/api/resources/current/other_user_resource.py}
  62. +254 −0 src/specklepy/core/api/resources/current/project_invite_resource.py
  63. +336 −0 src/specklepy/core/api/resources/current/project_resource.py
  64. +17 −9 src/specklepy/{api/resources/server.py → core/api/resources/current/server_resource.py}
  65. +218 −0 src/specklepy/core/api/resources/current/subscription_resource.py
  66. +234 −0 src/specklepy/core/api/resources/current/version_resource.py
  67. +15 −0 src/specklepy/core/api/resources/deprecated/active_user.py
  68. +19 −9 src/specklepy/{api/resources → core/api/resources/deprecated}/branch.py
  69. +21 −12 src/specklepy/{api/resources → core/api/resources/deprecated}/commit.py
  70. +1 −1 src/specklepy/{api/resources → core/api/resources/deprecated}/object.py
  71. +15 −0 src/specklepy/core/api/resources/deprecated/other_user.py
  72. +11 −0 src/specklepy/core/api/resources/deprecated/server.py
  73. +48 −89 src/specklepy/{api/resources → core/api/resources/deprecated}/stream.py
  74. +8 −2 src/specklepy/{api/resources → core/api/resources/deprecated}/subscriptions.py
  75. +6 −8 src/specklepy/{api/resources → core/api/resources/deprecated}/user.py
  76. +2 −0 src/specklepy/core/api/resources/graphql.config.yml
  77. +9 −0 src/specklepy/core/api/responses.py
  78. +282 −0 src/specklepy/core/api/wrapper.py
  79. +1 −0 src/specklepy/core/helpers/speckle_path_provider.py
  80. +17 −13 src/specklepy/logging/metrics.py
  81. +15 −0 src/specklepy/objects/GIS/CRS.py
  82. +24 −0 src/specklepy/objects/GIS/__init__.py
  83. +74 −0 src/specklepy/objects/GIS/geometry.py
  84. +142 −0 src/specklepy/objects/GIS/layers.py
  85. +19 −2 src/specklepy/objects/__init__.py
  86. +13 −15 src/specklepy/objects/base.py
  87. +17 −13 src/specklepy/objects/geometry.py
  88. +100 −0 src/specklepy/objects/graph_traversal/commit_object_builder.py
  89. +125 −0 src/specklepy/objects/graph_traversal/traversal.py
  90. +26 −13 src/specklepy/objects/other.py
  91. +1 −4 src/specklepy/objects/structural/__init__.py
  92. +1 −1 src/specklepy/objects/structural/axis.py
  93. +45 −5 src/specklepy/objects/units.py
  94. +3 −11 src/specklepy/transports/abstract_transport.py
  95. +10 −9 src/specklepy/transports/memory.py
  96. +8 −2 src/specklepy/transports/server/batch_sender.py
  97. +27 −18 src/specklepy/transports/server/server.py
  98. +10 −31 src/specklepy/transports/sqlite.py
  99. 0 tests/integration/__init__.py
  100. +62 −0 tests/integration/client/current/test_active_user_resource.py
  101. +151 −0 tests/integration/client/current/test_model_resource.py
  102. +32 −0 tests/integration/client/current/test_other_user_resource.py
  103. +176 −0 tests/integration/client/current/test_project_invite_resource.py
  104. +93 −0 tests/integration/client/current/test_project_resource.py
  105. +185 −0 tests/integration/client/current/test_subscription_resource.py
  106. +198 −0 tests/integration/client/current/test_version_resource.py
  107. +7 −8 tests/{intergration → integration/client/deprecated}/test_active_user.py
  108. 0 tests/{intergration → integration/client/deprecated}/test_branch.py
  109. 0 tests/{intergration → integration/client/deprecated}/test_commit.py
  110. 0 tests/{intergration → integration/client/deprecated}/test_objects.py
  111. +2 −2 tests/{intergration → integration/client/deprecated}/test_other_user.py
  112. +1 −0 tests/{intergration → integration/client/deprecated}/test_server.py
  113. +15 −20 tests/{intergration → integration/client/deprecated}/test_stream.py
  114. 0 tests/{intergration → integration/client/deprecated}/test_user.py
  115. 0 tests/{intergration → integration/client}/test_client_and_ops.py
  116. +40 −15 tests/{intergration → integration}/conftest.py
  117. 0 tests/integration/speckle_automate/__init__.py
  118. +260 −0 tests/integration/speckle_automate/test_automation_context.py
  119. +1 −1 tests/{intergration → integration}/test_serialization.py
  120. +97 −4 tests/{intergration → integration}/test_wrapper.py
  121. +77 −0 tests/unit/test_account_server_migration.py
  122. +5 −4 tests/unit/test_base.py
  123. +4 −4 tests/unit/test_geometry.py
  124. +105 −0 tests/unit/test_graph_traversal.py
  125. +6 −1 tests/unit/test_type_validation.py
  126. +52 −0 tests/unit/test_unit_scaling.py
  127. +15 −19 utils/installer.py
98 changes: 63 additions & 35 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,76 @@
version: 2.1

orbs:
python: circleci/python@2.0.3
codecov: codecov/codecov@3.2.2
codecov: codecov/codecov@3.3.0

jobs:
test:
pre-commit:
parameters:
config_file:
default: ./.pre-commit-config.yaml
description: Optional, path to pre-commit config file.
type: string
cache_prefix:
default: ''
description: |
Optional cache prefix to be used on CircleCI. Can be used for cache busting or to ensure multiple jobs use different caches.
type: string
docker:
- image: "cimg/python:<<parameters.tag>>"
- image: "cimg/node:16.15"
- image: "cimg/redis:6.2"
- image: "cimg/postgres:14.2"
environment:
POSTGRES_DB: speckle2_test
POSTGRES_PASSWORD: speckle
POSTGRES_USER: speckle
- image: "speckle/speckle-server"
command: ["bash", "-c", "/wait && node bin/www"]
environment:
POSTGRES_URL: "127.0.0.1"
POSTGRES_USER: "speckle"
POSTGRES_PASSWORD: "speckle"
POSTGRES_DB: "speckle2_test"
REDIS_URL: "redis://127.0.0.1"
SESSION_SECRET: "keyboard cat"
STRATEGY_LOCAL: "true"
CANONICAL_URL: "http://localhost:3000"
WAIT_HOSTS: 127.0.0.1:5432, 127.0.0.1:6379
DISABLE_FILE_UPLOADS: "true"
- image: speckle/pre-commit-runner:latest
resource_class: medium
steps:
- checkout
- restore_cache:
keys:
- cache-pre-commit-<<parameters.cache_prefix>>-{{ checksum "<<parameters.config_file>>" }}
- run:
name: Install pre-commit hooks
command: pre-commit install-hooks --config <<parameters.config_file>>
- save_cache:
key: cache-pre-commit-<<parameters.cache_prefix>>-{{ checksum "<<parameters.config_file>>" }}
paths:
- ~/.cache/pre-commit
- run:
name: Run pre-commit
command: pre-commit run --all-files
- run:
command: git --no-pager diff
name: git diff
when: on_fail

test:
machine:
image: ubuntu-2204:2023.02.1
docker_layer_caching: false
resource_class: medium
parameters:
tag:
default: "3.8"
default: "3.11"
type: string
steps:
- checkout
- run: python --version
- run:
command: python -m pip install --upgrade pip
name: upgrade pip
- python/install-packages:
pkg-manager: poetry
- run: poetry run pytest --cov --cov-report xml:reports/coverage.xml --junitxml=reports/test-results.xml

name: Install python
command: |
pyenv install -s << parameters.tag >>
pyenv global << parameters.tag >>
- run:
name: Startup the Speckle Server
command: docker compose -f docker-compose.yml up -d
- run:
name: Install Poetry
command: |
pip install poetry
- run:
name: Install packages
command: poetry install
- run:
name: Run tests
command: poetry run pytest --cov --cov-report xml:reports/coverage.xml --junitxml=reports/test-results.xml
- store_test_results:
path: reports

- store_artifacts:
path: reports

- codecov/upload

deploy:
@@ -62,16 +85,21 @@ jobs:
workflows:
main:
jobs:
- pre-commit:
filters:
tags:
only: /.*/
- test:
matrix:
parameters:
tag: ["3.7", "3.8", "3.9", "3.10", "3.11"]
tag: ["3.11"]
filters:
tags:
only: /.*/
- deploy:
context: pypi
requires:
- pre-commit
- test
filters:
tags:
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -22,6 +22,6 @@ RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/

USER vscode

RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
RUN curl -sSL https://install.python-poetry.org | python3 -

ENV PATH=$PATH:$HOME/.poetry/env
12 changes: 0 additions & 12 deletions .github/workflows/close-issue.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/open-issue.yml

This file was deleted.

18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -2,23 +2,23 @@ repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
hooks:
- id: ruff
rev: v0.0.186
rev: v0.8.2

- repo: https://github.com/commitizen-tools/commitizen
hooks:
- id: commitizen
- id: commitizen-branch
stages:
- push
rev: v2.38.0
- id: commitizen
- id: commitizen-branch
stages:
- push
rev: v3.13.0

- repo: https://github.com/pycqa/isort
rev: v5.11.3
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.12.0
rev: 24.10.0
hooks:
- id: black
# It is recommended to specify the latest version of Python
@@ -27,7 +27,7 @@ repos:
# https://pre-commit.com/#top_level-default_language_version
# language_version: python3.11
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
40 changes: 5 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,46 +2,16 @@
<img src="https://user-images.githubusercontent.com/2679513/131189167-18ea5fe1-c578-47f6-9785-3748178e4312.png" width="150px"/><br/>
Speckle | specklepy 🐍
</h1>
<h3 align="center">
The Python SDK
</h3>
<p align="center"><b>Speckle</b> is the data infrastructure for the AEC industry.</p><br/>

<p align="center"><a href="https://twitter.com/SpeckleSystems"><img src="https://img.shields.io/twitter/follow/SpeckleSystems?style=social" alt="Twitter Follow"></a> <a href="https://speckle.community"><img src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fspeckle.community&amp;style=flat-square&amp;logo=discourse&amp;logoColor=white" alt="Community forum users"></a> <a href="https://speckle.systems"><img src="https://img.shields.io/badge/https://-speckle.systems-royalblue?style=flat-square" alt="website"></a> <a href="https://speckle.guide/dev/"><img src="https://img.shields.io/badge/docs-speckle.guide-orange?style=flat-square&amp;logo=read-the-docs&amp;logoColor=white" alt="docs"></a></p>
<p align="center"><a href="https://github.com/specklesystems/specklepy/"><img src="https://circleci.com/gh/specklesystems/specklepy.svg?style=svg&amp;circle-token=76eabd350ea243575cbb258b746ed3f471f7ac29" alt="Speckle-Next"></a><a href="https://codecov.io/gh/specklesystems/specklepy">
<img src="https://codecov.io/gh/specklesystems/specklepy/branch/main/graph/badge.svg?token=8KQFL5N0YF"/>
</a> </p>

# About Speckle

What is Speckle? Check our ![YouTube Video Views](https://img.shields.io/youtube/views/B9humiSpHzM?label=Speckle%20in%201%20minute%20video&style=social)

### Features

- **Object-based:** say goodbye to files! Speckle is the first object based platform for the AEC industry
- **Version control:** Speckle is the Git & Hub for geometry and BIM data
- **Collaboration:** share your designs collaborate with others
- **3D Viewer:** see your CAD and BIM models online, share and embed them anywhere
- **Interoperability:** get your CAD and BIM models into other software without exporting or importing
- **Real time:** get real time updates and notifications and changes
- **GraphQL API:** get what you need anywhere you want it
- **Webhooks:** the base for a automation and next-gen pipelines
- **Built for developers:** we are building Speckle with developers in mind and got tools for every stack
- **Built for the AEC industry:** Speckle connectors are plugins for the most common software used in the industry such as Revit, Rhino, Grasshopper, AutoCAD, Civil 3D, Excel, Unreal Engine, Unity, QGIS, Blender and more!

### Try Speckle now!
> Speckle is the first AEC data hub that connects with your favorite AEC tools. Speckle exists to overcome the challenges of working in a fragmented industry where communication, creative workflows, and the exchange of data are often hindered by siloed software and processes. It is here to make the industry better.
Give Speckle a try in no time by:

- [![speckle XYZ](https://img.shields.io/badge/https://-speckle.xyz-0069ff?style=flat-square&logo=hackthebox&logoColor=white)](https://speckle.xyz) ⇒ creating an account at our public server
- [![create a droplet](https://img.shields.io/badge/Create%20a%20Droplet-0069ff?style=flat-square&logo=digitalocean&logoColor=white)](https://marketplace.digitalocean.com/apps/speckle-server?refcode=947a2b5d7dc1) ⇒ deploying an instance in 1 click

### Resources

- [![Community forum users](https://img.shields.io/badge/community-forum-green?style=for-the-badge&logo=discourse&logoColor=white)](https://speckle.community) for help, feature requests or just to hang with other speckle enthusiasts, check out our community forum!
- [![website](https://img.shields.io/badge/tutorials-speckle.systems-royalblue?style=for-the-badge&logo=youtube)](https://speckle.systems) our tutorials portal is full of resources to get you started using Speckle
- [![docs](https://img.shields.io/badge/docs-speckle.guide-orange?style=for-the-badge&logo=read-the-docs&logoColor=white)](https://speckle.guide/dev/) reference on almost any end-user and developer functionality
<h3 align="center">
The Python SDK
</h3>

<p align="center"><a href="https://codecov.io/gh/specklesystems/specklepy"><img src="https://codecov.io/gh/specklesystems/specklepy/branch/main/graph/badge.svg?token=8KQFL5N0YF" alt="Codecov"></a></p>

# Repo structure

120 changes: 120 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
version: "3.9"
name: "speckle-server"

services:
####
# Speckle Server dependencies
#######
postgres:
image: "postgres:14.5-alpine"
restart: always
environment:
POSTGRES_DB: speckle
POSTGRES_USER: speckle
POSTGRES_PASSWORD: speckle
volumes:
- postgres-data:/var/lib/postgresql/data/
healthcheck:
# the -U user has to match the POSTGRES_USER value
test: ["CMD-SHELL", "pg_isready -U speckle"]
interval: 5s
timeout: 5s
retries: 30

redis:
image: "redis:6.0-alpine"
restart: always
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 5s
timeout: 5s
retries: 30

minio:
image: "minio/minio:RELEASE.2023-10-25T06-33-25Z"
command: server /data --console-address ":9001"
restart: always
volumes:
- minio-data:/data
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -o /dev/null http://127.0.0.1:9000/minio/index.html",
]
interval: 5s
timeout: 30s
retries: 30
start_period: 10s

####
# Speckle Server
#######

speckle-frontend:
image: speckle/speckle-frontend-2:latest
restart: always
ports:
- "0.0.0.0:8080:8080"

speckle-server:
image: speckle/speckle-server:latest
restart: always
healthcheck:
test:
- CMD
- /nodejs/bin/node
- -e
- "try { require('node:http').request({headers: {'Content-Type': 'application/json'}, port:3000, hostname:'127.0.0.1', path:'/readiness', method: 'GET', timeout: 2000 }, (res) => { body = ''; res.on('data', (chunk) => {body += chunk;}); res.on('end', () => {process.exit(res.statusCode != 200 || body.toLowerCase().includes('error'));}); }).end(); } catch { process.exit(1); }"
interval: 10s
timeout: 10s
retries: 3
start_period: 90s
ports:
- "0.0.0.0:3000:3000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
minio:
condition: service_healthy
environment:
# TODO: Change this to the URL of the speckle server, as accessed from the network
CANONICAL_URL: "http://127.0.0.1:8080"
SPECKLE_AUTOMATE_URL: "http://127.0.0.1:3030"

# TODO: Change thvolumes:
REDIS_URL: "redis://redis"

S3_ENDPOINT: "http://minio:9000"
S3_ACCESS_KEY: "minioadmin"
S3_SECRET_KEY: "minioadmin"
S3_BUCKET: "speckle-server"
S3_CREATE_BUCKET: "true"

FILE_SIZE_LIMIT_MB: 100
MAX_PROJECT_MODELS_PER_PAGE: 500

# TODO: Change this to a unique secret for this server
SESSION_SECRET: "TODO:ReplaceWithLongString"

STRATEGY_LOCAL: "true"
DEBUG: "speckle:*"

POSTGRES_URL: "postgres"
POSTGRES_USER: "speckle"
POSTGRES_PASSWORD: "speckle"
POSTGRES_DB: "speckle"
ENABLE_MP: "false"

networks:
default:
name: speckle-server

volumes:
postgres-data:
redis-data:
minio-data:
Loading