From 635aea0465aefcdab083ab1d475cfd2afc0646fc Mon Sep 17 00:00:00 2001 From: SylviaDu99 Date: Thu, 5 Sep 2024 18:12:36 -0700 Subject: [PATCH] WIP: add pyproject.toml, test_toml.py; deleted setup.py to avoid overwriting with pyproject.toml target to fix: issue #256 --- pyproject.toml | 3 - setup.py | 83 ------------------------- test_toml.py => tests/core/test_toml.py | 30 +-------- 3 files changed, 2 insertions(+), 114 deletions(-) delete mode 100644 setup.py rename test_toml.py => tests/core/test_toml.py (55%) diff --git a/pyproject.toml b/pyproject.toml index e707777a..47ca43d0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,9 +65,6 @@ dev = [ [project.urls] Homepage = "https://github.com/policyengine/policyengine-core" -[tool.setuptools.packages.find] -exclude = ["tests*"] - [tool.setuptools] include-package-data = true diff --git a/setup.py b/setup.py deleted file mode 100644 index c033a4e4..00000000 --- a/setup.py +++ /dev/null @@ -1,83 +0,0 @@ -from pathlib import Path - -from setuptools import find_packages, setup - -# Read the contents of our README file for PyPi -this_directory = Path(__file__).parent -long_description = (this_directory / "README.md").read_text() - -# Please make sure to cap all dependency versions, in order to avoid unwanted -# functional and integration breaks caused by external code updates. - -# general_requirements = [ -# "pytest>=8,<9", -# "numpy~=1.26.4", -# "black", -# "linecheck<1", -# "yaml-changelog<1", -# "coverage", -# "sortedcontainers<3", -# "numexpr<3", -# "dpath<3", -# "psutil<6", -# "wheel<1", -# "h5py>=3,<4", -# "requests>=2.27.1,<3", -# "pandas>=1", -# "plotly>=5.6.0,<6", -# "ipython>=7.17.0,<8", -# "pyvis>=0.3.2", -# ] -# -# dev_requirements = [ -# "jupyter-book<1", -# "furo<2023", -# "markupsafe==2.0.1", -# "coverage", -# "furo", -# "mypy<2", -# "sphinx==5.0.0", -# "sphinx-argparse==0.4.0", -# "sphinx-math-dollar==1.2.1", -# "types-PyYAML==6.0.12.2", -# "types-requests==2.28.11.7", -# "types-setuptools==65.6.0.2", -# "types-urllib3==1.26.25.4", -# ] - -setup( - name="policyengine-core", - version="3.6.3", - author="PolicyEngine", - author_email="hello@policyengine.org", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "License :: OSI Approved :: GNU Affero General Public License v3", - "Operating System :: POSIX", - "Programming Language :: Python", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Scientific/Engineering :: Information Analysis", - ], - description="Core microsimulation engine enabling country-specific policy models.", - keywords="tax benefit microsimulation framework", - license="https://www.fsf.org/licensing/licenses/agpl-3.0.html", - license_files=("LICENSE",), - url="https://github.com/policyengine/policyengine-core", - long_description=long_description, - long_description_content_type="text/markdown", - entry_points={ - "console_scripts": [ - "policyengine-core=policyengine_core.scripts.policyengine_command:main", - ], - }, - python_requires=">=3.9", - # extras_require={ - # "dev": dev_requirements, - # }, - include_package_data=True, # Will read MANIFEST.in - # install_requires=general_requirements, - packages=find_packages(exclude=["tests*"]), -) diff --git a/test_toml.py b/tests/core/test_toml.py similarity index 55% rename from test_toml.py rename to tests/core/test_toml.py index 5df94b7c..4f106da9 100644 --- a/test_toml.py +++ b/tests/core/test_toml.py @@ -2,12 +2,11 @@ import subprocess import tomli import pytest -from packaging import version @pytest.fixture(scope="module") def toml_data(): - file_path = "pyproject.toml" + file_path = "../../pyproject.toml" if not os.path.exists(file_path): pytest.fail("pyproject.toml not found in the current directory.") with open(file_path, "rb") as f: @@ -15,7 +14,7 @@ def toml_data(): def test_toml_syntax(): - file_path = "pyproject.toml" + file_path = "../../pyproject.toml" try: with open(file_path, "rb") as f: tomli.load(f) @@ -37,28 +36,3 @@ def test_build_system(toml_data): assert ( "build-backend" in build_system ), "Build system 'build-backend' is missing." - - -def test_package_build(): - try: - subprocess.run(["python", "-m", "build"], check=True) - except subprocess.CalledProcessError: - pytest.fail("Failed to build package.") - - -def test_package_installation(): - try: - subprocess.run(["pip", "install", "."], check=True) - except subprocess.CalledProcessError: - pytest.fail("Failed to install package.") - - -def test_run_tests(): - try: - subprocess.run(["pytest"], check=True) - except subprocess.CalledProcessError: - pytest.fail("Some tests failed.") - except FileNotFoundError: - pytest.skip( - "pytest not found. Make sure it's installed and in your PATH." - )