Skip to content

Commit

Permalink
chore: upgrade to python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
soofstad committed Dec 5, 2023
1 parent 0249c75 commit e281690
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 322 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: '3.10'
python-version: '3.12'

- name: Install pre-commit
run: pip install pre-commit
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
rev: v4.3.0
hooks:
- id: check-ast
language_version: python3.10
language_version: python3.12
- id: check-merge-conflict
- id: check-json
- id: check-yaml
Expand Down
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-slim
FROM python:3.12-slim

ENV PYTHONUNBUFFERED=1
ENV FLASK_APP=/app/src/app.py
Expand Down
315 changes: 3 additions & 312 deletions api/poetry.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ authors = ["Stig Ofstad <[email protected]>", "Eirik Ola Aksnes <[email protected]
license = "MIT"

[tool.poetry.dependencies]
python = "^3.10"
python = "^3.12"
azure-cosmosdb-table = "^1.0.6"
numpy = "^1.26.2"
xlrd = "^2.0.1"
azure-storage-blob = "^12.19.0"
PyJWT = "^2.8.0"
cachetools = "^5.3.2"
vcrpy = "^5.1.0"
matplotlib = "^3.8.2"
gunicorn = "^21.2.0"
Flask = "^3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion api/src/calculators/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def inverse_mutation(child):

def flip_bit_mutation(self, child):
key = random.choice(list(child.keys()))
max_mutator = child[key] // 2
max_mutator = int(child[key] // 2)
if max_mutator < self.MIN_MUTATOR_VALUE:
max_mutator = self.MIN_MUTATOR_VALUE

Expand Down
2 changes: 1 addition & 1 deletion api/src/controllers/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def optimizer_request_handler(
),
"totalMass": round(sum([p.mass for p in products_result]), 1),
"cumulative": optimizer_result["cumulative_bridge"],
"executionTime": optimizer_result["execution_time"].seconds,
"executionTime": int(optimizer_result["execution_time"].microseconds / 1000),
"fitness": optimizer_result["score"],
"weighting": {
"bridge": weights["bridge"],
Expand Down
2 changes: 1 addition & 1 deletion web/src/Components/Combinations/CombinationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export const CombinationCard = ({
enabledProducts={enabledProducts}
setEnabledProducts={updateEnabledProductsAndCombination}
/>
<Switch label='Plot' onClick={(e: any) => togglePlot(e)} checked={enabledPlot} size='small' />
<Switch label='Plot' onChange={(e: any) => togglePlot(e)} checked={enabledPlot} size='small' />
</div>
</div>
</Card>
Expand Down
8 changes: 6 additions & 2 deletions web/src/Components/Solution/SolutionData.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactElement, useContext, useState } from 'react'
import React, { ReactElement, useContext, useEffect, useState } from 'react'
// @ts-ignore
import { Button, Typography, CircularProgress } from '@equinor/eds-core-react'
import styled from 'styled-components'
Expand Down Expand Up @@ -67,6 +67,10 @@ const SolutionData = ({ products, optimizationData }: SolutionDataProps) => {
const { tokenData, token } = useContext(AuthContext)
const [loading, setLoading] = useState<boolean>(false)

useEffect(() => {
window.scrollTo(0, 999999)
}, [])

function onExportClick() {
const reportRequest = {
fitness: optimizationData.fitness,
Expand Down Expand Up @@ -115,7 +119,7 @@ const SolutionData = ({ products, optimizationData }: SolutionDataProps) => {
</LabelWrapper>
<LabelWrapper>
<TextWrapper>Time:</TextWrapper>
<TextWrapper>{optimizationData.executionTime} seconds</TextWrapper>
<TextWrapper>{optimizationData.executionTime}ms</TextWrapper>
</LabelWrapper>
</div>
<div style={{ display: 'flex', paddingTop: '20px' }}>
Expand Down

0 comments on commit e281690

Please sign in to comment.