From 12c02ca4e6bf79a4db2017532685352f9bdd298a Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 16 Feb 2023 19:59:01 +0300 Subject: [PATCH 1/8] Move the source code files into an own dir. --- __init__.py => colorpy/__init__.py | 0 blackbody.py => colorpy/blackbody.py | 0 ciexyz.py => colorpy/ciexyz.py | 0 colormodels.py => colorpy/colormodels.py | 0 figures.py => colorpy/figures.py | 0 illuminants.py => colorpy/illuminants.py | 0 misc.py => colorpy/misc.py | 0 plots.py => colorpy/plots.py | 0 rayleigh.py => colorpy/rayleigh.py | 0 thinfilm.py => colorpy/thinfilm.py | 0 test_blackbody.py | 2 +- test_ciexyz.py | 2 +- test_colormodels.py | 2 +- test_illuminants.py | 2 +- test_rayleigh.py | 2 +- test_thinfilm.py | 2 +- 16 files changed, 6 insertions(+), 6 deletions(-) rename __init__.py => colorpy/__init__.py (100%) rename blackbody.py => colorpy/blackbody.py (100%) rename ciexyz.py => colorpy/ciexyz.py (100%) rename colormodels.py => colorpy/colormodels.py (100%) rename figures.py => colorpy/figures.py (100%) rename illuminants.py => colorpy/illuminants.py (100%) rename misc.py => colorpy/misc.py (100%) rename plots.py => colorpy/plots.py (100%) rename rayleigh.py => colorpy/rayleigh.py (100%) rename thinfilm.py => colorpy/thinfilm.py (100%) diff --git a/__init__.py b/colorpy/__init__.py similarity index 100% rename from __init__.py rename to colorpy/__init__.py diff --git a/blackbody.py b/colorpy/blackbody.py similarity index 100% rename from blackbody.py rename to colorpy/blackbody.py diff --git a/ciexyz.py b/colorpy/ciexyz.py similarity index 100% rename from ciexyz.py rename to colorpy/ciexyz.py diff --git a/colormodels.py b/colorpy/colormodels.py similarity index 100% rename from colormodels.py rename to colorpy/colormodels.py diff --git a/figures.py b/colorpy/figures.py similarity index 100% rename from figures.py rename to colorpy/figures.py diff --git a/illuminants.py b/colorpy/illuminants.py similarity index 100% rename from illuminants.py rename to colorpy/illuminants.py diff --git a/misc.py b/colorpy/misc.py similarity index 100% rename from misc.py rename to colorpy/misc.py diff --git a/plots.py b/colorpy/plots.py similarity index 100% rename from plots.py rename to colorpy/plots.py diff --git a/rayleigh.py b/colorpy/rayleigh.py similarity index 100% rename from rayleigh.py rename to colorpy/rayleigh.py diff --git a/thinfilm.py b/colorpy/thinfilm.py similarity index 100% rename from thinfilm.py rename to colorpy/thinfilm.py diff --git a/test_blackbody.py b/test_blackbody.py index a7bb481..07e7076 100755 --- a/test_blackbody.py +++ b/test_blackbody.py @@ -26,7 +26,7 @@ import math, random, numpy -from . import colormodels, blackbody +from colorpy import colormodels, blackbody STEFAN_BOLTZMAN = 5.670e-8 # W/(m^2 K^4) diff --git a/test_ciexyz.py b/test_ciexyz.py index d886943..2ca1c13 100755 --- a/test_ciexyz.py +++ b/test_ciexyz.py @@ -26,7 +26,7 @@ import random -from . import ciexyz +from colorpy import ciexyz def test (verbose=0): '''Test the CIE XYZ conversions. Mainly call some functions.''' diff --git a/test_colormodels.py b/test_colormodels.py index 9365012..84604bf 100755 --- a/test_colormodels.py +++ b/test_colormodels.py @@ -25,7 +25,7 @@ from __future__ import division, absolute_import, print_function import math, random, numpy -from . import colormodels, ciexyz +from colorpy import colormodels, ciexyz def test_xyz_rgb (verbose=1): '''Test that xyz_to_rgb() and rgb_to_xyz() are inverses.''' diff --git a/test_illuminants.py b/test_illuminants.py index 2543d9b..36f8f7b 100755 --- a/test_illuminants.py +++ b/test_illuminants.py @@ -24,7 +24,7 @@ ''' from __future__ import division, absolute_import, print_function -from . import illuminants +from colorpy import illuminants def test (verbose=0): '''Mainly call some functions.''' diff --git a/test_rayleigh.py b/test_rayleigh.py index 6ade594..03295fe 100755 --- a/test_rayleigh.py +++ b/test_rayleigh.py @@ -26,7 +26,7 @@ import random -from . import rayleigh, illuminants +from colorpy import rayleigh, illuminants def test (): '''Mainly call some functions.''' diff --git a/test_thinfilm.py b/test_thinfilm.py index 3142769..f824953 100755 --- a/test_thinfilm.py +++ b/test_thinfilm.py @@ -26,7 +26,7 @@ import random -from . import illuminants, thinfilm +from colorpy import illuminants, thinfilm def test (): '''Module test. Mainly call some functions.''' From bfaea5598469bab7d5d0918daec2c42ba162174f Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 16 Feb 2023 19:57:34 +0300 Subject: [PATCH 2/8] Move the tests into an own dir. --- tests/__init__.py | 0 test.py => tests/__main__.py | 5 +++-- test_blackbody.py => tests/test_blackbody.py | 0 test_ciexyz.py => tests/test_ciexyz.py | 0 test_colormodels.py => tests/test_colormodels.py | 0 test_illuminants.py => tests/test_illuminants.py | 0 test_rayleigh.py => tests/test_rayleigh.py | 0 test_thinfilm.py => tests/test_thinfilm.py | 0 8 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 tests/__init__.py rename test.py => tests/__main__.py (97%) rename test_blackbody.py => tests/test_blackbody.py (100%) rename test_ciexyz.py => tests/test_ciexyz.py (100%) rename test_colormodels.py => tests/test_colormodels.py (100%) rename test_illuminants.py => tests/test_illuminants.py (100%) rename test_rayleigh.py => tests/test_rayleigh.py (100%) rename test_thinfilm.py => tests/test_thinfilm.py (100%) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test.py b/tests/__main__.py similarity index 97% rename from test.py rename to tests/__main__.py index b4fc98c..8b374f3 100755 --- a/test.py +++ b/tests/__main__.py @@ -40,5 +40,6 @@ def test (): test_blackbody.test() test_rayleigh.test() test_thinfilm.test() - - + +if __name__ == "__main__": + test() diff --git a/test_blackbody.py b/tests/test_blackbody.py similarity index 100% rename from test_blackbody.py rename to tests/test_blackbody.py diff --git a/test_ciexyz.py b/tests/test_ciexyz.py similarity index 100% rename from test_ciexyz.py rename to tests/test_ciexyz.py diff --git a/test_colormodels.py b/tests/test_colormodels.py similarity index 100% rename from test_colormodels.py rename to tests/test_colormodels.py diff --git a/test_illuminants.py b/tests/test_illuminants.py similarity index 100% rename from test_illuminants.py rename to tests/test_illuminants.py diff --git a/test_rayleigh.py b/tests/test_rayleigh.py similarity index 100% rename from test_rayleigh.py rename to tests/test_rayleigh.py diff --git a/test_thinfilm.py b/tests/test_thinfilm.py similarity index 100% rename from test_thinfilm.py rename to tests/test_thinfilm.py From 42aa7238c4ca3bcf77caf5158f9b8b28d5804535 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 16 Feb 2023 20:09:05 +0300 Subject: [PATCH 3/8] Use `setuptools` instead of `distutils`. `distutils` support is dropped. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 38cdc3a..032556c 100755 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ python setup.py bdist_wininst ''' -from distutils.core import setup +from setuptools import setup data_files = [ 'README.rst', From 4b1215aa35ebbf3abcd57fda02e3344be37af7b9 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 16 Feb 2023 20:10:32 +0300 Subject: [PATCH 4/8] Migrate the metadata from `setup.py` into `setup.cfg`. Replace the license free-form description with its SPDX id. Add project URLs. --- setup.cfg | 26 ++++++++++++++++++++++++++ setup.py | 31 ++----------------------------- 2 files changed, 28 insertions(+), 29 deletions(-) create mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..22963ac --- /dev/null +++ b/setup.cfg @@ -0,0 +1,26 @@ +[metadata] +name = colorpy +version = 0.1.1 +author = Mark Kness +author_email = mkness@alumni.utexas.net +license = LGPL-3.0-or-later +description = Color calculations with physical descriptions of light spectra +url = http://markkness.net/colorpy/ +long_description = ColorPy is a Python package to convert physical descriptions of light spectra of light intensity vs. wavelength - into RGB colors that can be drawn on a computer screen. It provides a nice set of attractive plots that you can make of such spectra, and some other color related functions as well. + +project_urls = + Source Code = https://github.com/fish2000/colorpy + Issue Tracker = https://github.com/fish2000/colorpy/issues + +[options] +package_dir = + colorpy = . +packages = colorpy + +[options.package_data] +colorpy = + README.rst + COPYING.txt + COPYING.LESSER.txt + license.txt + ColorPy.html diff --git a/setup.py b/setup.py index 032556c..e15fc93 100755 --- a/setup.py +++ b/setup.py @@ -18,32 +18,5 @@ from setuptools import setup -data_files = [ - 'README.rst', - 'COPYING.txt', - 'COPYING.LESSER.txt', - 'license.txt', - 'ColorPy.html', -] - -long_description = ''' -ColorPy is a Python package to convert physical descriptions of light - - spectra of light intensity vs. wavelength - into RGB colors that can - be drawn on a computer screen. - It provides a nice set of attractive plots that you can make of such - spectra, and some other color related functions as well. -''' - -setup ( - name='colorpy', - version='0.1.1', - description='Color calculations with physical descriptions of light spectra', - long_description=long_description, - author='Mark Kness', - author_email='mkness@alumni.utexas.net', - url='http://markkness.net/colorpy/', - license='GNU Lesser GPL Version 3', - package_dir={'colorpy': '.'}, - packages=['colorpy'], - package_data={'colorpy': data_files}, -) +if __name__ == "__main__": + setup() From 456fdbcf9c5699f737e1fd7fbcddd499a723a563 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 16 Feb 2023 20:18:13 +0300 Subject: [PATCH 5/8] Add `pyproject.toml` according to `PEP 517`. --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b464d1d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=42.2"] +build-backend = "setuptools.build_meta" From 20a104ae1211aa21917986893cd512059462883b Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 16 Feb 2023 20:19:27 +0300 Subject: [PATCH 6/8] Move the metadata into `PEP 621`-compliant `pyproject.toml` --- pyproject.toml | 32 +++++++++++++++++++++++++++++++- setup.cfg | 26 -------------------------- 2 files changed, 31 insertions(+), 27 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index b464d1d..a5aa0a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,33 @@ [build-system] -requires = ["setuptools>=42.2"] +requires = ["setuptools>=61.2"] build-backend = "setuptools.build_meta" + +[project] +name = "colorpy" +version = "0.1.1" +authors = [{name = "Mark Kness", email = "mkness@alumni.utexas.net"}] +license = {text = "LGPL-3.0-or-later"} +description = "Color calculations with physical descriptions of light spectra" + +[project.readme] +text = "ColorPy is a Python package to convert physical descriptions of light spectra of light intensity vs. wavelength - into RGB colors that can be drawn on a computer screen. It provides a nice set of attractive plots that you can make of such spectra, and some other color related functions as well." +content-type = "text/plain" + +[project.urls] +Homepage = "http://markkness.net/colorpy/" +"Source Code" = "https://github.com/fish2000/colorpy" +"Issue Tracker" = "https://github.com/fish2000/colorpy/issues" + +[tool.setuptools] +package-dir = {colorpy = "."} +packages = ["colorpy"] +include-package-data = false + +[tool.setuptools.package-data] +colorpy = [ + "README.rst", + "COPYING.txt", + "COPYING.LESSER.txt", + "license.txt", + "ColorPy.html", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 22963ac..0000000 --- a/setup.cfg +++ /dev/null @@ -1,26 +0,0 @@ -[metadata] -name = colorpy -version = 0.1.1 -author = Mark Kness -author_email = mkness@alumni.utexas.net -license = LGPL-3.0-or-later -description = Color calculations with physical descriptions of light spectra -url = http://markkness.net/colorpy/ -long_description = ColorPy is a Python package to convert physical descriptions of light spectra of light intensity vs. wavelength - into RGB colors that can be drawn on a computer screen. It provides a nice set of attractive plots that you can make of such spectra, and some other color related functions as well. - -project_urls = - Source Code = https://github.com/fish2000/colorpy - Issue Tracker = https://github.com/fish2000/colorpy/issues - -[options] -package_dir = - colorpy = . -packages = colorpy - -[options.package_data] -colorpy = - README.rst - COPYING.txt - COPYING.LESSER.txt - license.txt - ColorPy.html From 147fe1223a868e521a3099b5187a3a64448f2538 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 16 Feb 2023 20:19:50 +0300 Subject: [PATCH 7/8] Remove unneeded `setup.py`. --- setup.py | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100755 setup.py diff --git a/setup.py b/setup.py deleted file mode 100755 index e15fc93..0000000 --- a/setup.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python -''' -setup.py - Setup script to install the ColorPy package. - -To install the ColorPy package: -From the directory in which the ColorPy distribution was unpacked, run: - -python setup.py install - -You should now be able to say 'import colorpy' in your programs and use the package. - -Creating the distribution: - -python setup.py sdist --formats=zip -python setup.py sdist --formats=gztar -python setup.py bdist_wininst -''' - -from setuptools import setup - -if __name__ == "__main__": - setup() From 1278fca3c617cbe10f74d56720a8f70d65f2fa12 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 16 Feb 2023 20:27:08 +0300 Subject: [PATCH 8/8] Add `*.egg-info` into git ignores. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e07fb7c..c4a80f8 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ dist build +/*.egg-info