Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 17 committers (5.9%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.5%) to scientific vocabulary
Keywords
Repository
Python client API for LabKey Server
Basic Info
- Host: GitHub
- Owner: LabKey
- License: apache-2.0
- Language: Python
- Default Branch: develop
- Size: 341 KB
Statistics
- Stars: 22
- Watchers: 40
- Forks: 17
- Open Issues: 7
- Releases: 30
Topics
Metadata Files
README.md
Python API for LabKey Server
Lets you query, insert, and update data on a LabKey Server using Python.
Features
The following APIs can be used against a LabKey Server instance.
Query API - sample code
- delete_rows() - Delete records in a table.
- execute_sql() - Execute SQL (LabKey SQL dialect) through the query module.
- insert_rows() - Insert rows into a table.
- select_rows() - Query and get results sets.
- update_rows() - Update rows in a table.
- move_rows()() - Move rows in a table.
- truncate_table() - Delete all rows from a table.
Domain API - sample code
- create() - Create many types of domains (e.g. lists, datasets).
- drop() - Delete a domain.
- get() - Get a domain design.
- infer_fields() - Infer fields for a domain design from a file.
- save() - Save changes to a domain design.
- conditional_format() - Create a conditional format on a field.
Experiment API - sample code
- load_batch() - Retrieve assay data (batch level).
- save_batch() - Save assay data (batch level).
Security API - sample code
- Available for administrating and configuring user accounts and permissions.
Storage API - docs
- Create, update, or delete a LabKey Freezer Manager storage item.
WebDav - docs
- Convenience methods for creating "webdavclient3" clients and building webdav file paths.
Installation
To install, simply use pip:
bash
$ pip install labkey
Note: For users who installed this package before it was published to PyPI (before v0.3.0) it is recommended you uninstall and reinstall the package rather than attempting to upgrade. This is due to a change in the package's versioning semantics.
Credentials
Set Up a netrc File
On a Mac, UNIX, or Linux system the netrc file should be named .netrc (dot netrc) and on Windows it should be named _netrc (underscore netrc). The file should be located in your home directory and the permissions on the file must be set so that you are the only user who can read it, i.e. it is unreadable to everyone else.
To create the netrc on a Windows machine, first create an environment variable called ’HOME’ that is set to your home directory (for example, C:/Users/johndoe) or any directory you want to use.
In that directory, create a text file with the prefix appropriate to your system, either an underscore or dot.
The following three lines must be included in the file. The lines must be separated by either white space (spaces, tabs, or newlines) or commas:
machine <remote-instance-of-labkey-server>
login <user-email>
password <user-password>
For example:
machine mymachine.labkey.org
login user@labkey.org
password mypassword
Note that the netrc file only deals with connections at the machine level and should not include a port or protocol designation, meaning both "mymachine.labkey.org:8888" and "https://mymachine.labkey.org" are incorrect.
Old credentials
As of v0.4.0 this API no longer supports using a .labkeycredentials.txt file, and now uses the .netrc files similar to the other labkey APIs. Additional .netrc setup instructions can be found at the link.
Examples
Sample code is available in the samples directory.
The following gets data from the Users table on your local machine:
```python from labkey.api_wrapper import APIWrapper
print("Create an APIWrapper") labkey_server = 'localhost:8080'
in this example, Tutorials is a project name and HIV study is a subfolder under it.
container_path = 'Tutorials/HIV Study' contextPath = 'labkey' schema = 'core' table = 'Users'
Note: If developing against localhost with https disabled, set use_ssl=False below
api = APIWrapper(labkeyserver, containerpath, contextPath)
Makes an API request to https://www.example.com/labkey/tutorials/hiv%20study/query-getQuery.api
result = api.query.select_rows(schema, table)
if result is not None: print(result['rows'][0]) print("selectrows: Number of rows returned: " + str(result['rowCount'])) else: print('selectrows: Failed to load results from ' + schema + '.' + table) ```
Supported Versions
Python 3.10+ is fully supported. <!-- Note: update setup.py python_requires if you change this --> LabKey Server v15.1 and later.
Contributing
This package is maintained by LabKey. If you have any questions or need support, please use the LabKey Server developer support forum.
Setup
To install the necessary dependencies for local development you can run the following command:
bash
pip install -e '.[dev]'
Formatting your code
When contributing changes please use Black to format your code. To run Black you can run the following command:
bash
black .
After black has run it may have formatted some files, commit the changed files before opening a PR.
Testing
If you are looking to contribute please run the tests before issuing a PR. The tests can be run with:
bash
$ pytest .
The integration tests do not run by default. If you want to run the integration tests make sure you have a live server running, a netrc file, and run the following command:
bash
$ pytest . -m "integration"
Maintainers
Package maintainer's can reference the Python Package Maintenance document (requires permission) for updating releases.
To build the package before releasing you will need to install the build dependencies. This can be done by running:
bash
pip install -e '.[build]'
To build the package you can run:
bash
python -m build
You should now have a dist/ folder with two files:
labkey-<version from __init__.py>.tar.gz- This is the source distributionlabkey-<version from __init__.py>-py3-none-any.whl- This is the wheel
Owner
- Name: LabKey
- Login: LabKey
- Kind: organization
- Email: info@labkey.com
- Location: Seattle, WA
- Website: https://www.labkey.com/
- Repositories: 59
- Profile: https://github.com/LabKey
GitHub Events
Total
- Release event: 1
- Delete event: 7
- Issue comment event: 5
- Push event: 11
- Pull request review event: 10
- Pull request review comment event: 5
- Pull request event: 12
- Fork event: 1
- Create event: 6
Last Year
- Release event: 1
- Delete event: 7
- Issue comment event: 5
- Push event: 11
- Pull request review event: 10
- Pull request review comment event: 5
- Pull request event: 12
- Fork event: 1
- Create event: 6
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| labkey-nicka | n****a@l****m | 56 |
| Alan Vezina | a****v@l****m | 17 |
| labkey-steveh | s****h@l****m | 13 |
| labkey-ians | i****n | 8 |
| labkey-eyounske | e****e@l****m | 8 |
| RosalineP | r****p@l****m | 7 |
| labkey-klum | k****m@l****m | 6 |
| Matthew Bowden | b****m@s****u | 5 |
| Chris Joosse | c****j@l****m | 2 |
| labkey-adam | a****m@l****m | 2 |
| Cory Nathe | c****e@l****m | 2 |
| Ian Sigmon | l****s | 2 |
| jryurkanin | 1****n | 2 |
| Anthony Corbett | a****r | 1 |
| labkey-rond | r****d@l****m | 1 |
| Kevin Krouse | k****k@l****m | 1 |
| Pablo Escobar Lopez | p****1@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: almost 2 years ago
All Time
- Total issues: 0
- Total pull requests: 69
- Average time to close issues: N/A
- Average time to close pull requests: 18 days
- Total issue authors: 0
- Total pull request authors: 15
- Average comments per issue: 0
- Average comments per pull request: 0.78
- Merged pull requests: 56
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 15
- Average time to close issues: N/A
- Average time to close pull requests: 16 days
- Issue authors: 0
- Pull request authors: 5
- Average comments per issue: 0
- Average comments per pull request: 1.07
- Merged pull requests: 8
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- labkey-alan (23)
- jryurkanin (16)
- labkey-nicka (9)
- RosalineP (9)
- AetherUnbound (5)
- cnathe (5)
- labkey-klum (2)
- labkey-chrisj (2)
- labkey-ians (2)
- labkey-eyounske (2)
- labkey-steveh (1)
- mikkel14 (1)
- pescobar (1)
- anthonycor (1)
- labkey-tchad (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 74,627 last-month
- Total dependent packages: 0
- Total dependent repositories: 10
- Total versions: 32
- Total maintainers: 3
pypi.org: labkey
Python client API for LabKey Server
- Homepage: https://github.com/LabKey/labkey-api-python
- Documentation: https://labkey.readthedocs.io/
- License: Apache License 2.0
-
Latest release: 3.4.0
published about 1 year ago
Rankings
Maintainers (3)
Dependencies
- requests *