Skip to content

Commit 77f674a

Browse files
authored
Adjust workflows to new python (#221)
* Use Python 3.9 as minimum requirement as 3.8 is EOL * adjust CIs to new Python versions * split flake8 and flake8_nb * Apparently annotating local "counter" variables ahead of a for loop is not favored anymore * Ignore too-many-positional-arguments - leave it to the programmers * Ignore E231 for Jupyter Notebooks - currently a false positive, re-enable when f-strings are no issue anymore
1 parent ec23776 commit 77f674a

13 files changed

+22
-21
lines changed

.flake8_nb

+1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ ignore =
1313
E501 # Allow long lines
1414
W503 # Long lines need to be broken somewhere and otherwise W504 is violated
1515
E402 # Module level imports are decided on by developers
16+
E231 # Ignore missing white space after ':' because it also affects f-string expressions which in fact haven't changed, see https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals
1617

1718
show_source = True

.github/workflows/citation.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121

2222
- uses: actions/checkout@v3
2323

24-
- name: Set up Python 3.8
24+
- name: Set up Python 3.9
2525
uses: actions/setup-python@v4
2626
with:
27-
python-version: 3.8
27+
python-version: 3.9
2828

2929
- name: Install cffconvert
3030
run: |

.github/workflows/demo.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
python-version: [3.8, 3.9, "3.10"]
20+
python-version: [3.9, "3.10", "3.13"]
2121
inplace: ["-e", ""] # "pip install -e ." installs in place; "pip install ." installs to the default directory
2222

2323
steps:

.github/workflows/docs.yaml

+5-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
python-version: [3.8, "3.10"] # Check the oldest and newest currently supported Python versions
20+
python-version: [3.9, "3.10", "3.13"] # Check the oldest and newest currently supported Python versions
2121

2222
steps:
2323

@@ -28,12 +28,11 @@ jobs:
2828
run: |
2929
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install pandoc
3030
31-
- uses: actions/checkout@v3
31+
- uses: actions/checkout@v4
32+
with:
33+
lfs: false
34+
fetch-depth: 0
3235

33-
jobs:
34-
post_checkout:
35-
- git fetch --unshallow || true
36-
3736
- run: |
3837
curl -LJO "https://media.tuhh.de/mls/software/conflowgen/docs/data/prepared_dbs/demo_poc.sqlite"
3938
curl -LJO "https://media.tuhh.de/mls/software/conflowgen/docs/data/prepared_dbs/demo_deham_cta.sqlite"

.github/workflows/linting.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
python-version: [3.8, 3.9, "3.10"]
20+
python-version: [3.9, "3.10", "3.12"]
2121

2222
steps:
2323

@@ -43,9 +43,16 @@ jobs:
4343
pylint setup.py
4444
pylint conflowgen.tests
4545
46-
- name: Check code quality with flake8 and flake8_nb
46+
- name: Check code quality with flake8
4747
run: |
4848
flake8 --version
4949
flake8
50+
51+
- name: Install flake8_nb - this downgrades flake8 as of 07.02.2025!
52+
run: |
53+
pip3 install --user flake8_nb
54+
55+
- name: Check code quality with flake8_nb
56+
run: |
5057
flake8_nb --version
5158
flake8_nb

.pylintrc

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ disable=
5454
W0612, # pylint cannot detect that some variables are type-hinted before a for-loop
5555
R0903, # too-few-public-methods -- this hits e.g. the peewee BaseModels
5656
R0913, # too-many-arguments -- leave it up to the programmers to decide this
57+
R0917, # too-many-positional-arguments -- leave it up to the programmers to decide this
5758
W0107, # unnecessary-pass -- leave it up to the programmers to decide this
5859
R1710, # inconsistent-return-statements -- leave it up to the programmers to decide this
5960
W0511, # fixme - allow todos in the code -- this should be eventually changed but it is not top priority

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Marvin Kastner
3+
Copyright (c) 2025 Marvin Kastner
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

conflowgen/domain_models/distribution_repositories/container_destination_distribution_repository.py

-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ def _get_fraction(
5252
@classmethod
5353
def get_distribution(cls) -> Dict[Schedule, Dict[Destination, float]]:
5454
"""Loads a distribution for all schedules that have destinations associated with them"""
55-
destination: Destination
56-
schedule: Schedule
5755
distributions = {
5856
schedule: {
5957
destination: cls._get_fraction(

conflowgen/domain_models/distribution_repositories/container_length_distribution_repository.py

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def _verify_container_lengths(container_lengths: Dict[ContainerLength, float]):
3838

3939
@classmethod
4040
def get_distribution(cls) -> Dict[ContainerLength, float]:
41-
container_length_distribution_entry: ContainerLengthDistribution
4241
return {
4342
container_length_distribution_entry.container_length: # pylint: disable=undefined-variable
4443
container_length_distribution_entry.fraction # pylint: disable=undefined-variable

conflowgen/domain_models/distribution_repositories/truck_arrival_distribution_repository.py

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def _verify_truck_arrival_distribution(truck_arrivals: Dict[int, float]):
3131

3232
@classmethod
3333
def get_distribution(cls) -> Dict[int, float]:
34-
truck_arrival_entry: TruckArrivalDistribution
3534
return {
3635
truck_arrival_entry.hour_in_the_week: # pylint: disable=undefined-variable
3736
truck_arrival_entry.fraction # pylint: disable=undefined-variable

conflowgen/tools/continuous_distribution.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def __repr__(self) -> str:
207207

208208
def multiply_discretized_probability_densities(*probabilities: typing.Collection[float]) -> typing.Sequence[float]:
209209
assert len({len(p) for p in probabilities}) == 1, "All probability vectors have the same length, but found these:" \
210-
f"'{ [len(p) for p in probabilities] } "
210+
f"'{[len(p) for p in probabilities]}"
211211
for i, probability_vector in enumerate(probabilities):
212212
assert not np.isnan(probability_vector).any(), \
213213
f"All probability vector should contain only numbers, but found a NaN in vector {i}: {probability_vector}"

requirements.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# requirements.txt
2-
31
# This file installs the package defined in setup.py and its dependencies.
42
# The single dot (.) below refers to the current directory, indicating
53
# that pip should install the package specified in setup.py.

setup.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,14 @@
6161
'sphinx-toolbox >=3', # additional dependency of enum_tools - restrict version to improve pip resolution
6262
'myst-parser', # for Contributing.md
6363
'sphinxcontrib-bibtex >=2.4', # a good help for citing - restrict version to improve pip resolution
64-
'sphinx-last-updated-by-git',
64+
'sphinx-last-updated-by-git', # add a timestamp into the documentation indicating the last changes
6565
'nbsphinx', # use Jupyter Notebooks in the documentation
6666
'ipython', # for setting up the pygments_lexer
6767
'ipykernel', # for allowing nbsphinx to execute the Jupyter Notebooks
6868

6969
# checking code quality
7070
'pylint', # lint Python code
7171
'flake8', # lint Python code
72-
'flake8_nb', # lint code in Jupyter Notebooks
7372

7473
# publish at PyPI
7574
'wheel', # use command 'bdist_wheel'

0 commit comments

Comments
 (0)