diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index aa8ce8ab..8466aa66 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -17,7 +17,7 @@ jobs: - architecture: "x64" platform-vcvars: "x86_amd64" platform-msbuild: "x64" - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] exclude: - platform: macos-latest architecture: "x86" @@ -39,30 +39,26 @@ jobs: if: contains(matrix.platform, 'windows') run: | cmd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }} - - name: Install dependencies + - name: Upgrade pip and install build/lint/test dependencies run: | python -m pip install --upgrade pip - pip install wheel - pip install -r requirements/default.txt + pip install flake8 build pytest - name: Lint with flake8 run: | - pip install flake8 # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=lib # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=lib - name: Create wheel distribution run: | - pip wheel --no-deps . -w dist - - name: List wheel files - run: | - ls dist - - name: Install package + python -m build --wheel + - name: Install package (prevents pip from looking for PyPI's version) run: | + python scripts/generate_requirements.py + pip install -r requirements_default.txt pip install --no-index --find-links=dist --verbose pyvinecopulib - name: Test with pytest run: | - pip install pytest pytest tests -r a - name: Upload binaries uses: actions/upload-artifact@v3 @@ -89,14 +85,13 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies + - name: Upgrade pip and install build dependency run: | python -m pip install --upgrade pip - pip install wheel - pip install -r requirements/default.txt + pip install build - name: Create source distribution run: | - python setup.py sdist + python -m build --sdist - name: Download binaries uses: actions/download-artifact@v3 with: diff --git a/clang-env.txt b/clang-env.txt deleted file mode 100644 index 751f9070..00000000 --- a/clang-env.txt +++ /dev/null @@ -1,97 +0,0 @@ -# This file may be used to create an environment using: -# $ conda create --name --file -# platform: linux-64 -@EXPLICIT -https://repo.anaconda.com/pkgs/main/linux-64/_libgcc_mutex-0.1-main.conda -https://conda.anaconda.org/conda-forge/linux-64/ca-certificates-2019.11.28-hecc5488_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libgfortran-ng-7.3.0-hdf63c60_2.tar.bz2 -https://repo.anaconda.com/pkgs/main/linux-64/libstdcxx-ng-9.1.0-hdf63c60_0.conda -https://repo.anaconda.com/pkgs/main/linux-64/libgcc-ng-9.1.0-hdf63c60_0.conda -https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-h516909a_1.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/expat-2.2.5-he1b5a44_1004.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/icu-64.2-he1b5a44_1.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/jpeg-9c-h14c3975_1001.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libffi-3.2.1-he1b5a44_1006.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libiconv-1.15-h516909a_1005.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libllvm9-9.0.1-hc9558a2_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.7-h6e990d7_3.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.32.1-h14c3975_1000.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libxkbcommon-0.9.1-hebb1f50_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.1-hf484d3e_1002.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/nspr-4.24-he1b5a44_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/openssl-1.1.1d-h516909a_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/pcre-8.43-he1b5a44_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/pthread-stubs-0.4-h14c3975_1001.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/xorg-libxau-1.0.9-h14c3975_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/xorg-libxdmcp-1.1.3-h516909a_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/xz-5.2.4-h14c3975_1001.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/zlib-1.2.11-h516909a_1006.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/gettext-0.19.8.1-hc5be6a0_1002.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libblas-3.8.0-14_openblas.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libclang-9.0.1-default_hde54327_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libpng-1.6.37-hed695b0_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libxcb-1.13-h14c3975_1002.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libxml2-2.9.10-hee79883_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/readline-8.0-hf8c457e_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.10-hed695b0_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/freetype-2.10.0-he983fc9_1.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.8.0-14_openblas.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.8.0-14_openblas.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/sqlite-3.30.1-hcee41ef_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/fontconfig-2.13.1-h86ecdb6_1001.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/nss-3.47-he751ad9_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/python-3.7.3-h33d41f4_1.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/alabaster-0.7.12-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/certifi-2019.11.28-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/chardet-3.0.4-py37_1003.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/docutils-0.15.2-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/future-0.18.2-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/glib-2.58.3-py37h6f030ca_1002.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/idna-2.8-py37_1000.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/imagesize-1.1.0-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/kiwisolver-1.1.0-py37hc9558a2_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/markupsafe-1.1.1-py37h516909a_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/mistune-0.8.4-py37h516909a_1000.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/numpy-1.17.3-py37h95a1406_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/pybind11-2.4.3-py37hc9558a2_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/pycparser-2.19-py37_1.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/pyparsing-2.4.5-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/pysocks-1.7.1-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/pytz-2019.3-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/six-1.13.0-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/snowballstemmer-2.0.0-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/sphinx_rtd_theme-0.4.3-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-applehelp-1.0.1-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-devhelp-1.0.1-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-htmlhelp-1.0.2-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-jsmath-1.0.1-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-qthelp-1.0.2-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-serializinghtml-1.1.3-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/tornado-6.0.3-py37h516909a_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/babel-2.7.0-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/cffi-1.13.2-py37h8022711_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/commonmark-0.9.1-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/cycler-0.10.0-py_2.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/dbus-1.13.6-he372182_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/gstreamer-1.14.5-h36ae1b5_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/m2r-0.2.1-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/packaging-19.2-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.8.1-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/scipy-1.4.1-py37h921218d_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/setuptools-42.0.1-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/cryptography-2.8-py37h72c5cf5_1.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/gst-plugins-base-1.14.5-h0935bb2_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/jinja2-2.10.3-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/matplotlib-base-3.1.2-py37h250f245_1.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/pygments-2.5.2-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/setuptools_scm-3.3.3-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/wheel-0.33.6-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/pip-19.3.1-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/pyopenssl-19.1.0-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/qt-5.12.5-hd8c4c69_1.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/pyqt-5.12.3-py37hcca6a23_1.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/urllib3-1.25.7-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/matplotlib-3.1.2-py37_1.tar.bz2 -https://conda.anaconda.org/conda-forge/linux-64/requests-2.22.0-py37_1.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/sphinx-2.2.2-py_0.tar.bz2 -https://conda.anaconda.org/conda-forge/noarch/recommonmark-0.6.0-py_0.tar.bz2 diff --git a/pyproject.toml b/pyproject.toml index 4d16ca9c..9d3aa49a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,7 @@ classifiers = [ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License' ] dependencies = [ @@ -39,6 +40,8 @@ dependencies = [ ] [tool.setuptools_scm] +version_scheme = "python-simplified-semver" +local_scheme = "no-local-version" [project.urls] Homepage = "https://github.com/vinecopulib/pyvinecopulib/" diff --git a/requirements/default.txt b/requirements/default.txt deleted file mode 100644 index b2031cdd..00000000 --- a/requirements/default.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Generated via scripts/generate_requirements.py and pre-commit hook. -# Do not edit this file; modify pyproject.toml instead. -pybind11>=2.10.0 -setuptools>=64.0.0 -setuptools_scm>=8.0.0 -numpy>=1.14 diff --git a/scripts/generate_requirements.py b/scripts/generate_requirements.py index 0b3bbc02..bf47fa70 100644 --- a/scripts/generate_requirements.py +++ b/scripts/generate_requirements.py @@ -1,8 +1,9 @@ #!/usr/bin/env python -"""Generate requirements/*.txt files from pyproject.toml.""" +"""Generate *.txt (e.g., requirements.txt) files from pyproject.toml.""" import sys from pathlib import Path +from typing import List try: # standard module since Python 3.11 import tomllib as toml @@ -16,21 +17,26 @@ repo_dir = script_pth.parent.parent script_relpth = script_pth.relative_to(repo_dir) header = [ - f"# Generated via {script_relpth.as_posix()} and pre-commit hook.", + f"# Generated via {script_relpth.as_posix()}.", "# Do not edit this file; modify pyproject.toml instead.", ] -def generate_requirement_file(name: str, req_list: list[str]) -> None: - req_fname = repo_dir / "requirements" / f"{name}.txt" +def generate_requirement_file(name: str, req_list: List[str]) -> None: + req_fname = repo_dir / f"{name}.txt" req_fname.write_text("\n".join(header + req_list) + "\n") -def main() -> None: +def main(name: str = "requirements_default") -> None: pyproject = toml.loads((repo_dir / "pyproject.toml").read_text()) - generate_requirement_file("default", pyproject["project"]["dependencies"]) + generate_requirement_file(name, pyproject["project"]["dependencies"]) if __name__ == "__main__": - main() + if len(sys.argv) == 1: + main() + elif len(sys.argv) == 2: + main(sys.argv[1]) + else: + raise RuntimeError("Too many arguments")