From 3fd900d60e7449d75ca36a313a37461ee092d137 Mon Sep 17 00:00:00 2001 From: Russell Anderson <5637107+rpanderson@users.noreply.github.com> Date: Mon, 18 May 2020 02:15:51 +1000 Subject: [PATCH 1/4] Use setup.cfg and make setup.py only contain programmatic overrides --- setup.cfg | 45 ++++++++++++++++++++++++ setup.py | 101 +++++++++++++----------------------------------------- 2 files changed, 68 insertions(+), 78 deletions(-) create mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..16733e3a --- /dev/null +++ b/setup.cfg @@ -0,0 +1,45 @@ +[metadata] +name = labscript_devices +description = Device drivers for hardware controlled by the labscript suite +long_description = file: README.md +long_description_content_type = text/markdown +author = The labscript suite community +author_email = labscriptsuite@googlegroups.com +url = http://labscriptsuite.org +project_urls = + Source Code=https://github.com/labscript-suite/labscript-devices + Download=https://github.com/labscript-suite/labscript-devices/releases + Tracker=https://github.com/labscript-suite/labscript-devices/issues +keywords = experiment control automation +license = BSD +classifiers = + License :: OSI Approved :: BSD License + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + +[options] +zip_safe = False +include_package_data = True +packages = find: +python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5 +install_requires = + blacs>=2.7.0 + labscript>=2.6.0 + labscript_utils>=2.13.2 + numpy>=1.15.1 + pillow + PyDAQmx + PyNIVision + pyserial + qtutils>=2.2.3 + spinapi + zprocess>=2.18.0 +setup_requires = + setuptools_scm + +[dist_conda] +pythons = 3.6, 3.7, 3.8 +platforms = linux-64,win-32,win-64,osx-64 +force_conversion = True diff --git a/setup.py b/setup.py index 3412a290..66c1a6e8 100644 --- a/setup.py +++ b/setup.py @@ -1,89 +1,34 @@ -# USAGE NOTES -# -# Make a PyPI release tarball with: -# -# python setup.py sdist -# -# Upload to test PyPI with: -# -# twine upload --repository-url https://test.pypi.org/legacy/ dist/* -# -# Install from test PyPI with: -# -# pip install --index-url https://test.pypi.org/simple/ labscript_devices -# -# Upload to real PyPI with: -# -# twine upload dist/* -# -# Build conda packages for all platforms (in a conda environment with setuptools_conda -# installed) with: -# -# python setup.py dist_conda -# -# Upoad to your own account (for testing) on anaconda cloud (in a conda environment with -# anaconda-client installed) with: -# -# anaconda upload --skip-existing conda_packages/*/* -# -# (Trickier on Windows, as it won't expand the wildcards) -# -# Upoad to the labscript-suite organisation's channel on anaconda cloud (in a -# conda environment with anaconda-client installed) with: -# -# anaconda upload -u labscript-suite --skip-existing conda_packages/*/* -# -# If you need to rebuild the same version of the package for conda due to a packaging -# issue, you must increment CONDA_BUILD_NUMBER in order to create a unique version on -# anaconda cloud. When subsequently releasing a new version of the package, -# CONDA_BUILD_NUMBER should be reset to zero. - import os from setuptools import setup +from setuptools.dist import Distribution try: from setuptools_conda import dist_conda + CMDCLASS = {"dist_conda": dist_conda} except ImportError: - dist_conda = None + CMDCLASS = {} + +if "CONDA_BUILD" not in os.environ: + dist = Distribution() + dist.parse_config_files() + INSTALL_REQUIRES = dist.install_requires +else: + INSTALL_REQUIRES = [] -SETUP_REQUIRES = ['setuptools', 'setuptools_scm'] +VERSION_SCHEME = {} +VERSION_SCHEME["version_scheme"] = os.environ.get( + "SCM_VERSION_SCHEME", "guess-next-dev" +) +VERSION_SCHEME["local_scheme"] = os.environ.get("SCM_LOCAL_SCHEME", "node-and-date") -INSTALL_REQUIRES = [ - "labscript_utils >= 2.13.2", - "blacs >= 2.7.0", - "labscript >= 2.6.0", - "qtutils >=2.2.3", - "zprocess >=2.18.0", - "numpy >=1.15.1", - "pyserial", - "pillow", - "PyDAQmx", - "PyNIVision", - "spinapi", -] +VERSION_SCHEME = {} +VERSION_SCHEME["version_scheme"] = os.environ.get( + "SCM_VERSION_SCHEME", "release-branch-semver" +) +VERSION_SCHEME["local_scheme"] = os.environ.get("SCM_LOCAL_SCHEME", "node-and-date") setup( - name='labscript_devices', - use_scm_version=True, - description="Device drivers for the labscript suite", - long_description=open('README.md').read(), - long_description_content_type='text/markdown', - author='The labscript suite community', - author_email='labscriptsuite@googlegroups.com ', - url='http://labscriptsuite.org', - license="BSD", - packages=["labscript_devices"], - zip_safe=False, - setup_requires=SETUP_REQUIRES, - include_package_data=True, - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5", - install_requires=INSTALL_REQUIRES if 'CONDA_BUILD' not in os.environ else [], - cmdclass={'dist_conda': dist_conda} if dist_conda is not None else {}, - command_options={ - 'dist_conda': { - 'pythons': (__file__, ['3.6', '3.7', '3.8']), - 'platforms': (__file__, ['linux-64', 'win-32', 'win-64', 'osx-64']), - 'force_conversion': (__file__, True), - }, - }, + use_scm_version=VERSION_SCHEME, + cmdclass=CMDCLASS, + install_requires=INSTALL_REQUIRES ) From 5d5106101ebe070a3d7a6ee09dbe92b901d406b7 Mon Sep 17 00:00:00 2001 From: Russell Anderson <5637107+rpanderson@users.noreply.github.com> Date: Mon, 18 May 2020 03:05:15 +1000 Subject: [PATCH 2/4] No longer support Python 2.7 --- setup.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 16733e3a..9c82478b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,7 +14,7 @@ keywords = experiment control automation license = BSD classifiers = License :: OSI Approved :: BSD License - Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 @@ -23,7 +23,7 @@ classifiers = zip_safe = False include_package_data = True packages = find: -python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5 +python_requires = >=3.6 install_requires = blacs>=2.7.0 labscript>=2.6.0 From cf91518490f9b29be96861df274abc5a4f1c6aac Mon Sep 17 00:00:00 2001 From: Russell Anderson <5637107+rpanderson@users.noreply.github.com> Date: Mon, 18 May 2020 10:38:33 +1000 Subject: [PATCH 3/4] Simpler setuptools_scm and setuptools_conda usage --- setup.cfg | 2 -- setup.py | 23 ++++------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/setup.cfg b/setup.cfg index 9c82478b..753b69ae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,5 +41,3 @@ setup_requires = [dist_conda] pythons = 3.6, 3.7, 3.8 -platforms = linux-64,win-32,win-64,osx-64 -force_conversion = True diff --git a/setup.py b/setup.py index 66c1a6e8..e486e67d 100644 --- a/setup.py +++ b/setup.py @@ -8,27 +8,12 @@ except ImportError: CMDCLASS = {} -if "CONDA_BUILD" not in os.environ: - dist = Distribution() - dist.parse_config_files() - INSTALL_REQUIRES = dist.install_requires -else: - INSTALL_REQUIRES = [] - -VERSION_SCHEME = {} -VERSION_SCHEME["version_scheme"] = os.environ.get( - "SCM_VERSION_SCHEME", "guess-next-dev" -) -VERSION_SCHEME["local_scheme"] = os.environ.get("SCM_LOCAL_SCHEME", "node-and-date") - -VERSION_SCHEME = {} -VERSION_SCHEME["version_scheme"] = os.environ.get( - "SCM_VERSION_SCHEME", "release-branch-semver" -) -VERSION_SCHEME["local_scheme"] = os.environ.get("SCM_LOCAL_SCHEME", "node-and-date") +VERSION_SCHEME = { + "version_scheme": os.getenv("SCM_VERSION_SCHEME", "guess-next-dev"), + "local_scheme": os.getenv("SCM_LOCAL_SCHEME", "node-and-date"), +} setup( use_scm_version=VERSION_SCHEME, cmdclass=CMDCLASS, - install_requires=INSTALL_REQUIRES ) From 5bc063965e3b0621c4a1c8d5b9bf1b67036d5399 Mon Sep 17 00:00:00 2001 From: Russell Anderson <5637107+rpanderson@users.noreply.github.com> Date: Mon, 18 May 2020 10:53:27 +1000 Subject: [PATCH 4/4] Rmoved unused import of setuptools.dist.Distribution --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index e486e67d..e5d1f0dd 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ import os from setuptools import setup -from setuptools.dist import Distribution try: from setuptools_conda import dist_conda