From 4a480c99117b7b4e44822b659982e826a65af680 Mon Sep 17 00:00:00 2001 From: Jackson Burns Date: Fri, 28 Jun 2024 15:22:24 -0400 Subject: [PATCH 1/4] update README --- LICENSE | 21 ++++++++ README.md | 52 ++++++++++++++++++++ README.rst | 142 ----------------------------------------------------- 3 files changed, 73 insertions(+), 142 deletions(-) create mode 100644 LICENSE create mode 100644 README.md delete mode 100644 README.rst diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fa432d5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2011 by Joshua W. Allen (joshua.w.allen@gmail.com). + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3823f00 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# PyDQED +## Python wrapper for the DQED constrained nonlinear optimization code + +> [!WARNING] +> PyDQED is currently abandonware. The ReactionMechanismGenerator organization no longer has developers capable of maintaining it. + +The usage documentation is still relevant but no new updates will be released and we are unable to fix any bugs. +We will continue to release conda packages for PyDQED as long as possible. + +To build PyDQED, clone this repository, install the dependencies (find them with `conda search -c rmg PyDQED`), upgrade whichever are causing problems, then navigate to the `.conda` directory and run `conda build .`. + +What follows is the original content of the README, slighly updated to removed erroneous instructions and dead links. + +# Introduction + +PyDQED provides a means for Python code to utilize DQED, a bounded, constrained nonlinear optimization code. +DQED is [publicly available](http://www.netlib.org/opt/dqed.f) and is distributed with PyDQED. +PyDQED provides a Python extension type for DQED, which in turn provides a Pythonic means of setting the solver options, providing residual and jacobian functions, and running the solver. + +The code for DQED has been provided with the PyDQED package. The license for DQED is different than that of the PyDQED wrapper code. **You are responsible for knowing and abiding by all licenses associated with DQED as well as with PyDQED.** + +# Installation +## Anaconda Binary (Recommended) + +Install from the `rmg` conda channel: +``` +conda install -c rmg pydqed +``` + +## Build Locally +### Dependencies + +We build PyDQED using GitHub actions to support multiple versions of Python and platforms. + +To build locally, you need the following dependencies (which will automatically be installed with conda when not building locally): + - python + - numpy + - Cython + - gfortran + - gcc + +### Building +A Makefile has been provided that can be used to compile DQED and the PyDQED wrapper code. To use, invoke the following command from the base package directory: +``` +make +``` + +This command will build PyDQED in-place, rather than installing it to your Python package directory. +If you wish to formally install PyDQED, run the following command from the base package directory after the `make` command (you may need root privileges for this): +``` +python setup.py install +``` diff --git a/README.rst b/README.rst deleted file mode 100644 index 1189c77..0000000 --- a/README.rst +++ /dev/null @@ -1,142 +0,0 @@ -.. warning:: - PyDQED is currently abandonware. The ReactionMechanismGenerator - organization no longer has developers capable of maintaining it. - - The usage documentation is still relevant but no new updates will be - released and we are unable to fix any bugs. - - We will continue to release conda packages for PyDQED as long as possible. - The current version (as of 5/2/2023) was built with libgfortran-ng 12 (or just libgfortran 5 for Mac) and - Python 3.7 - it is likely in the future that this will no longer work properly - and need to be fixed. - - To build PyDQED, clone this repository, install the dependencies (find them - with conda search -c rmg PyDQED), upgrade whichever are causing problems, - then navigate to the .conda directory and run "conda build ." - - Good Luck, - Jackson (@JacksonBurns) - -****************************************************************************** -PyDQED - A Python wrapper for the DQED constrained nonlinear optimization code -****************************************************************************** - -Introduction -============ - -PyDQED provides a means for Python code to utilize DQED, a bounded, constrained -nonlinear optimization code. DQED is -`publicly `_ -`available `_, and is distributed with PyDQED. -PyDQED provides a Python extension type for DQED, which in turn provides a -Pythonic means of setting the solver options, providing residual and jacobian -functions, and running the solver. - -License -======= - -Copyright (c) 2011 by Joshua W. Allen (joshua.w.allen@gmail.com). - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the 'Software'), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - -Dependencies -============ - -PyDQED has been tested on Python versions 2.5 and 2.6. It may or may not work -for other Python versions. - -There are several Python dependencies that you must install before installing -PyDQED: - -* `Python `_ (versions 2.5.x and 2.6.x are known to work) - -* `NumPy `_ (version 1.3.0 or later is recommended) - -* `Cython `_ (version 0.12.1 or later is recommended) - -In addition, you will also need a Fortran compiler and a C compiler that -produce object files that can interoperate. The ``gfortran`` and ``gcc`` -compiles from the GNU Compiler Collection are known to work. On Windows the -`MinGW `_ compiler collection provides these compilers. - -The code for DQED has been provided with the PyDQED package. The license for -DQED is different than that of the PyDQED wrapper code. **You are responsible -for knowing and abiding by all licenses associated with DQED as well as with -PyDQED.** - -Installation -============ - -Anaconda Binary (Recommended) ------------------------------ - -There is no need to install dependencies with this method. You will automatically install the latest binary package for PyDQED. - -* Download and install the `Anaconda Python Platform `_ for Python 2.7 (make sure not to install Python 3.0+, which is incompatible with RMG). When prompted to append Anaconda to your PATH, select or type Yes. - -* It is safest to install the PyDQED binary onto a fresh Anaconda envrionment via the Terminal or Command Prompt :: - - conda create -c rmg --name pydqed_env pydqed - -* (For Unix-based systems) To use it you must first activate the environment by typing :: - - source activate pydqed_env - -* (For Windows) To use it you must first activate the environment by typing :: - - activate pydqed_env - - -Windows -------- - -The provided batch script will compile DQED and the PyDQED wrapper code. This -script presumes that you have the 32-bit version of the MinGW C and Fortran -compilers installed. Once you have run the batch script, you can install PyDQED -into your Python packages if you desire by running the following command from -the base package directory: - - > python setup.py install - -Linux ------ - -A Makefile has been provided that can be used to compile DQED and the PyDQED -wrapper code. To use, invoke the following command from the base package -directory:: - - $ make - -This command will build PyDQED in-place, rather than installing it to your -Python package directory. If you wish to formally install PyDQED, run the -following command from the base package directory after the ``make`` command -(you may need root privileges for this):: - - $ python setup.py install - -Mac OS X --------- - -Very much like the linux, but if you have installed gfortran via `homebrew `_ , -(`brew install gcc`) then you may need to tell the makefile where to -find the libraries:: - - $ export LIBRARY_PATH=$(dirname $(gfortran -print-file-name=libgfortran.a)) - $ make - $ make install From b61b11de13c5fd94c68e7fb9e7f3e7f82db5a7d7 Mon Sep 17 00:00:00 2001 From: Jackson Burns Date: Fri, 28 Jun 2024 15:25:50 -0400 Subject: [PATCH 2/4] delete windows scripts --- .conda/bld.bat | 12 --- documentation/make.bat | 170 ----------------------------------------- 2 files changed, 182 deletions(-) delete mode 100644 .conda/bld.bat delete mode 100644 documentation/make.bat diff --git a/.conda/bld.bat b/.conda/bld.bat deleted file mode 100644 index 0a7d21d..0000000 --- a/.conda/bld.bat +++ /dev/null @@ -1,12 +0,0 @@ -cp "%PREFIX%\..\..\libs\libpython27.a" "%PREFIX%\libs" -cp "%PREFIX%\..\..\Lib\distutils\distutils.cfg" "%PREFIX%\Lib\distutils\distutils.cfg - -gfortran -fPIC -O3 -c dqed.f90 -o dqed.o -ar rcs libdqed.a dqed.o - -"%PYTHON%" setup.py build_ext --build-lib . --build-temp build --pyrex-c-in-temp --compiler=mingw32 - -"%PYTHON%" setup.py install - - -"%PYTHON%" -c "from pydqed import __version__; print __version__" > "%SRC_DIR%/__conda_version__.txt" \ No newline at end of file diff --git a/documentation/make.bat b/documentation/make.bat deleted file mode 100644 index 2022450..0000000 --- a/documentation/make.bat +++ /dev/null @@ -1,170 +0,0 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set BUILDDIR=build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. singlehtml to make a single large HTML file - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. devhelp to make HTML files and a Devhelp project - echo. epub to make an epub - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. text to make text files - echo. man to make manual pages - echo. changes to make an overview over all changed/added/deprecated items - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - goto end -) - -if "%1" == "clean" ( - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - -if "%1" == "html" ( - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "singlehtml" ( - %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\PyDQED.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\PyDQED.ghc - goto end -) - -if "%1" == "devhelp" ( - %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. - goto end -) - -if "%1" == "epub" ( - %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The epub file is in %BUILDDIR%/epub. - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "text" ( - %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The text files are in %BUILDDIR%/text. - goto end -) - -if "%1" == "man" ( - %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The manual pages are in %BUILDDIR%/man. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - if errorlevel 1 exit /b 1 - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - if errorlevel 1 exit /b 1 - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - if errorlevel 1 exit /b 1 - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -:end From 329c35b2df30e8f4a2bf3ec5402b0505ef65bc28 Mon Sep 17 00:00:00 2001 From: Jackson Burns Date: Fri, 28 Jun 2024 15:31:39 -0400 Subject: [PATCH 3/4] add github action to build recipe on all platforms --- .github/workflows/build_package.yml | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/build_package.yml diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml new file mode 100644 index 0000000..40f200a --- /dev/null +++ b/.github/workflows/build_package.yml @@ -0,0 +1,55 @@ +name: Build Package + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + workflow_dispatch: + push: + branches: + - stable +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-13, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v4 + - name: Setup Conda + uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: false + conda-solver: libmamba + auto-activate-base: true + activate-environment: "" + - name: Install Build Tools + run: conda install python anaconda-client conda-build + - name: Configure Auto-Upload + if: github.ref == 'refs/heads/stable' + run: | + conda config --set anaconda_upload yes + - name: Build Binary + run: | + # set a default value to the conda_token if needed (like from forks) + : "${CONDA_TOKEN:=${{ secrets.ANACONDA_TOKEN }}}" + : "${CONDA_TOKEN:=default_value}" + echo "CONDA_TOKEN=$CONDA_TOKEN" >> $GITHUB_ENV + conda config --add channels conda-forge + conda config --add channels rmg + conda build --token $CONDA_TOKEN --user rmg . + result: + if: ${{ always() }} + runs-on: ubuntu-latest + name: Final Results + needs: [build] + steps: + - run: exit 1 + # see https://github.com/orgs/community/discussions/26822?sort=new#discussioncomment-8285141 + if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }} From c2dbbb931fe036aca9111913f14e62515ed7f6a2 Mon Sep 17 00:00:00 2001 From: Jackson Burns Date: Fri, 28 Jun 2024 15:32:03 -0400 Subject: [PATCH 4/4] add build variants to conda recipe --- .conda/conda_build_config.yaml | 6 ++++++ .conda/meta.yaml | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .conda/conda_build_config.yaml diff --git a/.conda/conda_build_config.yaml b/.conda/conda_build_config.yaml new file mode 100644 index 0000000..0fde6e5 --- /dev/null +++ b/.conda/conda_build_config.yaml @@ -0,0 +1,6 @@ +python: + - 3.8 + - 3.9 + - 3.10 + - 3.11 + - 3.12 diff --git a/.conda/meta.yaml b/.conda/meta.yaml index a438ed0..7a6db3c 100644 --- a/.conda/meta.yaml +++ b/.conda/meta.yaml @@ -12,15 +12,16 @@ build: requirements: build: - - {{ compiler('c') }} # [unix] - - {{ compiler('fortran') }} # [unix] + - {{ compiler('c') }} + - {{ compiler('fortran') }} host: - - python 3.7 + - python - cython - numpy - setuptools run: - - python 3.7 + - python + # https://conda-forge.org/docs/maintainer/knowledge_base/#building-against-numpy - {{ pin_compatible('numpy') }} test: