Skip to content

Commit 75974d2

Browse files
authored
Merge pull request #349 from ahmedfgad/github-actions
PyGAD 3.6.0
2 parents 73e520e + 409e27d commit 75974d2

38 files changed

+1647
-1038
lines changed

.github/workflows/main.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# PyGAD GitHub Actions Workflow
2+
# This workflow uses a Matrix Strategy to test PyGAD across multiple Python versions in parallel.
3+
name: PyGAD PyTest Matrix
4+
5+
permissions:
6+
contents: read
7+
8+
on:
9+
push:
10+
# Trigger the workflow on pushes to the 'github-actions' branch.
11+
branches:
12+
- github-actions
13+
# - master
14+
# Only run the workflow if changes are made in these directories.
15+
paths:
16+
- 'pygad/**'
17+
- 'tests/**'
18+
- 'examples/**'
19+
# Allows manual triggering of the workflow from the GitHub Actions tab.
20+
workflow_dispatch:
21+
22+
jobs:
23+
pytest:
24+
# Use the latest Ubuntu runner for all jobs.
25+
runs-on: ubuntu-latest
26+
27+
# The Strategy Matrix defines the environments to test.
28+
# GitHub Actions will spawn a separate, parallel job for each version in the list.
29+
strategy:
30+
matrix:
31+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
32+
33+
# Dynamic name that appears in the GitHub Actions UI for each parallel job.
34+
name: PyTest / Python ${{ matrix.python-version }}
35+
36+
steps:
37+
- name: Checkout Repository
38+
uses: actions/checkout@v3
39+
40+
# Setup the specific Python version defined in the current matrix iteration.
41+
- name: Setup Python ${{ matrix.python-version }}
42+
uses: actions/setup-python@v4
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
46+
# Install project dependencies from requirements.txt.
47+
- name: Install Dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install -r requirements.txt
51+
52+
# Build the PyGAD package distribution (generating .tar.gz and .whl files).
53+
# This ensures the package build process is valid on this Python version.
54+
- name: Build PyGAD
55+
run: |
56+
python3 -m pip install --upgrade build
57+
python3 -m build
58+
59+
# Install the newly built .whl file to verify the package is installable.
60+
- name: Install PyGAD from Wheel
61+
run: |
62+
find ./dist/*.whl | xargs pip install
63+
64+
- name: Install PyTest
65+
run: pip install pytest
66+
67+
# Run the entire test suite using PyTest.
68+
# PyTest automatically discovers all test files in the 'tests/' directory.
69+
# This includes our new tests for visualization, operators, parallel processing, etc.
70+
- name: Run Tests
71+
run: |
72+
pytest

.github/workflows/main_py310.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/main_py311.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/main_py312.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/main_py313.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/main_py38.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/main_py39.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

docs/md/helper.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ The `pygad.helper.misc` module has a class called `Helper` with some methods to
3838
10. `generate_gene_value()`: Generates a value for the gene. It checks whether `gene_space` is `None` and calls either `generate_gene_value_randomly()` or `generate_gene_value_from_space()`.
3939
11. `filter_gene_values_by_constraint()`: Receives a list of values for a gene. Then it filters such values using the gene constraint.
4040
12. `get_valid_gene_constraint_values()`: Selects one valid gene value that satisfy the gene constraint. It simply calls `generate_gene_value()` to generate some gene values then it filters such values using `filter_gene_values_by_constraint()`.
41+
13. `initialize_parents_array()`: Usually called from the methods in the `ParentSelection` class in the `pygad/utils/parent_selection.py` script to initialize the parents array.
4142

0 commit comments

Comments
 (0)