-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sid
committed
Feb 9, 2021
1 parent
b595315
commit d5d6bfc
Showing
23 changed files
with
404 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
|
||
src/qip/version.py | ||
|
||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2020, QuTiP | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include README.md | ||
include LICENSE.txt | ||
include requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# qutip-qip | ||
The QuTiP quantum information processing package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
numpy>=1.12 | ||
scipy>=1.0 | ||
qutip>=4.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
#!/usr/bin/env python | ||
"""QuTiP: The Quantum Toolbox in Python | ||
QuTiP is open-source software for simulating the dynamics of closed and open | ||
quantum systems. The QuTiP library depends on the excellent Numpy, Scipy, and | ||
Cython numerical packages. In addition, graphical output is provided by | ||
Matplotlib. QuTiP aims to provide user-friendly and efficient numerical | ||
simulations of a wide variety of quantum mechanical problems, including those | ||
with Hamiltonians and/or collapse operators with arbitrary time-dependence, | ||
commonly found in a wide range of physics applications. QuTiP is freely | ||
available for use and/or modification on all common platforms. Being free of | ||
any licensing fees, QuTiP is ideal for exploring quantum mechanics in research | ||
as well as in the classroom. | ||
""" | ||
|
||
DOCLINES = __doc__.split('\n') | ||
|
||
CLASSIFIERS = """\ | ||
Development Status :: 4 - Beta | ||
Intended Audience :: Science/Research | ||
License :: OSI Approved :: BSD License | ||
Programming Language :: Python | ||
Programming Language :: Python :: 3 | ||
Topic :: Scientific/Engineering | ||
Operating System :: MacOS | ||
Operating System :: POSIX | ||
Operating System :: Unix | ||
Operating System :: Microsoft :: Windows | ||
""" | ||
|
||
# import statements | ||
import os | ||
import sys | ||
# The following is required to get unit tests up and running. | ||
# If the user doesn't have, then that's OK, we'll just skip unit tests. | ||
try: | ||
from setuptools import setup, Extension | ||
EXTRA_KWARGS = { | ||
'setup_require': ['pytest-runner'], | ||
'tests_require': ['pytest'] | ||
} | ||
except: | ||
from distutils.core import setup | ||
from distutils.extension import Extension | ||
EXTRA_KWARGS = {} | ||
|
||
try: | ||
import numpy as np | ||
except ImportError as e: | ||
raise ImportError("numpy is required at installation") from e | ||
|
||
#from Cython.Build import cythonize | ||
#from Cython.Distutils import build_ext | ||
|
||
# all information about QuTiP goes here | ||
MAJOR = 0 | ||
MINOR = 0 | ||
MICRO = 1 | ||
ISRELEASED = False | ||
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) | ||
REQUIRES = ['numpy (>=1.12)', 'scipy (>=1.0)', 'qutip (>=4.5)'] | ||
EXTRAS_REQUIRE = {'graphics': ['matplotlib(>=1.2.1)']} | ||
INSTALL_REQUIRES = ['numpy>=1.12', 'scipy>=1.0', 'qutip>=4.5'] | ||
PACKAGES = ['src/qip', 'src/qip/device', 'src/qip/operations', 'src/qip/compiler', | ||
'src/qip/algorithms'] | ||
PACKAGE_DATA = {} | ||
|
||
# If we're missing numpy, exclude import directories until we can | ||
# figure them out properly. | ||
INCLUDE_DIRS = [np.get_include()] if np is not None else [] | ||
NAME = "qutip_qip" | ||
AUTHOR = ("Alexander Pitchford, Paul D. Nation, Robert J. Johansson, " | ||
"Chris Granade, Arne Grimsmo, Nathan Shammah, Shahnawaz Ahmed, " | ||
"Neill Lambert, Eric Giguere, Boxi Li") | ||
AUTHOR_EMAIL = ("[email protected], [email protected], " | ||
"[email protected], [email protected], " | ||
"[email protected], [email protected], " | ||
"[email protected], [email protected], " | ||
"[email protected], [email protected]") | ||
LICENSE = "BSD" | ||
DESCRIPTION = DOCLINES[0] | ||
LONG_DESCRIPTION = "\n".join(DOCLINES[2:]) | ||
KEYWORDS = "quantum physics dynamics" | ||
URL = "http://qutip.org" | ||
CLASSIFIERS = [_f for _f in CLASSIFIERS.split('\n') if _f] | ||
PLATFORMS = ["Linux", "Mac OSX", "Unix", "Windows"] | ||
|
||
|
||
def git_short_hash(): | ||
try: | ||
git_str = "+" + os.popen('git log -1 --format="%h"').read().strip() | ||
except: | ||
git_str = "" | ||
else: | ||
if git_str == '+': #fixes setuptools PEP issues with versioning | ||
git_str = '' | ||
return git_str | ||
|
||
FULLVERSION = VERSION | ||
if not ISRELEASED: | ||
FULLVERSION += '.dev'+str(MICRO)+git_short_hash() | ||
|
||
# NumPy's distutils reads in versions differently than | ||
# our fallback. To make sure that versions are added to | ||
# egg-info correctly, we need to add FULLVERSION to | ||
# EXTRA_KWARGS if NumPy wasn't imported correctly. | ||
if np is None: | ||
EXTRA_KWARGS['version'] = FULLVERSION | ||
|
||
|
||
def write_version_py(filename='src/qip/version.py'): | ||
cnt = """\ | ||
# THIS FILE IS GENERATED FROM QUTIP SETUP.PY | ||
short_version = '%(version)s' | ||
version = '%(fullversion)s' | ||
release = %(isrelease)s | ||
""" | ||
a = open(filename, 'w') | ||
try: | ||
a.write(cnt % {'version': VERSION, 'fullversion': | ||
FULLVERSION, 'isrelease': str(ISRELEASED)}) | ||
finally: | ||
a.close() | ||
|
||
local_path = os.path.dirname(os.path.abspath(sys.argv[0])) | ||
print(local_path) | ||
os.chdir(local_path) | ||
sys.path.insert(0, local_path) | ||
print(local_path) | ||
sys.path.insert(0, os.path.join(local_path, 'src/qip')) # to retrive _version | ||
print(local_path) | ||
|
||
|
||
# always rewrite _version | ||
if os.path.exists('src/qip/version.py'): | ||
os.remove('src/qip/version.py') | ||
|
||
write_version_py() | ||
|
||
# Add Cython extensions here | ||
cy_exts = [] | ||
|
||
# Extra link args | ||
_link_flags = [] | ||
|
||
# If on Win and Python version >= 3.5 and not in MSYS2 | ||
# (i.e. Visual studio compile) | ||
if (sys.platform == 'win32' | ||
and int(str(sys.version_info[0])+str(sys.version_info[1])) >= 35 | ||
and os.environ.get('MSYSTEM') is None): | ||
_compiler_flags = ['/w', '/Ox'] | ||
# Everything else | ||
else: | ||
_compiler_flags = ['-w', '-O3', '-funroll-loops'] | ||
if sys.platform == 'darwin': | ||
# These are needed for compiling on OSX 10.14+ | ||
_compiler_flags.append('-mmacosx-version-min=10.9') | ||
_link_flags.append('-mmacosx-version-min=10.9') | ||
|
||
# Setup commands go here | ||
setup(name = NAME, | ||
version = FULLVERSION, | ||
packages = PACKAGES, | ||
include_package_data=True, | ||
include_dirs = INCLUDE_DIRS, | ||
# headers = HEADERS, | ||
author = AUTHOR, | ||
author_email = AUTHOR_EMAIL, | ||
license = LICENSE, | ||
description = DESCRIPTION, | ||
long_description = LONG_DESCRIPTION, | ||
keywords = KEYWORDS, | ||
url = URL, | ||
classifiers = CLASSIFIERS, | ||
platforms = PLATFORMS, | ||
requires = REQUIRES, | ||
extras_require = EXTRAS_REQUIRE, | ||
package_data = PACKAGE_DATA, | ||
zip_safe = False, | ||
install_requires=INSTALL_REQUIRES, | ||
**EXTRA_KWARGS | ||
) | ||
_cite = """\ | ||
============================================================================== | ||
Installation complete | ||
Please cite QuTiP in your publication. | ||
============================================================================== | ||
For your convenience a bibtex reference can be easily generated using | ||
`qutip.cite()`""" | ||
print(_cite) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.