Skip to content

Commit

Permalink
Merge branch 'release/4.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
peichman-umd committed Aug 9, 2024
2 parents fe19afc + 909f271 commit 1d73e74
Show file tree
Hide file tree
Showing 68 changed files with 508 additions and 201 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/pdoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: generate-api-docs
on: [push]
jobs:
build:
runs-on: ubuntu-latest
environment:
name: github-pages
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- run: pip install ./plastron-*
- run: pip install pdoc
- run: pdoc --output-dir apidocs plastron
- uses: actions/upload-pages-artifact@v3
with:
path: apidocs
# Deploy job
deploy:
# Add a dependency to the build job
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,6 @@ cython_debug/

archelon_id*
docker-plastron.yml

# generated dependency files for the meta-package
dependencies*.txt
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ pipeline {
-e './plastron-utils[test]' \
-e './plastron-client[test]' \
-e './plastron-rdf[test]' \
-e './plastron-messaging[test]' \
-e './plastron-models[test]' \
-e './plastron-repo[test]' \
-e './plastron-web[test]' \
Expand Down
67 changes: 49 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,33 @@ Tools for working with a Fedora 4 repository.

## Architecture

Plastron is composed of several distribution packages:
Plastron is composed of several distribution packages, arranged in three
layers:

### Applications

* **[plastron-client](plastron-client)**: The Fedora repository API client
* **[plastron-rdf](plastron-rdf)**: RDF-to-Python property mapping
* **[plastron-models](plastron-models)**: Content models, CSV
serialization
* **[plastron-repo](plastron-repo)**: Repository operations and structural
models (LDP, PCDM, Web Annotations, etc.)
* **[plastron-cli](plastron-cli)**: Command-line tool. Also includes the
handler classes for the `load` command
* **[plastron-stomp](plastron-stomp)**: STOMP daemon for handling
asynchronous operations
* **[plastron-web](plastron-web)**: Web application for handling
synchronous operations
* **[plastron-utils](plastron-utils)**: Miscellaneous utilities

### High-Level APIs

* **[plastron-models](plastron-models)**: Content models, CSV
serialization
* **[plastron-repo](plastron-repo)**: Repository operations and structural
models (LDP, PCDM, Web Annotations, etc.)

### Low-level APIs

* **[plastron-client](plastron-client)**: The Fedora repository API client
* **[plastron-messaging](plastron-messaging)**: STOMP message models and
message broker connection handling
* **[plastron-rdf](plastron-rdf)**: RDF-to-Python property mapping
* **[plastron-utils](plastron-utils)**: Namespace definitions
and miscellaneous utilities

The intent is that these distribution packages are independently useful,
either as tools that can be run or libraries to be included in other projects.
Expand All @@ -27,23 +39,48 @@ either as tools that can be run or libraries to be included in other projects.

Requires Python 3.8+

To install just the API libraries (low- and high-level):

```zsh
pip install plastron
```

To install the applications as well:

```zsh
# individually
pip install 'plastron[cli]'
pip install 'plastron[stomp]'
pip install 'plastron[web]'

# all together
pip install 'plastron[cli,stomp,web]'
```

## Running

* [Command-line client](plastron-cli/README.md)
* [STOMP daemon](plastron-stomp/README.md)
* [HTTP webapp](plastron-web/README.md)

## Development

This repository includes a [.python-version](.python-version) file. If you are
using a tool like [pyenv] to manage your Python versions, it will select
an installed Python 3.8 for you.

### Install for development

To install Plastron in [development mode], do the following:

```bash
```zsh
git clone [email protected]:umd-lib/plastron.git
cd plastron
python -m venv .venv
python -m venv --prompt "plastron-py$(cat .python-version)" .venv
source .venv/bin/activate
pip install \
-e './plastron-utils[test]' \
-e './plastron-client[test]' \
-e './plastron-rdf[test]' \
-e './plastron-messaging[test]' \
-e './plastron-models[test]' \
-e './plastron-repo[test]' \
-e './plastron-web[test]' \
Expand All @@ -66,12 +103,6 @@ pytest
See the [testing documentation](docs/testing.md) for more
information.

## Running

* [Command-line client](plastron-cli/README.md)
* [STOMP daemon](plastron-stomp/README.md)
* [HTTP webapp](plastron-web/README.md)

## API Documentation

To generate API documentation from the code, use [pdoc]:
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.3.2
24 changes: 24 additions & 0 deletions mkdependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

VERSION=$(cat VERSION)

cat >dependencies.txt <<END
plastron-client==$VERSION
plastron-messaging==$VERSION
plastron-models==$VERSION
plastron-rdf==$VERSION
plastron-repo==$VERSION
plastron-utils==$VERSION
END

cat >dependencies-cli.txt <<END
plastron-cli==$VERSION
END

cat >dependencies-stomp.txt <<END
plastron-stomp==$VERSION
END

cat >dependencies-web.txt <<END
plastron-web==$VERSION
END
1 change: 1 addition & 0 deletions plastron-cli/VERSION
25 changes: 23 additions & 2 deletions plastron-cli/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
[project]
name = "plastron-cli"
version = "4.3.1"
description = "Plastron command line client"
authors = [
{ name='University of Maryland Libraries', email='[email protected]' },
{ name='Josh Westgard', email='[email protected]' },
{ name='Peter Eichman', email='[email protected]' },
{ name='Mohamed Abdul Rasheed', email='[email protected]' },
{ name='Ben Wallberg', email='[email protected]' },
{ name='David Steelman', email='[email protected]' },
{ name='Marc Andreu Grillo Aguilar', email='[email protected]' },
]
readme = "README.md"
requires-python = ">= 3.8"
dependencies = [
"BeautifulSoup4",
"lxml==4.9.2",
"lxml",
"Pillow",
"plastron-models",
"plastron-repo",
"plastron-utils",
"pyparsing",
"pysolr",
"PyYAML",
"rdflib",
]
dynamic = ["version"]

[project.optional-dependencies]
test = [
Expand All @@ -21,5 +35,12 @@ test = [
[project.scripts]
plastron = "plastron.cli:main"

[build-system]
requires = ["setuptools>=66.1.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
version = { "file" = "VERSION" }

[tool.pytest.ini_options]
markers = ['jobs_dir']
16 changes: 14 additions & 2 deletions plastron-cli/src/plastron/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
from datetime import datetime
from importlib import import_module
from pkgutil import iter_modules
from typing import Iterable
from typing import Iterable, Tuple

import yaml
from rdflib import URIRef, Literal
from rdflib.util import from_n3

from plastron.cli import commands
from plastron.context import PlastronContext
from plastron.utils import DEFAULT_LOGGING_OPTIONS, envsubst, check_python_version
from plastron.utils import DEFAULT_LOGGING_OPTIONS, envsubst, check_python_version, uri_or_curie

logger = logging.getLogger(__name__)
now = datetime.utcnow().strftime('%Y%m%d%H%M%S')
Expand Down Expand Up @@ -196,3 +198,13 @@ def __init__(self, message):

def __str__(self):
return self.message


def parse_data_property(p: str, o: str) -> Tuple[URIRef, Literal]:
"""Convert a pair of strings to a URIRef predicate and Literal object."""
return uri_or_curie(p), Literal(from_n3(o))


def parse_object_property(p: str, o: str) -> Tuple[URIRef, URIRef]:
"""Convert a pair of strings to a URIRef predicate and URIRef object."""
return uri_or_curie(p), uri_or_curie(o)
3 changes: 2 additions & 1 deletion plastron-cli/src/plastron/cli/commands/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

from plastron.cli.commands import BaseCommand
from plastron.namespaces import dcterms, get_manager, pcdm, rdf
from plastron.rdf import parse_data_property, parse_object_property, uri_or_curie
from plastron.cli import parse_data_property, parse_object_property
from plastron.utils import uri_or_curie

logger = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions plastron-cli/src/plastron/cli/commands/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
from plastron.cli.commands import BaseCommand
from plastron.client import ClientError
from plastron.models.pcdm import PCDMObject
from plastron.rdf import parse_predicate_list
from plastron.repo import RepositoryError
from plastron.utils import ItemLog
from plastron.utils import ItemLog, parse_predicate_list

logger = logging.getLogger(__name__)

Expand Down
3 changes: 2 additions & 1 deletion plastron-cli/src/plastron/cli/commands/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

from plastron.cli.commands import BaseCommand
from plastron.namespaces import get_manager, rdf
from plastron.rdf import parse_predicate_list, parse_data_property, parse_object_property, uri_or_curie
from plastron.cli import parse_data_property, parse_object_property
from plastron.utils import uri_or_curie, parse_predicate_list
from plastron.repo import RepositoryResource

logger = logging.getLogger(__name__)
Expand Down
3 changes: 1 addition & 2 deletions plastron-cli/src/plastron/cli/commands/importcommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
from plastron.jobs.importjob import ImportConfig, ImportJob
from plastron.jobs import Jobs
from plastron.models import get_model_class, ModelClassNotFoundError
from plastron.rdf import uri_or_curie
from plastron.utils import datetimestamp
from plastron.utils import datetimestamp, uri_or_curie

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion plastron-cli/src/plastron/cli/commands/reindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from plastron.cli import get_uris
from plastron.cli.commands import BaseCommand
from plastron.rdf import parse_predicate_list
from plastron.utils import parse_predicate_list
from plastron.rdfmapping.resources import RDFResource

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion plastron-cli/src/plastron/cli/commands/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from plastron.cli.commands import BaseCommand
from plastron.models import get_model_class
from plastron.rdf import uri_or_curie
from plastron.utils import uri_or_curie
from plastron.rdfmapping.descriptors import DataProperty, ObjectProperty
from plastron.rdfmapping.resources import RDFResourceBase
from plastron.repo import RepositoryResource
Expand Down
2 changes: 1 addition & 1 deletion plastron-cli/src/plastron/cli/commands/stub.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from plastron.client import ClientError
from plastron.files import BinarySource, HTTPFileSource, LocalFileSource
from plastron.models.umd import Stub
from plastron.rdf import uri_or_curie
from plastron.utils import uri_or_curie
from plastron.repo import ContainerResource
from plastron.repo.pcdm import PCDMFileBearingResource
from plastron.repo.utils import context
Expand Down
8 changes: 3 additions & 5 deletions plastron-cli/src/plastron/cli/commands/unpublish.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import logging
from argparse import FileType, Namespace
from typing import Iterable
from plastron.cli import get_uris

from plastron.cli import get_uris
from plastron.cli.commands import BaseCommand
from plastron.repo.publish import get_publication_status, PublishableResource
from plastron.namespaces import umdaccess
from plastron.rdfmapping.resources import RDFResource
from plastron.repo import RepositoryResource, RepositoryError
from plastron.repo import RepositoryError
from plastron.repo.publish import PublishableResource

logger = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions plastron-cli/src/plastron/cli/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from plastron.cli.commands import BaseCommand
from plastron.jobs.updatejob import UpdateJob
from plastron.models import get_model_class
from plastron.rdf import parse_predicate_list
from plastron.utils import ItemLog
from plastron.utils import ItemLog, parse_predicate_list

logger = logging.getLogger(__name__)

Expand Down
1 change: 1 addition & 0 deletions plastron-client/VERSION
Loading

0 comments on commit 1d73e74

Please sign in to comment.