Skip to content

Commit

Permalink
nlwpy: Include nlwpy.test as submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
fdabrandao committed Feb 26, 2024
1 parent c61c0cb commit fec6395
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 48 deletions.
2 changes: 2 additions & 0 deletions nl-writer2/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
*.so
dist/
build/
__pycache__

29 changes: 29 additions & 0 deletions nl-writer2/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2024, AMPL Optimization inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions nl-writer2/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
recursive-include include *.h *.hpp
recursive-include nlwpy *.py
include LICENSE
35 changes: 0 additions & 35 deletions nl-writer2/nlwpy/conda.recipe/meta.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions nl-writer2/nlwpy/test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# nlwpy tests
# $ pytest --pyargs nlwpy
3 changes: 3 additions & 0 deletions nl-writer2/nlwpy/test/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import pytest

pytest.main(["--pyargs", "nlwpy.test"])
File renamed without changes.
Empty file removed nl-writer2/nlwpy/tests/__init__.py
Empty file.
33 changes: 20 additions & 13 deletions nl-writer2/setup.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
# Available at setup time due to pyproject.toml
from pybind11.setup_helpers import build_ext
from setuptools import setup, Extension
import pybind11
import glob
import os

__version__ = "0.0.1b0"

# The main interface is through Pybind11Extension.
# * You can add cxx_std=11/14/17, and then build_ext can be removed.
# * You can set include_pybind11=false to add the include directory yourself,
# say from a submodule.
#
# Note:
# Sort input source files if you glob sources to ensure bit-for-bit
# reproducible builds (https://github.com/pybind/python_example/pull/53)


def compile_args():
from platform import system
Expand All @@ -40,8 +31,26 @@ def compile_args():
return []


def ls_dir(base_dir):
return [
os.path.join(dirpath, fname)
for (dirpath, dirnames, files) in os.walk(base_dir)
for fname in files
]


def package_content():
files = ls_dir("nlwpy/")
return [
fpath.replace("nlwpy/", "", 1)
for fpath in files
if "__pycache__" not in fpath and fpath.endswith(".py")
]


setup(
name="nlwpy",
license="BSD-3",
version=__version__,
author="Gleb Belov",
author_email="[email protected]",
Expand All @@ -58,10 +67,8 @@ def compile_args():
define_macros=[("VERSION_INFO", __version__)],
),
],
package_data={"": package_content()},
extras_require={"test": "pytest"},
# Currently, build_ext only provides an optional "highest supported C++
# level" feature, but in the future it may provide more features.
cmdclass={"build_ext": build_ext},
zip_safe=False,
python_requires=">=3.7",
)

0 comments on commit fec6395

Please sign in to comment.