Skip to content

Commit

Permalink
Merge pull request #9 from quiltdata/add-makefile
Browse files Browse the repository at this point in the history
Add makefile
  • Loading branch information
drernie authored Aug 17, 2023
2 parents 2c79588 + c1be731 commit 63fb880
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 30 deletions.
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
sinclude .env
TARGET = build/benchling_packager.yaml
ACTIVATE = ./venv/bin/activate
PKG_URL = "https://open.quiltdata.com/b/quilt-example/packages/examples/benchling-packager"
.PHONY: all clean install template upload

all: template upload

clean:
rm -rf build
rm -rf venv
rm -f *requirements.txt

template: $(TARGET)

$(TARGET): build venv install make.py lambdas/lambda.py
. $(ACTIVATE) && python3 make.py > $(TARGET)

upload:
. $(ACTIVATE) && python3 upload.py
open $(PKG_URL)

build:
mkdir -p build

venv:
@python3.9 --version|| (echo "Python 3.9 required" && exit 1)
python3.9 -m venv venv

venv/bin/pip-compile:
. $(ACTIVATE) && python3 -m pip install pip-tools

venv/bin/pip-sync:
. $(ACTIVATE) && python3 -m pip install pip-tools

install: venv/bin/pip-sync requirements.txt
. $(ACTIVATE) && pip-sync requirements.txt

requirements.txt: venv/bin/pip-compile requirements.in
. $(ACTIVATE) && pip-compile requirements.in
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,20 @@ This repository generates a CloudFormation template for processing
(and link, if possible) a [Quilt](https://quiltdata.com/)
package for every Benchling notebook.

## Template generation
## Template generation and upload

Requires a recent version of Python 3.

```shell
python3 -m venv venv
. ./venv/bin/activate
python3 -m pip install -r requirements.txt
python3 make.py > build/benchling_packager.yaml
```bash
make all
```

## Template upload
This will:

Currently it's distributed as a Quilt [package](https://open.quiltdata.com/b/quilt-example/packages/examples/benchling-packager)
which is this way:

```python
quilt3.Package().set('README.md', 'Install.md').set('benchling_packager.yaml', 'build/benchling_packager.yaml').push('examples/benchling-packager', 's3://quilt-example')
```
- setup the Python environment
- generate the template in the `build` directory
- upload the template to a Quilt package (if you have appropriate permissions)
- open the package URL: <https://open.quiltdata.com/b/quilt-example/packages/examples/benchling-packager>

## Installation

Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
troposphere ~=4.1
quilt3 ~=5.3
cfn-lint
67 changes: 50 additions & 17 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,57 @@
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile
# pip-compile requirements.in
#
attrs==23.1.0
# via
# jschema-to-python
# jsonschema
# sarif-om
aws-sam-translator==1.68.0
aws-requests-auth==0.4.3
# via quilt3
aws-sam-translator==1.73.0
# via cfn-lint
boto3==1.26.151
# via aws-sam-translator
botocore==1.29.151
boto3==1.28.27
# via
# aws-sam-translator
# quilt3
botocore==1.31.27
# via
# -r requirements.in
# boto3
# s3transfer
certifi==2023.7.22
# via requests
cfn-flip==1.3.0
# via troposphere
cfn-lint==0.77.7
cfn-lint==0.79.7
# via -r requirements.in
click==8.1.3
charset-normalizer==3.2.0
# via requests
click==8.1.6
# via cfn-flip
idna==3.4
# via requests
jmespath==1.0.1
# via
# boto3
# botocore
jschema-to-python==1.2.3
# via cfn-lint
jsonpatch==1.32
jsonlines==1.2.0
# via quilt3
jsonpatch==1.33
# via cfn-lint
jsonpickle==3.0.1
jsonpickle==3.0.2
# via jschema-to-python
jsonpointer==2.3
jsonpointer==2.4
# via jsonpatch
jsonschema==4.17.3
# via
# aws-sam-translator
# cfn-lint
# quilt3
junit-xml==1.9
# via cfn-lint
mpmath==1.3.0
Expand All @@ -49,34 +63,53 @@ pbr==5.11.1
# via
# jschema-to-python
# sarif-om
pydantic==1.10.9
platformdirs==3.10.0
# via quilt3
pydantic==1.10.12
# via aws-sam-translator
pyrsistent==0.19.3
# via jsonschema
python-dateutil==2.8.2
# via botocore
pyyaml==6.0
pyyaml==6.0.1
# via
# cfn-flip
# cfn-lint
regex==2023.6.3
# quilt3
quilt3==5.3.1
# via -r requirements.in
regex==2023.8.8
# via cfn-lint
s3transfer==0.6.1
requests==2.31.0
# via
# aws-requests-auth
# quilt3
# requests-futures
requests-futures==1.0.0
# via quilt3
s3transfer==0.6.2
# via boto3
sarif-om==1.0.4
# via cfn-lint
six==1.16.0
# via
# cfn-flip
# jsonlines
# junit-xml
# python-dateutil
sympy==1.12
# via cfn-lint
troposphere==4.3.2
tenacity==8.2.3
# via quilt3
tqdm==4.66.1
# via quilt3
troposphere==4.4.1
# via -r requirements.in
typing-extensions==4.6.3
typing-extensions==4.7.1
# via
# aws-sam-translator
# pydantic
urllib3==1.26.16
# via botocore
# via
# botocore
# requests
15 changes: 15 additions & 0 deletions upload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import quilt3

REGISTRY = "s3://quilt-example"
PKG_NAME = "examples/benchling-packager"
TEMPLATE = "benchling_packager.yaml"
TARGET = f"build/{TEMPLATE}"

def upload():
pkg = quilt3.Package()
pkg.set("README.md", "Install.md")
pkg.set(TEMPLATE, TARGET)
pkg.push(PKG_NAME, registry=REGISTRY)

if __name__ == "__main__":
upload()

0 comments on commit 63fb880

Please sign in to comment.