Skip to content

Commit 14a545d

Browse files
committed
stringcase is unmaintained and breaks setuptools in its latest release
1 parent 04ed6c1 commit 14a545d

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ENV LANG="en_US.UTF-8" \
2626

2727
RUN python3 -m venv /venv
2828
ENV PATH="/venv/bin:$PATH"
29-
RUN pip3 install -q --no-cache-dir -U pip setuptools six psycopg2-binary
29+
RUN pip3 install -q --no-cache-dir -U pip psycopg2-binary
3030
COPY . /opt/followthemoney
3131
RUN pip3 install -q --no-cache-dir -e /opt/followthemoney
3232
WORKDIR /opt/followthemoney/docs

followthemoney/export/neo4j.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
import json
33
import logging
44
from typing import Any, Dict, Iterable, List, Optional, Set, TextIO
5-
import stringcase # type: ignore
65

76
from followthemoney.export.csv import CSVMixin, CSVWriter
87
from followthemoney.export.graph import GraphExporter, DEFAULT_EDGE_TYPES
98
from followthemoney.graph import Edge, Node
109
from followthemoney.schema import Schema
11-
from followthemoney.util import PathLike
10+
from followthemoney.util import PathLike, const_case
1211

1312
log = logging.getLogger(__name__)
1413
NEO4J_ADMIN_PATH = os.environ.get("NEO4J_ADMIN_PATH", "neo4j-admin")
@@ -72,12 +71,12 @@ def write_node(self, node: Node, extra: List[str]) -> None:
7271

7372
def write_edge(self, edge: Edge, extra: List[str]) -> None:
7473
if edge.prop is not None:
75-
type_ = stringcase.constcase(edge.prop.name)
74+
type_ = const_case(edge.prop.name)
7675
row = [type_, edge.source_id, edge.target_id, edge.weight]
7776
self.links_writer.writerow(row)
7877
if edge.proxy is not None:
7978
proxy = edge.proxy
80-
type_ = stringcase.constcase(proxy.schema.name)
79+
type_ = const_case(proxy.schema.name)
8180
# That potentially may lead to multiple edges with same id
8281
cells = [proxy.id, type_, edge.source_id, edge.target_id]
8382
cells.extend(extra or [])
@@ -174,7 +173,7 @@ def write_graph(self) -> None:
174173
% {
175174
"source": self._to_map({"id": edge.source_id}),
176175
"target": self._to_map({"id": edge.target_id}),
177-
"type": stringcase.constcase(edge.type_name),
176+
"type": const_case(edge.type_name),
178177
"map": self._to_map(attributes),
179178
}
180179
)

followthemoney/util.py

+5
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ def join_text(*parts: Any, sep: str = " ") -> Optional[str]:
105105
return sep.join(texts)
106106

107107

108+
def const_case(text: str) -> str:
109+
"""Convert the given text to a constant case."""
110+
return text.upper().replace(" ", "_")
111+
112+
108113
def get_entity_id(obj: Any) -> Optional[str]:
109114
"""Given an entity-ish object, try to get the ID."""
110115
if is_mapping(obj):

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ dependencies = [
2929
"banal >= 1.0.6, < 1.1.0",
3030
"rigour >= 0.9.3, < 1.0.0",
3131
"click >= 8.0, < 9.0.0",
32-
"stringcase >= 1.2.0, < 2.0.0",
3332
"requests >= 2.21.0, < 3.0.0",
3433
"normality >= 2.4.0, < 3.0.0",
3534
"sqlalchemy >= 1.4.49, < 3.0.0",

0 commit comments

Comments
 (0)