Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
Merge branch 'LBB-22/upgrade_python' into 'LBB-23/upgrade_flask'
Browse files Browse the repository at this point in the history
♻️ upgrade python to v3.10

See merge request lbb/lbb!635
  • Loading branch information
Sylvain Touret committed Sep 23, 2022
2 parents 27711ca + c72120c commit c5a21bc
Show file tree
Hide file tree
Showing 49 changed files with 1,596 additions and 1,235 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/lbb-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ name: LBB CI

on:
push:
branches: [ "master"]
branches: [ "*"]
pull_request:
branches: [ "master"]
workflow_dispatch:
inputs:
git-ref:
description: Git Ref (Optional)
required: false

jobs:
tests:
Expand All @@ -15,7 +20,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.6.8]
python-version: [3.10.4]

steps:
- uses: actions/checkout@v3
Expand Down
32 changes: 16 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,53 +215,53 @@ start-locust-against-localhost:

# Tests
# -----
NOSETESTS_OPTS ?=
NOSETESTS = nosetests -s $(NOSETESTS_OPTS)
PYTEST_OPTS ?= -vx
PYTEST = pytest $(PYTEST_OPTS)
TESTS = labonneboite/tests/app/ \
labonneboite/tests/web/ \
labonneboite/tests/scripts/

test-unit: clean-pyc rebuild-data-test
LBB_ENV=test $(NOSETESTS) ${TESTS}
LBB_ENV=test $(PYTEST) ${TESTS}

test: test-unit test-selenium test-integration

check-all: test-all

test-app:
LBB_ENV=test $(NOSETESTS) labonneboite/tests/app
LBB_ENV=test $(PYTEST) labonneboite/tests/app

test-api:
LBB_ENV=test $(NOSETESTS) labonneboite/tests/web/api
LBB_ENV=test $(PYTEST) labonneboite/tests/web/api

test-front:
LBB_ENV=test $(NOSETESTS) labonneboite/tests/web/front
LBB_ENV=test $(PYTEST) labonneboite/tests/web/front

test-web: test-api test-front test-web-integration

test-scripts:
LBB_ENV=test $(NOSETESTS) labonneboite/tests/scripts
LBB_ENV=test $(PYTEST) labonneboite/tests/scripts

test-integration: clear-data-test database-test populate-data-test
LBB_ENV=test $(NOSETESTS) labonneboite/tests/integration
LBB_ENV=test $(PYTEST) labonneboite/tests/integration

test-selenium: clear-data-test database-test populate-data-test-selenium
LBB_ENV=test SELENIUM_IS_SETUP=1 $(NOSETESTS) labonneboite/tests/selenium
LBB_ENV=test SELENIUM_IS_SETUP=1 $(PYTEST) labonneboite/tests/selenium

# Convenient reminder about how to run a specific test manually.
test-custom:
@echo "To run a specific test, run for example:"
@echo
@echo " $$ LBB_ENV=test nosetests -s labonneboite/tests/web/api/test_api.py"
@echo " $$ LBB_ENV=test pytest -s labonneboite/tests/web/api/test_api.py"
@echo
@echo "and you can even run a specific method, here are several examples:"
@echo
@echo " $$ LBB_ENV=test nosetests -s labonneboite/tests/web/api/test_api.py:ApiCompanyListTest.test_query_returns_scores_adjusted_to_rome_code_context"
@echo " $$ LBB_ENV=test nosetests -s labonneboite/tests/web/api/test_api.py:ApiOffersOfficesListTest"
@echo " $$ LBB_ENV=test nosetests -s labonneboite/tests/web/front/test_routes.py"
@echo " $$ LBB_ENV=test nosetests -s labonneboite/tests/app/test_suggest_locations.py"
@echo " $$ LBB_ENV=test nosetests -s labonneboite/tests/scripts/test_create_index.py:DeleteOfficeAdminTest.test_office_admin_add"
@echo " $$ LBB_ENV=test nosetests -s labonneboite/tests/selenium/test_search_selecting_car.py:TestSearchSelectingCar.test_commute_time_is_displayed"
@echo " $$ LBB_ENV=test pytest -s labonneboite/tests/web/api/test_api.py:ApiCompanyListTest.test_query_returns_scores_adjusted_to_rome_code_context"
@echo " $$ LBB_ENV=test pytest -s labonneboite/tests/web/api/test_api.py:ApiOffersOfficesListTest"
@echo " $$ LBB_ENV=test pytest -s labonneboite/tests/web/front/test_routes.py"
@echo " $$ LBB_ENV=test pytest -s labonneboite/tests/app/test_suggest_locations.py"
@echo " $$ LBB_ENV=test pytest -s labonneboite/tests/scripts/test_create_index.py:DeleteOfficeAdminTest.test_office_admin_add"
@echo " $$ LBB_ENV=test pytest -s labonneboite/tests/selenium/test_search_selecting_car.py:TestSearchSelectingCar.test_commute_time_is_displayed"
@echo
@echo "Note that you can set the env var `NOSE_NOCAPTURE=1` to keep logs in the console"

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ La Bonne Boite is a [web site](https://labonneboite.pole-emploi.fr) and an [API]

### Install OS requirements:

- python == 3.6.8
- python == 3.10.4
- docker-compose
- mysql-client
- libmysqlclient-dev
Expand All @@ -108,19 +108,19 @@ On fedora

You will also need to install docker and docker-compose. Follow the instructions related to your particular OS from the [official Docker documentation](https://docs.docker.com/install/).

### Create a virtualenv for Python 3.6
### Create a virtualenv for Python 3.10

For now, La Bonne Boite runs in production under Python 3.6.8. You are going to have to create a virtualenv that runs this specific version of Python.
For now, La Bonne Boite runs in production under Python 3.10.4. You are going to have to create a virtualenv that runs this specific version of Python.

$ wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
$ tar -xvzf Python-3.6.8.tgz
$ cd Python-3.6.8
$ wget https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tgz
$ tar -xvzf Python-3.10.4.tgz
$ cd Python-3.10.4
$ ./configure --prefix=/usr/local --enable-loadable-sqlite-extensions
$ sudo make altinstall

Create an [isolated Python environment](https://virtualenv.pypa.io/), for example using [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/):

$ mkvirtualenv --python=`which python3.6` lbb
$ mkvirtualenv --python=`which python3.10` lbb
$ workon lbb

You might need to add `labonneboite` base directory to the Python path. This has to be run only once. One way to do it using `virtualenvwrapper`:
Expand Down
1 change: 0 additions & 1 deletion labonneboite/common/load_data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import pickle
import csv
import pandas as pd
import math

from functools import lru_cache, reduce
Expand Down
5 changes: 5 additions & 0 deletions labonneboite/common/scoring.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import math
from functools import lru_cache
from typing import Optional, Union
from decimal import Decimal

from labonneboite.common import mapping as mapping_util
from labonneboite.common.conf import settings
Expand Down Expand Up @@ -124,6 +125,10 @@ def get_hirings_from_score(score: Score) -> Hiring:
"""
does exactly the reverse operation of get_score_from_hirings
"""

if (isinstance(score, Decimal)):
score = int(score)

if score <= 50:
hirings = settings.SCORE_50_HIRINGS * score / 50.0
elif score <= 60:
Expand Down
Empty file.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

11 changes: 0 additions & 11 deletions labonneboite/tests/importer/data/perf_division_per_rome.csv

This file was deleted.

This file was deleted.

This file was deleted.

33 changes: 0 additions & 33 deletions labonneboite/tests/importer/test_base.py

This file was deleted.

54 changes: 0 additions & 54 deletions labonneboite/tests/importer/test_compute_score.py

This file was deleted.

Loading

0 comments on commit c5a21bc

Please sign in to comment.