From 516ac20ba99504432f206086cc9651d1b0174c5e Mon Sep 17 00:00:00 2001 From: Ahmed Gad Date: Mon, 9 Dec 2024 12:06:33 -0500 Subject: [PATCH 1/6] Read the requirements from the .txt file --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b9f88de..bbef371 100644 --- a/setup.py +++ b/setup.py @@ -3,11 +3,15 @@ with open("README.md", "r") as fh: long_description = fh.read() +# Read the requirements from the requirements.txt file +with open("requirements.txt", "r") as f: + requirements = f.read().splitlines() + setuptools.setup( name="pygad", version="3.3.1", author="Ahmed Fawzy Gad", - install_requires=["numpy", "matplotlib", "cloudpickle",], + install_requires=requirements, author_email="ahmed.f.gad@gmail.com", description="PyGAD: A Python Library for Building the Genetic Algorithm and Training Machine Learning Algoithms (Keras & PyTorch).", long_description=long_description, From 1a0c67fcc181cbfa5128d5d395676776e28cdf35 Mon Sep 17 00:00:00 2001 From: Ahmed Gad Date: Mon, 9 Dec 2024 12:12:44 -0500 Subject: [PATCH 2/6] Read the requirements from the .txt file --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bbef371..9e79e05 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,15 @@ import setuptools +import os with open("README.md", "r") as fh: long_description = fh.read() +# Dynamically read requirements.txt +this_dir = os.path.abspath(os.path.dirname(__file__)) +requirements_path = os.path.join(this_dir, "requirements.txt") + # Read the requirements from the requirements.txt file -with open("requirements.txt", "r") as f: +with open(requirements_path, "r") as f: requirements = f.read().splitlines() setuptools.setup( From 138333ade96f2baf40face76e7c6e69721d5221c Mon Sep 17 00:00:00 2001 From: Ahmed Gad Date: Mon, 9 Dec 2024 12:15:29 -0500 Subject: [PATCH 3/6] Hardcode the requirements --- setup.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 9e79e05..b9f88de 100644 --- a/setup.py +++ b/setup.py @@ -1,22 +1,13 @@ import setuptools -import os with open("README.md", "r") as fh: long_description = fh.read() -# Dynamically read requirements.txt -this_dir = os.path.abspath(os.path.dirname(__file__)) -requirements_path = os.path.join(this_dir, "requirements.txt") - -# Read the requirements from the requirements.txt file -with open(requirements_path, "r") as f: - requirements = f.read().splitlines() - setuptools.setup( name="pygad", version="3.3.1", author="Ahmed Fawzy Gad", - install_requires=requirements, + install_requires=["numpy", "matplotlib", "cloudpickle",], author_email="ahmed.f.gad@gmail.com", description="PyGAD: A Python Library for Building the Genetic Algorithm and Training Machine Learning Algoithms (Keras & PyTorch).", long_description=long_description, From 2aa059d5c6532374a53b5e60b6bc51b1864aaac1 Mon Sep 17 00:00:00 2001 From: Ahmed Gad Date: Mon, 9 Dec 2024 12:31:14 -0500 Subject: [PATCH 4/6] Install the requirements in GitHub actions --- .github/workflows/main_py310.yml | 5 +++++ .github/workflows/main_py311.yml | 5 +++++ .github/workflows/main_py312.yml | 5 +++++ .github/workflows/main_py37.yml | 5 +++++ .github/workflows/main_py38.yml | 5 +++++ .github/workflows/main_py39.yml | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/.github/workflows/main_py310.yml b/.github/workflows/main_py310.yml index 508dcf4..9602f17 100644 --- a/.github/workflows/main_py310.yml +++ b/.github/workflows/main_py310.yml @@ -20,6 +20,11 @@ jobs: with: python-version: '3.10' + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Build PyGAD from the Repository run: | python3 -m pip install --upgrade build diff --git a/.github/workflows/main_py311.yml b/.github/workflows/main_py311.yml index ce5a196..d468243 100644 --- a/.github/workflows/main_py311.yml +++ b/.github/workflows/main_py311.yml @@ -20,6 +20,11 @@ jobs: with: python-version: '3.11' + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Build PyGAD from the Repository run: | python3 -m pip install --upgrade build diff --git a/.github/workflows/main_py312.yml b/.github/workflows/main_py312.yml index 560d501..87bd648 100644 --- a/.github/workflows/main_py312.yml +++ b/.github/workflows/main_py312.yml @@ -28,6 +28,11 @@ jobs: with: python-version: '3.12.0-beta.2' + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Build PyGAD from the Repository run: | python3 -m pip install --upgrade build diff --git a/.github/workflows/main_py37.yml b/.github/workflows/main_py37.yml index 6268472..037086e 100644 --- a/.github/workflows/main_py37.yml +++ b/.github/workflows/main_py37.yml @@ -20,6 +20,11 @@ jobs: with: python-version: '3.7' + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Build PyGAD from the Repository run: | python3 -m pip install --upgrade build diff --git a/.github/workflows/main_py38.yml b/.github/workflows/main_py38.yml index d8902dc..602f917 100644 --- a/.github/workflows/main_py38.yml +++ b/.github/workflows/main_py38.yml @@ -20,6 +20,11 @@ jobs: with: python-version: '3.8' + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Build PyGAD from the Repository run: | python3 -m pip install --upgrade build diff --git a/.github/workflows/main_py39.yml b/.github/workflows/main_py39.yml index e4e0ef1..c6b61fc 100644 --- a/.github/workflows/main_py39.yml +++ b/.github/workflows/main_py39.yml @@ -20,6 +20,11 @@ jobs: with: python-version: '3.9' + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Build PyGAD from the Repository run: | python3 -m pip install --upgrade build From fca6058cb712a24b1f761febe0a56bbcafcd3154 Mon Sep 17 00:00:00 2001 From: Ahmed Gad Date: Tue, 10 Dec 2024 10:01:03 -0500 Subject: [PATCH 5/6] Reformat docstring --- pygad/utils/crossover.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pygad/utils/crossover.py b/pygad/utils/crossover.py index e6c489e..d7cd86e 100644 --- a/pygad/utils/crossover.py +++ b/pygad/utils/crossover.py @@ -13,11 +13,15 @@ def __init__(): def single_point_crossover(self, parents, offspring_size): """ - Applies the single-point crossover. It selects a point randomly at which crossover takes place between the pairs of parents. - It accepts 2 parameters: - -parents: The parents to mate for producing the offspring. - -offspring_size: The size of the offspring to produce. - It returns an array the produced offspring. + Applies single-point crossover between pairs of parents. + This function selects a random point at which crossover occurs between the parents, generating offspring. + + Parameters: + parents (array-like): The parents to mate for producing the offspring. + offspring_size (int): The number of offspring to produce. + + Returns: + array-like: An array containing the produced offspring. """ if self.gene_type_single == True: From a9d09b41dbb340dd3ae597acb9cebc721ca0dcf6 Mon Sep 17 00:00:00 2001 From: Ahmed Gad Date: Tue, 10 Dec 2024 10:02:56 -0500 Subject: [PATCH 6/6] Add OSSF and StackOverFlow badges --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cd84391..e2ede3a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ Check documentation of the [PyGAD](https://pygad.readthedocs.io/en/latest). -[![Downloads](https://pepy.tech/badge/pygad)](https://pepy.tech/project/pygad) [![PyPI version](https://badge.fury.io/py/pygad.svg)](https://badge.fury.io/py/pygad) ![Docs](https://readthedocs.org/projects/pygad/badge) [![PyGAD PyTest / Python 3.11](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py311.yml/badge.svg)](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py311.yml) [![PyGAD PyTest / Python 3.10](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py310.yml/badge.svg)](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py310.yml) [![PyGAD PyTest / Python 3.9](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py39.yml/badge.svg)](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py39.yml) [![PyGAD PyTest / Python 3.8](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py38.yml/badge.svg)](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py38.yml) [![PyGAD PyTest / Python 3.7](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py37.yml/badge.svg)](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py37.yml) [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) [![Translation](https://hosted.weblate.org/widgets/weblate/-/svg-badge.svg)](https://hosted.weblate.org/engage/weblate/) [![REUSE](https://api.reuse.software/badge/github.com/WeblateOrg/weblate)](https://api.reuse.software/info/github.com/WeblateOrg/weblate) +[![Downloads](https://pepy.tech/badge/pygad)](https://pepy.tech/project/pygad) [![PyPI version](https://badge.fury.io/py/pygad.svg)](https://badge.fury.io/py/pygad) ![Docs](https://readthedocs.org/projects/pygad/badge) [![PyGAD PyTest / Python 3.11](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py311.yml/badge.svg)](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py311.yml) [![PyGAD PyTest / Python 3.10](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py310.yml/badge.svg)](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py310.yml) [![PyGAD PyTest / Python 3.9](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py39.yml/badge.svg)](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py39.yml) [![PyGAD PyTest / Python 3.8](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py38.yml/badge.svg)](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py38.yml) [![PyGAD PyTest / Python 3.7](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py37.yml/badge.svg)](https://github.com/ahmedfgad/GeneticAlgorithmPython/actions/workflows/main_py37.yml) [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) [![Translation](https://hosted.weblate.org/widgets/weblate/-/svg-badge.svg)](https://hosted.weblate.org/engage/weblate/) [![REUSE](https://api.reuse.software/badge/github.com/WeblateOrg/weblate)](https://api.reuse.software/info/github.com/WeblateOrg/weblate)[![Stack Overflow](https://img.shields.io/badge/stackoverflow-Ask%20questions-blue.svg)]( +https://stackoverflow.com/questions/tagged/pygad)[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ahmedfgad/GeneticAlgorithmPython/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ahmedfgad/GeneticAlgorithmPython) ![PYGAD-LOGO](https://user-images.githubusercontent.com/16560492/101267295-c74c0180-375f-11eb-9ad0-f8e37bd796ce.png)