mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
Update to Python 3.12 and Django 5
Make sure to upgrade local python to Python 3.12 and reset venv
This commit is contained in:
parent
40696fa553
commit
859ce243ea
|
@ -119,7 +119,7 @@ This readme file is used mostly to document project dependencies
|
|||
## Local build (Windows 10+)
|
||||
|
||||
- this is main developers build
|
||||
- Install Python 3.9, NodeJS, VSCode, Docker Desktop
|
||||
- Install Python 3.12, NodeJS, VSCode, Docker Desktop
|
||||
- copy import wheels from ConceptCore to rsconcept/backend/import
|
||||
- run rsconcept/backend/LocalEnvSetup.ps1
|
||||
- use VSCode configs in root folder to start development
|
||||
|
@ -140,6 +140,7 @@ This readme file is used mostly to document project dependencies
|
|||
|
||||
## Production build
|
||||
|
||||
- provide proper pyconcept wheel (ConceptCore) at 'rsconcept/backend/import/\*.whl'
|
||||
- provide secrets: 'secrets/db_password.txt', 'django_key.txt', 'email_host.txt', 'email_password.txt', 'email_user.txt'
|
||||
- check if you need to change SSL/TLS and PORT in 'rsconcept\backend\.env.prod'
|
||||
- setup domain names for application and API in configs: 'frontend\env\.env.production', 'rsconcept\backend\.env.dev', 'nginx\production.conf'
|
||||
|
|
|
@ -3,16 +3,26 @@
|
|||
# ==========================================
|
||||
FROM ubuntu:jammy as python-base
|
||||
|
||||
RUN apt-get update -qq && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python-is-python3 && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN pip install --upgrade pip && \
|
||||
pip install wheel
|
||||
RUN apt-get update -qq && \
|
||||
apt-get full-upgrade -y && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
gpg-agent \
|
||||
software-properties-common && \
|
||||
add-apt-repository -y ppa:deadsnakes/ppa && \
|
||||
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
python3.12 \
|
||||
libstdc++6 && \
|
||||
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 && \
|
||||
python3.12 -m pip install --upgrade pip && \
|
||||
python3.12 -m pip install wheel && \
|
||||
apt-get autoclean -y && \
|
||||
apt-get autoremove -y && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# ========= Builder ==============
|
||||
FROM python-base as builder
|
||||
|
@ -23,7 +33,7 @@ ENV PYTHONUNBUFFERED 1
|
|||
|
||||
COPY ./requirements.txt ./
|
||||
COPY ./import/*linux*.whl ./wheels/
|
||||
RUN pip wheel \
|
||||
RUN python3.12 -m pip wheel \
|
||||
--no-cache-dir --no-deps \
|
||||
--wheel-dir=/wheels -r requirements.txt
|
||||
|
||||
|
|
|
@ -49,11 +49,11 @@ class TestInlineSynthesis(EndpointTester):
|
|||
ks1_x1 = self.schema1.insert_new('X1', term_raw='KS1X1') # -> delete
|
||||
ks1_x2 = self.schema1.insert_new('X2', term_raw='KS1X2') # -> X2
|
||||
ks1_s1 = self.schema1.insert_new('S1', definition_formal='X2', term_raw='KS1S1') # -> S1
|
||||
ks1_d1 = self.schema1.insert_new('D1', definition_formal='S1\X1\X2') # -> D1
|
||||
ks1_d1 = self.schema1.insert_new('D1', definition_formal=r'S1\X1\X2') # -> D1
|
||||
ks2_x1 = self.schema2.insert_new('X1', term_raw='KS2X1') # -> delete
|
||||
ks2_x2 = self.schema2.insert_new('X2', term_raw='KS2X2') # -> X4
|
||||
ks2_s1 = self.schema2.insert_new('S1', definition_formal='X2×X2', term_raw='KS2S1') # -> S2
|
||||
ks2_d1 = self.schema2.insert_new('D1', definition_formal='S1\X1\X2') # -> D2
|
||||
ks2_d1 = self.schema2.insert_new('D1', definition_formal=r'S1\X1\X2') # -> D2
|
||||
ks2_a1 = self.schema2.insert_new('A1', definition_formal='1=1') # -> not included in items
|
||||
|
||||
data = {
|
||||
|
@ -83,5 +83,5 @@ class TestInlineSynthesis(EndpointTester):
|
|||
self.assertEqual(result['S2']['term_raw'], ks2_s1.term_raw)
|
||||
self.assertEqual(result['S1']['definition_formal'], 'X2')
|
||||
self.assertEqual(result['S2']['definition_formal'], 'X4×X4')
|
||||
self.assertEqual(result['D1']['definition_formal'], 'S1\S2\X2')
|
||||
self.assertEqual(result['D2']['definition_formal'], 'S2\S1\X4')
|
||||
self.assertEqual(result['D1']['definition_formal'], r'S1\S2\X2')
|
||||
self.assertEqual(result['D2']['definition_formal'], r'S2\S1\X4')
|
||||
|
|
|
@ -307,7 +307,7 @@ class TestRSFormViewset(EndpointTester):
|
|||
d2 = self.schema.insert_new('D2')
|
||||
d3 = self.schema.insert_new(
|
||||
alias='D3',
|
||||
definition_formal='X1 \ X2'
|
||||
definition_formal=r'X1 \ X2'
|
||||
)
|
||||
|
||||
data = {'substitutions': []}
|
||||
|
@ -343,7 +343,7 @@ class TestRSFormViewset(EndpointTester):
|
|||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
d3.refresh_from_db()
|
||||
self.assertEqual(d3.definition_formal, 'D1 \ D2')
|
||||
self.assertEqual(d3.definition_formal, r'D1 \ D2')
|
||||
|
||||
|
||||
@decl_endpoint('/api/rsforms/{item}/cst-create', method='post')
|
||||
|
|
|
@ -9,8 +9,10 @@ from .conceptapi import inflect_dependant
|
|||
from .context import TermContext
|
||||
from .reference import EntityReference, SyntacticReference, parse_reference, Reference
|
||||
|
||||
|
||||
_REF_ENTITY_PATTERN = re.compile(r'@{([^0-9\-][^\}\|\{]*?)\|([^\}\|\{]*?)}')
|
||||
|
||||
|
||||
def extract_entities(text: str) -> list[str]:
|
||||
''' Extract list of entities that are referenced. '''
|
||||
result: list[str] = []
|
||||
|
@ -67,6 +69,9 @@ class Position:
|
|||
start: int = 0
|
||||
finish: int = 0
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash((self.start, self.finish))
|
||||
|
||||
|
||||
@dataclass
|
||||
class ResolvedReference:
|
||||
|
@ -76,6 +81,9 @@ class ResolvedReference:
|
|||
pos_input: Position = Position()
|
||||
pos_output: Position = Position()
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash((self.resolved, self.pos_input, self.pos_output, self.ref.to_text()))
|
||||
|
||||
|
||||
class Resolver:
|
||||
''' Text reference resolver '''
|
||||
|
|
|
@ -12,8 +12,8 @@ then
|
|||
fi
|
||||
|
||||
cd $APP_HOME
|
||||
python $APP_HOME/manage.py collectstatic --noinput --clear
|
||||
python $APP_HOME/manage.py migrate
|
||||
python3.12 $APP_HOME/manage.py collectstatic --noinput --clear
|
||||
python3.12 $APP_HOME/manage.py migrate
|
||||
|
||||
# Execute given input command
|
||||
exec "$@"
|
|
@ -1,8 +1,8 @@
|
|||
tzdata==2024.1
|
||||
Django==4.2.11
|
||||
Django==5.0.3
|
||||
djangorestframework==3.15.1
|
||||
django-cors-headers==4.3.1
|
||||
django-filter==24.1
|
||||
django-filter==24.2
|
||||
drf-spectacular==0.27.1
|
||||
coreapi==2.3.3
|
||||
pymorphy3==2.0.1
|
||||
|
|
Loading…
Reference in New Issue
Block a user