Skip to content

Commit

Permalink
Use poetry to manage project settings and provide pyinstaller build (#…
Browse files Browse the repository at this point in the history
…199)

* try using poetry and poetry build. fix application_path for executable

* cleanup pyproject.toml

* add arch value for macOS

* use typehint for older pythons

* switch macOS to x86_64

* add metadata

* use pyproject.toml

* update changelog

* remove setup.cfg

* use requirements export from poetry

* update python action

* use specific numpy+scipy versions
  • Loading branch information
dromer authored Sep 26, 2024
1 parent 8feda17 commit e6d2b93
Show file tree
Hide file tree
Showing 13 changed files with 889 additions and 206 deletions.
3 changes: 2 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[bumpversion]
current_version = 0.12.1

[bumpversion:file:setup.cfg]
[bumpversion:file:pyproject.toml]
search = {current_version}

[bumpversion:file:CHANGELOG.md]
search = Next Release
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
- name: Initialize lfs
run: git lfs pull
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
pip install tox tox-gh-actions
- name: Run tox
run: tox
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
CHANGELOG
=====

Next Release
-----

Features:

* migrating to poetry for project management

0.12.1
-----

Expand Down
8 changes: 7 additions & 1 deletion hvcc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,16 @@ def compile_dataflow(
patch_name = hvir["name"]["escaped"]
externs = generate_extern_info(hvir, results)

# get application path
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
application_path = os.path.join(sys._MEIPASS, 'hvcc')
elif __file__:
application_path = os.path.dirname(__file__)

c_src_dir = os.path.join(out_dir, "c")
results["ir2c"] = ir2c.ir2c.compile(
hv_ir_path=os.path.join(results["hv2ir"]["out_dir"], results["hv2ir"]["out_file"]),
static_dir=os.path.join(os.path.dirname(__file__), "generators/ir2c/static"),
static_dir=os.path.join(application_path, "generators/ir2c/static"),
output_dir=c_src_dir,
externs=externs,
copyright=copyright,
Expand Down
2 changes: 1 addition & 1 deletion hvcc/core/hv2ir/HeavyLangObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def remove_connection(self, c: Connection) -> None:
else:
raise HeavyException(f"Connection {c} does not connect to this object {self}.")

def replace_connection(self, c: Connection, n_list: list) -> None:
def replace_connection(self, c: Connection, n_list: List) -> None:
""" Replaces connection c with connection list n_list, maintaining connection order
"""
if c.from_object is self:
Expand Down
775 changes: 775 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[tool.poetry]
name = "hvcc"
version = "0.12.1"
description = "`hvcc` is a python-based dataflow audio programming language compiler that generates C/C++ code and a variety of specific framework wrappers."
authors = ["Enzien Audio, Wasted Audio"]
license = "GPLv3"
readme = "README.md"
documentation = "https://wasted-audio.github.io/hvcc/"
repository = "https://github.com/Wasted-Audio/hvcc"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Compilers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12"
]

[tool.poetry.scripts]
hvcc = "hvcc:main"
hvutil = "hvcc.utils:main"

[tool.poetry.dependencies]
python = "^3.8.1"
Jinja2 = ">=2.11"
importlib-resources = ">=5.1"
wstd2daisy = ">=0.5.3"
pydantic = ">=2.9.1"

[tool.poetry.group.dev.dependencies]
numpy = [
{ version = "^2.0.1", python = "^3.9" },
{ version = "^1.24.3", python = "==3.8"}
]
scipy = [
{ version = "^1.13.1", python = "^3.9"},
{ version = "^1.9.1", python = "==3.8"}
]
pytest-cov = "^5.0.0"
flake8 = "^7.1.1"
mypy = "^1.11.2"
pytest = "^8.3.3"

[tool.poetry-pyinstaller-plugin]
collect = { all = ["json2daisy"] }
include = { "hvcc/generators" = "hvcc/generators", "hvcc/core" = "hvcc/core", "hvcc/interpreters" = "hvcc/interpreters" }


[tool.poetry-pyinstaller-plugin.scripts]
Heavy = { source = "hvcc/__init__.py", type = "onefile", bundle = true, arch = "x86_64" }

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
23 changes: 20 additions & 3 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
numpy
scipy
requests
colorama==0.4.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" and sys_platform == "win32"
coverage[toml]==7.6.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
exceptiongroup==1.2.2 ; python_full_version >= "3.8.1" and python_version < "3.11"
flake8==7.1.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
iniconfig==2.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
mccabe==0.7.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
mypy-extensions==1.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
mypy==1.11.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
numpy==1.24.4 ; python_full_version >= "3.8.1" and python_version == "3.8"
numpy==2.0.2 ; python_version >= "3.9" and python_version < "4.0"
packaging==24.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pluggy==1.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pycodestyle==2.12.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pyflakes==3.2.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pytest-cov==5.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pytest==8.3.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
scipy==1.10.1 ; python_full_version >= "3.8.1" and python_version == "3.8"
scipy==1.13.1 ; python_version >= "3.9" and python_version < "4.0"
tomli==2.0.1 ; python_full_version >= "3.8.1" and python_full_version <= "3.11.0a6"
typing-extensions==4.12.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
10 changes: 9 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
.
annotated-types==0.7.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
importlib-resources==6.4.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
jinja2==3.1.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
markupsafe==2.1.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pydantic-core==2.23.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pydantic==2.9.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
typing-extensions==4.12.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
wstd2daisy==0.5.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
zipp==3.20.2 ; python_full_version >= "3.8.1" and python_version < "3.10"
33 changes: 0 additions & 33 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

158 changes: 0 additions & 158 deletions tests/test_unity.py

This file was deleted.

12 changes: 9 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
; Tox config
[tox]
envlist = flake8, mypy, py38, py39, py310, py311, py312
; envlist = py312
skipsdist = true

[gh-actions]
Expand All @@ -14,26 +15,31 @@ python =
; Test config
[testenv]
deps =
-rrequirements.txt
.
-rrequirements-test.txt
pytest-cov
commands =
python -m pytest --cov-config=tox.ini --cov=hvcc tests/

[testenv:flake8]
deps =
-rrequirements-test.txt
flake8
basepython =
python3
allowlist_externals =
flake8
commands =
flake8

[testenv:mypy]
deps =
-rrequirements.txt
.
-rrequirements-test.txt
mypy
basepython =
python3
allowlist_externals =
mypy
commands =
mypy hvcc

Expand Down

0 comments on commit e6d2b93

Please sign in to comment.