-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
42 resource.attrs to align with udc (#45)
* poetry update (urllib) * remove cli * Create Makefile * disable not-quite-valid tests * Use attrs for Package * Linter fixes * revert removed imports * QuiltRegistry(QuiltRoot): * QuiltResourceURI * class QuiltUri from UnUri * QuiltType refactor * udc = "^0.2.4" * fix imports for tests * with TemporaryDirectory * pkg.get with hash * linter auto-fixes * secrets.PAT * ignore_cleanup_errors=True on Windows * Add README, CHANGELOG * udc 0.2.5 * Don't always chdir to temp * Debug Windows error * try without PAT * normalize get/put/patch for QuiltPackage * pass wo SKIP_LONG_TESTS * Use tzlocal to fix Now() in package names * fail patch/put semantics * work with any udc * UnUri.KEYS * self.full_package * list(self, opts) * remove prints * &path * un_yaml * linter fixes
- Loading branch information
Showing
45 changed files
with
709 additions
and
1,686 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
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
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 @@ | ||
# CHANGELOG | ||
|
||
## 0.9.0 (2023-05-29) | ||
|
||
Pre-release to support Universal Data Client (udc) development. | ||
|
||
- Rewrote QuiltResource to use attribute dictionaries | ||
- Added QuiltType to identify resource types | ||
- Added QuiltURI to parse and validate Quilt+ URIs, using UDC's "UnUri" parsing | ||
- Split out QuiltLocal to manage local file storage and temporary directories |
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,69 @@ | ||
sinclude .env # create from example.env | ||
PROJECT=quiltplus | ||
.PHONY: install test watch all clean | ||
|
||
TEST_README=--codeblocks | ||
ifeq ($(TEST_OS),windows-latest) | ||
TEST_README='' | ||
endif | ||
|
||
all: install update test | ||
|
||
clean: | ||
rm -rf coverage_html | ||
rm -f coverage* | ||
rm -f .coverage* | ||
rm -rf quiltplus/.pytest_cache | ||
|
||
install: | ||
poetry install | ||
|
||
update: | ||
poetry update | ||
|
||
test: | ||
poetry run pytest $(TEST_README) --cov --cov-report xml:coverage.xml | ||
|
||
test-short: | ||
make test "SKIP_LONG_TESTS=True" | ||
|
||
test-long: | ||
make test "SKIP_LONG_TESTS=False" | ||
|
||
coverage: | ||
poetry run pytest --cov --cov-report html:coverage_html | ||
open coverage_html/index.html | ||
|
||
watch: | ||
poetry run ptw --now . | ||
|
||
tag: | ||
git tag `poetry version | awk '{print $$2}'` | ||
git push --tags | ||
|
||
pypi: clean | ||
poetry version | ||
poetry build | ||
poetry publish --dry-run | ||
echo "poetry version prepatch" # major minor | ||
|
||
clean-git: | ||
git branch | grep -v '*' | grep -v 'main' | xargs git branch -D | ||
|
||
which: | ||
which $(PROJECT) | ||
$(PROJECT) --version | ||
|
||
pip-install: | ||
python3 -m pip install $(PROJECT) | ||
make which | ||
|
||
pip-upgrade: | ||
python3 -m pip install --upgrade $(PROJECT) | ||
make which | ||
|
||
pip-update: | ||
poetry self update | ||
python3 -m pip install --upgrade pip | ||
|
||
|
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 |
---|---|---|
@@ -1,51 +1,29 @@ | ||
# quiltplus | ||
# QuiltPlus | ||
|
||
Resource-oriented API for Quilt's decentralized social knowledge platform | ||
## Next-generation API for Quilt Universal Data Collections | ||
|
||
## Command-Line QuickStart | ||
QuiltPlus provides an asychronous, object-oriented wrapper around the Quilt API. | ||
In particular, it implements a resource-based architecture using Quilt+ URIs in | ||
order to support the Universal Data Client [udc](https://github.com/data-yaml/udc). | ||
|
||
```bash | ||
pip install quiltplus | ||
qp -U "quilt+s3://quilt-example#package=examples/echarts" pkg # get | ||
qp list | ||
qp --help | ||
``` | ||
|
||
### Detailed Command-Line | ||
## Installation | ||
|
||
```bash | ||
export WRITE_BUCKET=writeable_s3_bucket | ||
# create empty package and save to config | ||
qp -U "quilt+s3://$(WRITE_BUCKET)#package=test/quiltplus" pkg -x post | ||
time > README.md | ||
qp stage -a README.md | ||
qp stage # displays staged files | ||
qp pkg -x patch # uploads staged files | ||
python3 -m pip install quiltplus | ||
``` | ||
|
||
## Developmment | ||
## Usage | ||
|
||
Uses the [trio](https://trio.readthedocs.io/en/stable/) version of Python's `async` I/O | ||
```python | ||
from quiltplus import QuiltPackage | ||
import anyio | ||
|
||
```bash | ||
git clone https://github.com/quiltdata/quiltplus | ||
cd quiltplus | ||
poetry self update | ||
poetry install | ||
export WRITE_BUCKET=writeable_s3_bucket | ||
poetry run pytest --cov-report html && open htmlcov/index.html | ||
poetry run ptw --now . | ||
``` | ||
|
||
## Pushing Changes | ||
URI = "quilt+s3://quilt-example#package=examples/wellplates" | ||
|
||
Be sure you to first set your [API token](https://pypi.org/manage/account/) using `poetry config pypi-token.pypi <pypi-api-token>` | ||
async def print_contents(uri: str): | ||
pkg = QuiltPackage.FromURI(URI) | ||
files = await pkg.list() | ||
print(files) | ||
|
||
```bash | ||
# merge PR | ||
poetry version patch # minor major | ||
poetry build | ||
poetry publish | ||
# create new branch | ||
poetry version prepatch # preminor premajor | ||
anyio.run(print_contents, URI) | ||
``` |
Oops, something went wrong.