provworkflow 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: provworkflow
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Records the provenance of Python workflows in RDF according to the Prov Workflow Ontology and the Prov Data Model
5
5
  License: BSD-3-Clause
6
+ License-File: LICENSE
6
7
  Author: Nick Car
7
8
  Author-email: nick@kurrawong.ai
8
9
  Requires-Python: >=3.9,<4.0
@@ -13,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.10
13
14
  Classifier: Programming Language :: Python :: 3.11
14
15
  Classifier: Programming Language :: Python :: 3.12
15
16
  Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
16
18
  Requires-Dist: GitPython (>=3.1.41,<4.0.0)
17
19
  Requires-Dist: rdflib (>=7.0.0,<8.0.0)
18
20
  Requires-Dist: requests (>=2.31.0,<3.0.0)
@@ -1,5 +1,4 @@
1
1
  from __future__ import annotations
2
- from datetime import datetime
3
2
  from typing import List, Union
4
3
 
5
4
  from rdflib import Graph, URIRef, Literal
@@ -10,6 +9,7 @@ from rdflib.namespace import PROV, RDF, XSD
10
9
  from .prov_reporter import ProvReporter, PROVWF
11
10
  from .entity import Entity
12
11
  from .agent import Agent
12
+ from .utils import now_as_xsd_datetime_stamp
13
13
 
14
14
 
15
15
  class Activity(ProvReporter):
@@ -57,7 +57,7 @@ class Activity(ProvReporter):
57
57
  uri=uri, label=label, named_graph_uri=named_graph_uri, class_uri=class_uri
58
58
  )
59
59
 
60
- self.started_at_time = datetime.now().astimezone().strftime("%Y-%m-%dT%H:%M:%S%:z")
60
+ self.started_at_time = now_as_xsd_datetime_stamp()
61
61
  self.ended_at_time = None
62
62
 
63
63
  self.used = used if used is not None else []
@@ -107,7 +107,7 @@ class Activity(ProvReporter):
107
107
 
108
108
  # if we don't yet have an endedAtTime recorded, make it now
109
109
  if self.ended_at_time is None:
110
- self.ended_at_time = datetime.now().astimezone().strftime("%Y-%m-%dT%H:%M:%S%:z")
110
+ self.ended_at_time = now_as_xsd_datetime_stamp()
111
111
 
112
112
  # all Activities have a endedAtTime
113
113
  g.add(
@@ -1,6 +1,5 @@
1
1
  import os
2
2
  import uuid
3
- from _datetime import datetime
4
3
  from typing import Union
5
4
 
6
5
  from rdflib import Graph, URIRef, Literal
@@ -8,6 +7,7 @@ from rdflib.namespace import DCTERMS, PROV, OWL, RDF, RDFS, XSD
8
7
 
9
8
  from .exceptions import ProvWorkflowException
10
9
  from .namespace import PROVWF, PWFS
10
+ from .utils import now_as_xsd_datetime_stamp
11
11
 
12
12
 
13
13
  class class_or_instance_method(classmethod):
@@ -95,7 +95,7 @@ class ProvReporter:
95
95
  self.version_uri = self.uri
96
96
 
97
97
  self.created = Literal(
98
- datetime.now().astimezone().strftime("%Y-%m-%dT%H:%M:%S%:z"),
98
+ now_as_xsd_datetime_stamp(),
99
99
  datatype=XSD.dateTimeStamp,
100
100
  )
101
101
 
@@ -7,6 +7,11 @@ from rdflib import Graph, URIRef, BNode, Literal
7
7
  from rdflib.namespace import DCTERMS, PROV, RDF, XSD
8
8
 
9
9
 
10
+ def now_as_xsd_datetime_stamp() -> str:
11
+ """Return a local timezone-aware timestamp for xsd:dateTimeStamp values."""
12
+ return datetime.now().astimezone().isoformat(timespec="seconds")
13
+
14
+
10
15
  def query_sop_sparql(named_graph_uri, query, update=False):
11
16
  """
12
17
  Perform read and write SPARQL queries against a Surround Ontology Platform (SOP) instance
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "provworkflow"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  description = "Records the provenance of Python workflows in RDF according to the Prov Workflow Ontology and the Prov Data Model"
5
5
  authors = ["Nick Car <nick@kurrawong.ai>", "David Habgood <david@kurrawong.ai>"]
6
6
  readme = "README.md"
File without changes
File without changes