Skip to content

Commit 769c8d5

Browse files
committed
wip: poetry
1 parent 166b040 commit 769c8d5

File tree

9 files changed

+87
-218
lines changed

9 files changed

+87
-218
lines changed

.github/workflows/run_tests.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
python-version: ['3.10'] # TODO: 3.11, 3.12
17-
postgres-version: ['15', '17']
16+
python-version: ['3.10', '3.13']
17+
postgres-version: ['17']
1818
runs-on: ubuntu-latest
1919
services:
2020
postgres:
@@ -54,20 +54,17 @@ jobs:
5454
- name: install non-py dependencies
5555
run: sudo apt-get update && sudo apt-get install -y libxml2-dev libxslt1-dev libpq-dev git gcc
5656

57-
- name: set up python${{ matrix.python-version }}
57+
- name: Install poetry
58+
run: pipx install poetry
59+
60+
- name: setup python
5861
uses: actions/setup-python@v5
5962
with:
6063
python-version: ${{ matrix.python-version }}
61-
cache: pip
62-
cache-dependency-path: |
63-
requirements.txt
64-
dev-requirements.txt
65-
66-
- name: install py dependencies
67-
run: pip install -r dev-requirements.txt
64+
cache: 'poetry'
6865

69-
- name: install share
70-
run: python setup.py develop
66+
- name: install depondencies
67+
run: poetry install --with dev
7168

7269
- name: flake it
7370
run: flake8 .

Dockerfile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,25 @@ RUN update-ca-certificates
2525
RUN mkdir -p /code
2626
WORKDIR /code
2727

28-
RUN pip install -U pip
29-
RUN pip install uwsgi==2.0.27
28+
ENV POETRY_NO_INTERACTION=1 \
29+
POETRY_VIRTUALENVS_OPTIONS_ALWAYS_COPY=1 \
30+
POETRY_VIRTUALENVS_CREATE=0 \
31+
POETRY_VIRTUALENVS_IN_PROJECT=1 \
32+
POETRY_CACHE_DIR=/tmp/poetry-cache \
33+
POETRY_HOME=/tmp/poetry
3034

31-
COPY ./requirements.txt /code/requirements.txt
32-
COPY ./constraints.txt /code/constraints.txt
35+
RUN python -m venv $POETRY_HOME
3336

34-
RUN pip install --no-cache-dir -c /code/constraints.txt -r /code/requirements.txt
37+
RUN $POETRY_HOME/bin/pip install poetry==2.1.1
38+
39+
COPY ./ /code/
40+
41+
RUN $POETRY_HOME/bin/poetry install --no-root --compile
3542

3643
RUN apt-get remove -y \
3744
gcc \
3845
zlib1g-dev
3946

40-
COPY ./ /code/
41-
4247
RUN python manage.py collectstatic --noinput
4348

4449
ARG GIT_TAG=
@@ -53,7 +58,9 @@ CMD ["python", "manage.py", "--help"]
5358
### Dist
5459
FROM app AS dist
5560

61+
RUN $POETRY_HOME/bin/poetry install --no-root --compile --only dist
62+
5663
### Dev
5764
FROM app AS dev
5865

59-
RUN pip install --no-cache-dir -c /code/constraints.txt -r /code/dev-requirements.txt
66+
RUN $POETRY_HOME/bin/poetry install --no-root --compile --only dev

dev-requirements.txt

Lines changed: 0 additions & 13 deletions
This file was deleted.

docker-compose.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,10 @@ services:
151151
- -c
152152
- apt-get update &&
153153
apt-get install -y gcc &&
154-
pip install -r requirements.txt -r dev-requirements.txt &&
155-
(python3 -m compileall /usr/local/lib/python3.13 || true) &&
154+
$POETRY_HOME/bin/poetry install --no-root --compile --with dev &&
156155
rm -Rf /python3.13/* &&
157156
apt-get remove -y gcc &&
158-
cp -Rf -p /usr/local/lib/python3.13 / &&
159-
python3 setup.py develop
157+
cp -Rf -p /usr/local/lib/python3.13 /
160158
restart: 'no'
161159
volumes:
162160
- ./:/code:cached

project/settings.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -469,41 +469,6 @@ def route_urgent_task(name, args, kwargs, options, task=None, **kw):
469469

470470
HIDE_DEPRECATED_VIEWS = parse_booly_str(os.environ.get('HIDE_DEPRECATED_VIEWS', 'False'))
471471

472-
# Regulator pipeline, names of setuptools entry points
473-
SHARE_REGULATOR_CONFIG = {
474-
'NODE_STEPS': [
475-
'tokenize_tags',
476-
'whitespace',
477-
'normalize_agent_names',
478-
'cited_as',
479-
('normalize_iris', {
480-
'node_types': ['workidentifier'],
481-
'blocked_schemes': ['mailto'],
482-
'blocked_authorities': ['issn', 'orcid.org'],
483-
}),
484-
('normalize_iris', {
485-
'node_types': ['agentidentifier'],
486-
'blocked_schemes': ['mailto'],
487-
'blocked_authorities': ['secure.gravatar.com'],
488-
}),
489-
('trim_cycles', {
490-
'node_types': ['abstractworkrelation', 'abstractagentrelation'],
491-
'relation_fields': ['subject', 'related'],
492-
}),
493-
('trim_cycles', {
494-
'node_types': ['subject'],
495-
'relation_fields': ['central_synonym'],
496-
'delete_node': False,
497-
}),
498-
],
499-
'GRAPH_STEPS': [
500-
'deduplicate',
501-
],
502-
'VALIDATE_STEPS': [
503-
'jsonld_validator',
504-
],
505-
}
506-
507472
# API KEYS
508473
DATAVERSE_API_KEY = os.environ.get('DATAVERSE_API_KEY')
509474
PLOS_API_KEY = os.environ.get('PLOS_API_KEY')

pyproject.toml

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,65 @@
1+
[project]
2+
name = "SHARE/trove"
3+
version = "25.1.1" # TODO: get version from share/version.py
4+
description = ""
5+
authors = [
6+
{name = "CenterForOpenScience", email = "share-support@cos.io"}
7+
]
8+
readme = "README.md"
9+
requires-python = "=3.13"
10+
dependencies = [
11+
"bcrypt==4.3.0", # Apache 2.0
12+
"celery==5.4.0", # BSD 3 Clause
13+
"colorlog==6.9.0", # MIT
14+
"django-allauth==65.5.0", # MIT
15+
"django-celery-beat==2.7.0", # BSD 3 Clause
16+
"django-cors-headers==4.7.0", # MIT
17+
"django-extensions==3.2.3", # MIT
18+
"django-filter==25.1", # BSD
19+
"django-oauth-toolkit==3.0.1", # BSD
20+
"django==5.2", # BSD 3 Clause
21+
"elasticsearch8==8.17.2", # Apache 2.0
22+
"lxml==5.3.0", # BSD
23+
"kombu==5.5.0", # BSD 3 Clause
24+
"markdown2==2.5.3", # MIT
25+
"psycopg2==2.9.10", # LGPL with exceptions or ZPL
26+
"rdflib==7.1.3", # BSD 3 Clause
27+
"requests==2.32.3", # Apache 2.0
28+
"primitive_metadata==0.2025.1", # MIT
29+
30+
# relevant only in deployment:
31+
"sentry-sdk[django]==2.24.1", # MIT
32+
"gevent==24.11.2", # MIT
33+
"psycogreen==1.0.2", # BSD
34+
35+
# to be removed in future work:
36+
"djangorestframework==3.16.0", # BSD
37+
"djangorestframework-jsonapi==7.1.0", # BSD
38+
"elasticsearch5==5.5.6", # Apache 2.0
39+
"PyJWE==1.0.0", # Apache 2.0
40+
]
41+
42+
[tool.poetry.group.dist]
43+
optional = true
44+
[tool.poetry.group.dist.dependencies]
45+
uwsgi = "2.0.28"
46+
newrelic = "10.7.0" # newrelic APM agent, Custom License
47+
48+
[tool.poetry.group.dev]
49+
optional = true
50+
[tool.poetry.group.dev.dependencies]
51+
coveralls = "3.3.1"
52+
django-debug-toolbar = "5.1.0"
53+
factory-boy = "3.3.3"
54+
faker = "37.1.0"
55+
flake8 = "7.2.0"
56+
pytest-benchmark = "5.1.0"
57+
pytest = "8.3.5"
58+
pytest-django = "4.11.1"
59+
160
[build-system]
2-
requires = ["setuptools>=61.0"]
3-
build-backend = "setuptools.build_meta"
61+
requires = ["poetry-core>=2.0.0,<3.0.0"]
62+
build-backend = "poetry.core.masonry.api"
463

564
[tool.coverage.run]
665
omit = ["tests/*"]

requirements.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ max-line-length = 250
77
ignore = E501,W503,F403,E266,F405
88
exclude = ./scratch/*
99

10-
[behave]
11-
paths=./tests/features
12-
1310
[tool:pytest]
1411
DJANGO_SETTINGS_MODULE=project.settings
1512
addopts = --benchmark-skip

setup.py

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)