The Coscine Python SDK provides a pythonic interface to the Coscine REST API.
Project description
DISCLAIMER
Issues have been permanently disabled due to increasing amounts of spam. If you have any questions or would like to report a bug, request a feature or have any other business similar to that, you can send a good old-fashioned E-Mail to the Coscine Technical Adaption Mailing List or contact me personally via my personal Mail (Click on my GitLab profile and copy the full name in the browsers address bar including the dot between first and last name. Then append (at) rwth-aachen.de). In either cases I'll get a Mail and am able to respond.
Coscine Python SDK
Coscine, short for Collaborative Scientific
Integration Environment, is a platform for Research Data Management.
About
The Coscine Python SDK is an open source python package providing a pythonic interface to the Coscine REST API.
Features:
- Project Management
- Create, modify or delete projects
- Add/Invite members to projects and set their roles
- Download projects and all their content
- Resource Management
- Create, modify or delete resources
- Download resources and all of their content
- File and Metadata Management
- Upload, download and delete files
- Interact with metadata in an intuitive pythonic manner
- Fetch S3 access credentials
DISCLAIMER
Please note that this python module is developed and maintained by the scientific community and even though Copyright remains with RWTH Aachen, it is not an official service that RWTH Aachen provides support for. Direct bug reports, feature requests and general questions at this repository via the issues feature.
Example Code
Uploading a file to a resource located in a subproject:
import coscine
from datetime import datetime
token: str = "My Coscine API Token"
client = coscine.Client(token)
project = client.project("My Project").subproject("My Subproject")
resource = project.resource("My Resource")
metadata = resource.metadata_form()
metadata["Author"] = "Dr. Akula"
metadata["Created"] = datetime.now()
metadata["Discipline"] = "Medicine"
metadata["DAP"] = 0.32
# ...
resource.upload("file.txt", "C:/databases/file.txt", metadata)
Listing all files in all resources of a project:
import coscine
token: str = "My Coscine API Token"
client = coscine.Client(token)
for resource in client.project("My Project").resources():
for file in resource.contents():
if not file.is_folder:
print(file.path)
More examples can be found in the online documentation.
Installation
via the Python Package Index (PyPi)
The Coscine Python SDK is hosted on the Python Package Index (PyPi).
You can download and install the package with pip:
py -m pip install coscine
via Conda
The package version hosted on the Python Package Index (PyPi) is automatically mirrored in the community driven packaging for Conda. You can download and install the package with conda:
conda install -c conda-forge coscine
via Git
Manual installation:
git clone https://git.rwth-aachen.de/coscine/community-features/coscine-python-sdk.git
cd ./coscine-python-sdk
py -m pip install .
Documentation
The source code has been thorougly documented with Python DOCstrings.
Documentation can be generated via a variety of tools that take advantage
of these DOCstrings, such as pydoc or pdoc.
Use the following script to generate documentation with pdoc:
cd ./coscine-python-sdk
py -m pip install pdoc
py -m pdoc --docformat numpy --template-dir src/docs/template -o ./public ./src/coscine
The documentation inside of this repository is automatically deployed to a GitLab-Pages instance for online access.
Contact
To report bugs, request features or resolve questions open an issue inside
of the current git repository.
Contributions and any help on improving this package are appreciated. To
contribute source code you may fork the repository and open a merge request
or simply submit a short and relevant snippet or fix inside of an issue.
More information on contributing can be found in CONTRIBUTING.md.
License
This project is Open Source Software and licensed under the terms of the MIT License.
MIT License
Copyright (c) 2018-2023 RWTH Aachen University
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.