Skip to content

Commit

Permalink
42 resource.attrs to align with udc (#45)
Browse files Browse the repository at this point in the history
* 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
drernie authored May 31, 2023
1 parent c389930 commit 40cf58b
Show file tree
Hide file tree
Showing 45 changed files with 709 additions and 1,686 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances

# MegaLinter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10"] #"3.8", "3.9",
python-version: ["3.10"] # "3.11"
poetry-version: ["1.3.1"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
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
117 changes: 0 additions & 117 deletions CLI.md

This file was deleted.

69 changes: 69 additions & 0 deletions Makefile
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


56 changes: 17 additions & 39 deletions README.md
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)
```
Loading

0 comments on commit 40cf58b

Please sign in to comment.