Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.12 (#111) #112

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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:
Expand Down
97 changes: 0 additions & 97 deletions clang-env.txt

This file was deleted.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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/"
Expand Down
6 changes: 0 additions & 6 deletions requirements/default.txt

This file was deleted.

20 changes: 13 additions & 7 deletions scripts/generate_requirements.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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")