Skip to content

Commit e3bdd3c

Browse files
committed
Initial commit
0 parents  commit e3bdd3c

31 files changed

Lines changed: 3720 additions & 0 deletions

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
max_line_length = 88
10+
trim_trailing_whitespace = true
11+
12+
[{*.md,*.yml}]
13+
indent_size = 2

.github/workflows/python-docs.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Python docs
3+
4+
on:
5+
workflow_run:
6+
workflows: ["Python package"]
7+
types: [completed]
8+
branches: [master]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.x"
19+
- name: Install dependencies
20+
run: python -m pip install --upgrade pip sphinx sphinx_rtd_theme
21+
- name: Build docs
22+
run: |
23+
cd docs
24+
make html
25+
- name: Upload docs
26+
uses: actions/upload-artifact@v4
27+
with:
28+
path: _build/html
29+
- uses: peaceiris/actions-gh-pages@v3
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
publish_dir: docs/_build/html
33+
...
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Python package
3+
4+
on: [push, pull_request]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
python-version: ["3.10", "3.11"]
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
cache: "pip"
20+
- name: Install dependencies
21+
run: python -m pip install --upgrade pip attrs requests requests-toolbelt ruff pytest
22+
- name: Lint with Ruff
23+
run: ruff --output-format=github .
24+
- name: Test with pytest
25+
run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml
26+
- name: Upload pytest test results
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: pytest-results-${{ matrix.python-version }}
30+
path: junit/test-results-${{ matrix.python-version }}.xml
31+
# Use always() to always run this step to publish test results when there are test failures
32+
if: ${{ always() }}
33+
...
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Python publish
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v4
14+
with:
15+
# Use latest stable version
16+
python-version: "3.x"
17+
- name: Install build dependencies
18+
run: python -m pip install --upgrade pip build
19+
- name: Build package
20+
run: python -m build
21+
- uses: actions/upload-artifact@v4
22+
with:
23+
name: python-dist
24+
path: dist/
25+
publish:
26+
needs: [build]
27+
runs-on: ubuntu-latest
28+
permissions:
29+
id-token: write
30+
environment:
31+
name: release
32+
url: https://pypi.org/p/metafold
33+
steps:
34+
- uses: actions/download-artifact@v4
35+
with:
36+
name: python-dist
37+
path: dist/
38+
- name: Publish package to PyPi
39+
uses: pypa/gh-action-pypi-publish@release/v1
40+
...

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.egg-info
2+
__pycache__
3+
build
4+
dist
5+
docs/_build

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2024 Metafold 3D
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Metafold SDK for Python
2+
3+
## Installation
4+
5+
```
6+
pip install metafold
7+
```
8+
9+
## Usage
10+
11+
```
12+
from metafold import MetafoldClient
13+
14+
access_token = "..."
15+
project_id = "123"
16+
17+
metafold = MetafoldClient(access_token, project_id)
18+
19+
assets = metafold.assets.list()
20+
print(assets[0].name)
21+
22+
asset = metafold.assets.get("123")
23+
print(asset.name)
24+
```
25+
26+
Read the [documentation][] for more info or play around with one of the
27+
[examples](examples).
28+
29+
[documentation]: https://Metafold3d.github.io/metafold-python/

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/account.png

88 KB
Loading

docs/conf.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# Add local source to front of Python path
7+
from pathlib import Path
8+
import sys
9+
sys.path.insert(0, str(Path(__file__).parents[1]))
10+
11+
# -- Project information -----------------------------------------------------
12+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
13+
14+
project = 'metafold'
15+
copyright = '2024, Metafold 3D'
16+
author = 'Metafold 3D'
17+
18+
# -- General configuration ---------------------------------------------------
19+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
20+
21+
extensions = ['sphinx_rtd_theme', 'sphinx.ext.napoleon']
22+
23+
templates_path = ['_templates']
24+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
25+
26+
27+
28+
# -- Options for HTML output -------------------------------------------------
29+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
30+
31+
html_theme = 'sphinx_rtd_theme'
32+
html_static_path = ['_static']

0 commit comments

Comments
 (0)