Skip to content

Commit

Permalink
Upgrade to Python 3.12 (#9576)
Browse files Browse the repository at this point in the history
* DRAFT: GitHub Actions: Test on Python 3.12

Repeats #8777
* #8777 

Some of our dependencies will not be ready yet.

* Python 3.12: Disable qiskit and tensorflow algorithms

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
  • Loading branch information
cclauss and github-actions authored Oct 3, 2023
1 parent f964dcb commit 0f4e512
Show file tree
Hide file tree
Showing 21 changed files with 15 additions and 31 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: 3.12
allow-prereleases: true
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: pip install --user ruff
- run: ruff --output-format=github .
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pre-commit run --all-files --show-diff-on-failure

We want your work to be readable by others; therefore, we encourage you to note the following:

- Please write in Python 3.11+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
- Please write in Python 3.12+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
- Please focus hard on the naming of functions, classes, and variables. Help your reader by using __descriptive names__ that can help you to remove redundant comments.
- Single letter variable names are *old school* so please avoid them unless their life only spans a few lines.
- Expand acronyms because `gcd()` is hard to understand but `greatest_common_divisor()` is not.
Expand Down
19 changes: 0 additions & 19 deletions DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
* [Hamiltonian Cycle](backtracking/hamiltonian_cycle.py)
* [Knight Tour](backtracking/knight_tour.py)
* [Minimax](backtracking/minimax.py)
* [Minmax](backtracking/minmax.py)
* [N Queens](backtracking/n_queens.py)
* [N Queens Math](backtracking/n_queens_math.py)
* [Power Sum](backtracking/power_sum.py)
Expand Down Expand Up @@ -133,7 +132,6 @@
* [Run Length Encoding](compression/run_length_encoding.py)

## Computer Vision
* [Cnn Classification](computer_vision/cnn_classification.py)
* [Flip Augmentation](computer_vision/flip_augmentation.py)
* [Haralick Descriptors](computer_vision/haralick_descriptors.py)
* [Harris Corner](computer_vision/harris_corner.py)
Expand Down Expand Up @@ -321,7 +319,6 @@
* [Floyd Warshall](dynamic_programming/floyd_warshall.py)
* [Integer Partition](dynamic_programming/integer_partition.py)
* [Iterating Through Submasks](dynamic_programming/iterating_through_submasks.py)
* [K Means Clustering Tensorflow](dynamic_programming/k_means_clustering_tensorflow.py)
* [Knapsack](dynamic_programming/knapsack.py)
* [Longest Common Subsequence](dynamic_programming/longest_common_subsequence.py)
* [Longest Common Substring](dynamic_programming/longest_common_substring.py)
Expand Down Expand Up @@ -384,9 +381,6 @@
* [Mandelbrot](fractals/mandelbrot.py)
* [Sierpinski Triangle](fractals/sierpinski_triangle.py)

## Fuzzy Logic
* [Fuzzy Operations](fuzzy_logic/fuzzy_operations.py)

## Genetic Algorithm
* [Basic String](genetic_algorithm/basic_string.py)

Expand Down Expand Up @@ -517,8 +511,6 @@
* Local Weighted Learning
* [Local Weighted Learning](machine_learning/local_weighted_learning/local_weighted_learning.py)
* [Logistic Regression](machine_learning/logistic_regression.py)
* Lstm
* [Lstm Prediction](machine_learning/lstm/lstm_prediction.py)
* [Mfcc](machine_learning/mfcc.py)
* [Multilayer Perceptron Classifier](machine_learning/multilayer_perceptron_classifier.py)
* [Polynomial Regression](machine_learning/polynomial_regression.py)
Expand Down Expand Up @@ -613,7 +605,6 @@
* [Matrix Exponentiation](maths/matrix_exponentiation.py)
* [Max Sum Sliding Window](maths/max_sum_sliding_window.py)
* [Median Of Two Arrays](maths/median_of_two_arrays.py)
* [Miller Rabin](maths/miller_rabin.py)
* [Mobius Function](maths/mobius_function.py)
* [Modular Exponential](maths/modular_exponential.py)
* [Monte Carlo](maths/monte_carlo.py)
Expand Down Expand Up @@ -1071,17 +1062,7 @@
* [Sol1](project_euler/problem_800/sol1.py)

## Quantum
* [Bb84](quantum/bb84.py)
* [Deutsch Jozsa](quantum/deutsch_jozsa.py)
* [Half Adder](quantum/half_adder.py)
* [Not Gate](quantum/not_gate.py)
* [Q Fourier Transform](quantum/q_fourier_transform.py)
* [Q Full Adder](quantum/q_full_adder.py)
* [Quantum Entanglement](quantum/quantum_entanglement.py)
* [Quantum Teleportation](quantum/quantum_teleportation.py)
* [Ripple Adder Classic](quantum/ripple_adder_classic.py)
* [Single Qubit Measure](quantum/single_qubit_measure.py)
* [Superdense Coding](quantum/superdense_coding.py)

## Scheduling
* [First Come First Served](scheduling/first_come_first_served.py)
Expand Down
2 changes: 1 addition & 1 deletion backtracking/combination_sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def combination_sum(candidates: list, target: int) -> list:
>>> combination_sum([-8, 2.3, 0], 1)
Traceback (most recent call last):
...
RecursionError: maximum recursion depth exceeded in comparison
RecursionError: maximum recursion depth exceeded
"""
path = [] # type: list[int]
answer = [] # type: list[int]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions maths/maclaurin_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def maclaurin_sin(theta: float, accuracy: int = 30) -> float:
>>> all(isclose(maclaurin_sin(x, 50), sin(x)) for x in range(-25, 25))
True
>>> maclaurin_sin(10)
-0.544021110889369
-0.5440211108893691
>>> maclaurin_sin(-10)
0.5440211108893703
0.5440211108893704
>>> maclaurin_sin(10, 15)
-0.5440211108893689
>>> maclaurin_sin(-10, 15)
Expand Down Expand Up @@ -69,9 +69,9 @@ def maclaurin_cos(theta: float, accuracy: int = 30) -> float:
>>> all(isclose(maclaurin_cos(x, 50), cos(x)) for x in range(-25, 25))
True
>>> maclaurin_cos(5)
0.28366218546322675
0.2836621854632268
>>> maclaurin_cos(-5)
0.2836621854632266
0.2836621854632265
>>> maclaurin_cos(10, 15)
-0.8390715290764525
>>> maclaurin_cos(-10, 15)
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions quantum/deutsch_jozsa.py → quantum/deutsch_jozsa.py.DISABLED.txt
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# DISABLED!!
#!/usr/bin/env python3
"""
Deutsch-Jozsa Algorithm is one of the first examples of a quantum
Expand Down
1 change: 1 addition & 0 deletions quantum/half_adder.py → quantum/half_adder.py.DISABLED.txt
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# DISABLED!!
#!/usr/bin/env python3
"""
Build a half-adder quantum circuit that takes two bits as input,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ opencv-python
pandas
pillow
projectq
qiskit
qiskit-aer
qiskit ; python_version < '3.12'
qiskit-aer ; python_version < '3.12'
requests
rich
scikit-fuzzy
scikit-learn
statsmodels
sympy
tensorflow
tensorflow ; python_version < '3.12'
texttable
tweepy
xgboost
Expand Down

0 comments on commit 0f4e512

Please sign in to comment.