From ecde54a4599fb56303f89b46b2ed1ab236ba3a68 Mon Sep 17 00:00:00 2001 From: Simon Birkholz Date: Thu, 13 Mar 2025 12:36:29 +0100 Subject: [PATCH 1/5] changed to pyproject.toml --- .gitignore | 1 + git-hash.txt | 2 +- pyproject.toml | 45 +++++++++++++++ setup.py | 149 ------------------------------------------------- 4 files changed, 47 insertions(+), 150 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 02461bb..ab2dc32 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /cuvis/_cuvis_pyil.pyd /venv /cuvis/__pycache__ +/.venv310 diff --git a/git-hash.txt b/git-hash.txt index 87edf79..7762dd1 100644 --- a/git-hash.txt +++ b/git-hash.txt @@ -1 +1 @@ -unknown \ No newline at end of file +cee09c1ca36782c660607b93c445c42befdcf8a8 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..acf91c9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,45 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "cuvis" +version = "3.3.2rc1" +description = "CUVIS Python SDK." +readme = "README.md" +requires-python = ">=3.9" +license = { text = "Apache License 2.0" } +authors = [ + { name = "Cubert GmbH, Ulm, Germany", email = "SDK@cubert-gmbh.com" } +] + +dependencies = [ + "cuvis-il>3.3.1,<=3.3.2.post999999", + "typing_extensions; python_version<'3.10'", # Only for Python 3.9 + "setuptools; python_version>='3.12'" # Only for Python 3.12+ +] + +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Image Processing", +] + +[project.urls] +Homepage = "https://www.cubert-hyperspectral.com/" +Repository = "https://github.com/cubert-hyperspectral/cuvis.python" +Documentation = "https://cubert-hyperspectral.github.io/cuvis.doc/" +Changelog = "https://github.com/cubert-hyperspectral/cuvis.python/releases" +Issues = "https://github.com/cubert-hyperspectral/cuvis.python/issues" + +[tool.setuptools] +packages = ["cuvis"] +include-package-data = true + +[tool.twine] +repository = "pypi" diff --git a/setup.py b/setup.py deleted file mode 100644 index cc21fd5..0000000 --- a/setup.py +++ /dev/null @@ -1,149 +0,0 @@ -import os -import platform -import sys -import io -import subprocess -from shutil import rmtree, copy -from setuptools import setup, find_packages, Command -from setuptools.command import develop -from pathlib import Path - -here = os.path.abspath(os.path.dirname(__file__)) - -NAME = 'cuvis' -VERSION = '3.3.2rc1' - -DESCRIPTION = 'CUVIS Python SDK.' - -REQUIREMENTS = { - # Installation script (this file) dependencies - # 'setup': [ - # 'setuptools_scm', - # ], - # Installation dependencies - # Use with pip install . to install from source - 'install': [ - 'cuvis-il>3.3.1,<=3.3.2.post999999', - ], -} - -lib_dir = "" -if 'CUVIS' in os.environ: - lib_dir = os.getenv('CUVIS') - print('CUVIS SDK found at {}!'.format(lib_dir)) -else: - Exception( - 'CUVIS SDK does not seem to exist on this machine! Make sure that the environment variable CUVIS is set.') - - -def get_git_commit_hash() -> str: - try: - return subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip() - except subprocess.CalledProcessError: - return 'unknown' - -# taken from https://github.com/navdeep-G/setup.py/blob/master/setup.py - - -class UploadCommand(Command): - """Support setup.py upload.""" - - description = 'Build and publish the package.' - user_options = [] - - @staticmethod - def status(s): - """Prints things in bold.""" - print('\033[1m{0}\033[0m'.format(s)) - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - try: - self.status('Removing previous builds…') - rmtree(os.path.join(here, 'dist')) - except OSError: - pass - - self.status('Copying latest pyil files') - - self.status('Building Source and Wheel (universal) distribution…') - os.system('python setup.py sdist'.format(sys.executable)) - - self.status('Uploading the package to PyPI via Twine…') - os.system('twine upload dist/*') - - # self.status('Pushing git tags…') - # os.system('git tag v{0}'.format(about['__version__'])) - # os.system('git push --tags') - - sys.exit() - - -# Import the README and use it as the long-description. -# Note: this will only work if 'README.md' is present in your MANIFEST.in file! -try: - with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: - long_description = '\n' + f.read() -except FileNotFoundError: - long_description = DESCRIPTION - - -def __createManifest__(subdirs): - """inventory all files in path and create a manifest file""" - current = os.path.dirname(__file__) - relative_paths = [os.path.relpath(path, current) for path in subdirs] - - single_files = [os.path.join(here, 'README.md'), - os.path.join(here, 'git-hash.txt')] - - rel_single_files = [os.path.relpath(path, current) - for path in single_files] - - with open(os.path.join(current, "MANIFEST.in"), "w") as manifest: - # manifest.writelines( - # "recursive-include {} *.pyd \n".format(" ".join(relative_paths))) - # manifest.writelines( - # "recursive-include {} *.so \n".format(" ".join(relative_paths))) - manifest.writelines( - "include {} \n".format(" ".join(rel_single_files))) - - -add_il = os.path.join(here, "cuvis") - -__createManifest__([add_il]) - -# Import the README.md and use it as the long-description. -# Note: this will only work if 'README.md' is present in your MANIFEST.in file! -try: - with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: - long_description = '\n' + f.read() -except FileNotFoundError: - long_description = DESCRIPTION - -with open(Path(__file__).parent / "git-hash.txt", 'w') as f: - f.write(f'{get_git_commit_hash()}\n') - -setup( - name=NAME, - python_requires='>= 3.9', - version=VERSION, - packages=find_packages(), - url='https://www.cubert-hyperspectral.com/', - license='Apache License 2.0', - author='Cubert GmbH, Ulm, Germany', - author_email='SDK@cubert-gmbh.com', - description=DESCRIPTION, - long_description=long_description, - long_description_content_type='text/markdown', - # setup_requires=REQUIREMENTS['setup'], - install_requires=REQUIREMENTS['install'], - include_package_data=True, - cmdclass={ - 'upload': UploadCommand, - }, -) From b9fec9846457c2bb13c92bc893dbd1b86df9f28e Mon Sep 17 00:00:00 2001 From: Simon Birkholz Date: Thu, 13 Mar 2025 12:40:22 +0100 Subject: [PATCH 2/5] wip --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index acf91c9..9263e95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ authors = [ ] dependencies = [ - "cuvis-il>3.3.1,<=3.3.2.post999999", + "cuvis-il>3.3.1", "typing_extensions; python_version<'3.10'", # Only for Python 3.9 "setuptools; python_version>='3.12'" # Only for Python 3.12+ ] @@ -42,4 +42,4 @@ packages = ["cuvis"] include-package-data = true [tool.twine] -repository = "pypi" +repository = "testpypi" From 291780a2359d74a72a1050354db506e21c9a4b8b Mon Sep 17 00:00:00 2001 From: Simon Birkholz Date: Thu, 13 Mar 2025 12:53:08 +0100 Subject: [PATCH 3/5] added prebuild.py script --- prebuild.py | 15 +++++++++++++++ pyproject.toml | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 prebuild.py diff --git a/prebuild.py b/prebuild.py new file mode 100644 index 0000000..326463c --- /dev/null +++ b/prebuild.py @@ -0,0 +1,15 @@ +import subprocess +from pathlib import Path + + +def get_git_commit_hash(): + try: + return subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii").strip() + except subprocess.CalledProcessError: + return "unknown" + + +with open(Path(__file__).parent / "git-hash.txt", "w") as f: + f.write(f"{get_git_commit_hash()}\n") + +print("git-hash.txt created.") diff --git a/pyproject.toml b/pyproject.toml index 9263e95..149a156 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,5 +41,5 @@ Issues = "https://github.com/cubert-hyperspectral/cuvis.python/issues" packages = ["cuvis"] include-package-data = true -[tool.twine] -repository = "testpypi" +[tool.setuptools.package-data] +cuvis = ["git-hash.txt"] From 4e78fbc45b1158f1ca699b78892cfa3662a38147 Mon Sep 17 00:00:00 2001 From: Simon Birkholz Date: Thu, 13 Mar 2025 17:23:49 +0100 Subject: [PATCH 4/5] wip --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 149a156..37a1267 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Scientific/Engineering :: Image Processing", ] From cbf668767201ef29190807a65ec63df9c2a33077 Mon Sep 17 00:00:00 2001 From: Simon Birkholz Date: Mon, 17 Mar 2025 11:21:19 +0100 Subject: [PATCH 5/5] updated version number --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 37a1267..c25f408 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "cuvis" -version = "3.3.2rc1" +version = "3.3.2" description = "CUVIS Python SDK." readme = "README.md" requires-python = ">=3.9"