-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1954ad3
Showing
23 changed files
with
984 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
name: continuous-integration | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
|
||
pre-commit: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
- uses: pre-commit/[email protected] | ||
|
||
test-package: | ||
|
||
needs: [pre-commit] | ||
|
||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.7', '3.8', '3.9', '3.10'] | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
submodules: true | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install package | ||
run: | | ||
which python | ||
python -m pip install -e .[tests] | ||
python -m pip freeze | ||
- name: Run tests | ||
run: python -m pytest -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- release/* | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install pypa/build | ||
run: python -m pip install build | ||
|
||
- name: Build a binary wheel and a source tarball | ||
run: >- | ||
python -m | ||
build | ||
--sdist | ||
--wheel | ||
--outdir dist/ | ||
- name: Upload distribution artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: release | ||
path: dist/ | ||
|
||
publish: | ||
|
||
needs: [build] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/download-artifact@v2 | ||
name: Download distribution artifact | ||
with: | ||
name: release | ||
path: dist/ | ||
|
||
- name: Publish distribution on Test PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: startsWith(github.ref, 'refs/heads/release/') | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
skip_existing: true | ||
|
||
- uses: softprops/[email protected] | ||
name: Create release | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
with: | ||
files: | | ||
dist/* | ||
generate_release_notes: true | ||
|
||
- name: Publish distribution on PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.egg-info | ||
*.swp | ||
__pycache__/ | ||
build/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
repos: | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.1.0 | ||
hooks: | ||
- id: check-json | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt | ||
rev: 0.1.0 | ||
hooks: | ||
- id: yamlfmt | ||
|
||
- repo: https://github.com/mgedmin/check-manifest | ||
rev: '0.44' | ||
hooks: | ||
- id: check-manifest | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 22.1.0 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.8.4 | ||
hooks: | ||
- id: flake8 | ||
args: [--count, --show-source, --statistics] | ||
additional_dependencies: [flake8-bugbear==21.3.1] | ||
|
||
- repo: https://github.com/asottile/setup-cfg-fmt | ||
rev: v1.20.0 | ||
hooks: | ||
- id: setup-cfg-fmt | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.9.3 | ||
hooks: | ||
- id: isort | ||
args: [--profile, black, --filter-files] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Carl Simon Adorf | ||
|
||
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: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
exclude tests | ||
recursive-exclude tests * | ||
|
||
exclude .pre-commit-config.yaml | ||
exclude .gitlab-ci.yml | ||
|
||
include LICENSE | ||
include README.md | ||
include example.py | ||
recursive-include logos *.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# MarketPlace SDK | ||
|
||
Python Software Development Toolkit (SDK) to communicate with the Materials MarketPlace platform. | ||
|
||
## Installation | ||
|
||
To install the package, execute: | ||
|
||
```console | ||
pip install git+https://github.com/materials-marketplace/python-sdk.git | ||
``` | ||
|
||
## Usage | ||
The [MarketPlace documentation](https://materials-marketplace.readthedocs.io/en/latest/) contains [a tutorial](https://materials-marketplace.readthedocs.io/en/latest/jupyter/sdk.html) on how to configure and use this package. | ||
|
||
## Authors | ||
|
||
* **Carl Simon Adorf (EPFL)** - [@csadorf](https://github.com/csadorf) | ||
* **Pablo de Andres (Fraunhofer IWM)** - [@pablo-de-andres](https://github.com/pablo-de-andres) | ||
* **Pranjali Singh (Fraunhofer IWM)** - [@singhpranjali](https://github.com/singhpranjali) | ||
|
||
See also the list of [contributors](https://github.com/materials-marketplace/python-sdk/contributors). | ||
|
||
## Contact | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
|
||
## For maintainers | ||
|
||
To create a new release, clone the repository, install development dependencies with `pip install -e '.[dev]'`, and then execute `bumpver update --[major|minor|patch]`. | ||
This will: | ||
|
||
1. Create a tagged release with bumped version and push it to the repository. | ||
2. Trigger a GitLab CI workflow that publishes the package on the [GitLab package registry](https://gitlab.cc-asp.fraunhofer.de/MarketPlace/python-sdk/-/packages). | ||
2. Trigger a GitHub actions workflow that creates a GitHub release and publishes it on PyPI. | ||
|
||
Additional notes: | ||
|
||
- The project follows semantic versioning. | ||
- Use the `--dry` option to preview the release change. | ||
- The release tag (e.g. a/b/rc) is determined from the last release. | ||
Use the `--tag` option to switch the release tag. | ||
|
||
## MIT License | ||
|
||
Copyright (c) 2021 Carl Simon Adorf (EPFL) | ||
|
||
All rights reserved. | ||
|
||
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: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
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. | ||
|
||
## Acknowledgements | ||
|
||
This work is supported by the | ||
[MARVEL National Centre for Competency in Research](<http://nccr-marvel.ch>) funded by the [Swiss National Science Foundation](<http://www.snf.ch/en>), | ||
and the MarketPlace project funded by [Horizon 2020](https://ec.europa.eu/programmes/horizon2020/) under the H2020-NMBP-25-2017 call (Grant No. 760173). | ||
|
||
<div style="text-align:center"> | ||
<img src="logos/MARVEL.png" alt="MARVEL" height="75px"> | ||
<img src="logos/MarketPlace.png" alt="MarketPlace" height="75px"> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""Simple script illustrating some of the features of this package.""" | ||
from pprint import pprint | ||
|
||
from marketplace.app.marketplace_app import MarketPlaceApp | ||
from marketplace.core import MarketPlaceClient | ||
|
||
# General MarketPlaceClient for simple requests like user info | ||
# Remember to save your access token in an environment variable with | ||
# export MP_ACCESS_TOKEN="<token>" | ||
mp_client = MarketPlaceClient() | ||
# Show the user information | ||
pprint(mp_client.userinfo) | ||
|
||
|
||
# To simply instantiate a MarketPlaceApp with a client id | ||
mp = MarketPlaceApp(client_id="<application_client_id>") | ||
print(mp.heartbeat()) | ||
|
||
|
||
# To extend the MarketPlaceApp with custom implementations | ||
class MyMarketPlaceApp(MarketPlaceApp): | ||
def heartbeat(self) -> str: | ||
res = super().heartbeat() | ||
return f"heartbeat response: {res}" | ||
|
||
|
||
my_mp_app = MyMarketPlaceApp(client_id="<application_client_id>") | ||
print(my_mp_app.heartbeat()) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
"""Software Development Toolkit to communicate with the Materials MarketPlace | ||
platform. | ||
.. currentmodule:: marketplace | ||
.. moduleauthor:: Carl Simon Adorf <[email protected]> | ||
""" | ||
|
||
from .core import MarketPlaceClient | ||
from .version import __version__ | ||
|
||
__all__ = [ | ||
"MarketPlaceClient", | ||
"__version__", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"""Module for handling the different types of MarketPlace apps and their | ||
capabilities. | ||
.. currentmodule:: marketplace.app | ||
.. moduleauthor:: Pablo de Andres, Pranjali Singh (Fraunhofer IWM) | ||
""" | ||
from marketplace.app.marketplace_app import MarketPlaceApp | ||
|
||
__all__ = [ | ||
"MarketPlaceApp", | ||
] |
Oops, something went wrong.