Skip to content

Commit

Permalink
Fix MANIFEST.in and etc. (#89)
Browse files Browse the repository at this point in the history
* Fix MANIFEST.in
Fixed the setup.py file because it conflicts with the version of dimod and its dependent packages.

* fix typo

* Fix Version

* ADD dependencies

* fix numpy version

* fix for poetry

* Update CMakeLists.txt

* Update requirements.txt

* Update requirements.txt

* Update requirements.txt

* Update requirements.txt

* Update setup.py

* Update requirements_doctest.txt

* Update setup.py

* Update pyproject.toml

* Update setup.py

* Update requirements_rtd.txt

* Update requirements.txt

* Update setup.py

* Update requirements.txt

* Update requirements_rtd.txt

* Update setup.py

* Update requirements.txt

* Update requirements_rtd.txt

* Update requirements_doctest.txt

* Update CMakeLists.txt

* Update requirements.txt

* Update requirements.txt

* Update setup.py

並列実行

* Update setup.py

* Update setup.py

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update setup.py

* Update setup.py

* Update setup.py

* Update setup.py

* Update setup.py

* add CMAKE_INTERPROCEDURAL_OPTIMIZATION

* Update CMakeLists.txt

* remove extra_requires

* relax numpy version

* update pyenv initialization

Co-authored-by: Kotaro Tanahashi <colon0722@gmail.com>
  • Loading branch information
29rou and kotarotanahashi authored May 29, 2021
1 parent 721131f commit 18ef63c
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 66 deletions.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ jobs:
- run: &create-virtualenv-using-pyenv
name: create virtualenv
command: |
eval "$(pyenv init -)"
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
pyenv local $PYTHON
which python
python -m pip install virtualenv
Expand Down
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
cmake_minimum_required(VERSION 3.11)

project(cpp_pyqubo)

set(CMAKE_INTERPROCEDURAL_OPTIMIZATION True)

set(CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_VERBOSE_MAKEFILE TRUE)

set(CMAKE_CXX_STANDARD 14)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
set(CMAKE_CXX_FLAGS "-std=c++11 -O4")
set(CMAKE_C_FLAGS "-Ofast -pipe" )
set(CMAKE_CXX_FLAGS "-Ofast -pipe")
set(CMAKE_C_FLAGS_RELEASE "-Ofast -pipe")
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -pipe")

include(external/pybind11.cmake)
include_directories(cpp_dimod)
Expand Down
15 changes: 14 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
include README.rst
include README.rst
include *.cmake
include FetchContent/*.cmake.in
include CMakeLists.txt
include pyproject.toml
include requirements.txt
include setup.py

recursive-include pyqubo *
recursive-include tests *
recursive-include src *
recursive-include external *
recursive-include include *
recursive-include cpp_dimod *
1 change: 1 addition & 0 deletions cpp_dimod/.CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ add_library(cpp_dimod STATIC)
target_include_directories(cpp_dimod
PUBLIC ${PROJECT_SOURCE_DIR}
)

3 changes: 2 additions & 1 deletion external/cimod.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ if(NOT cimod_POPULATED)
message(STATUS "Fetch cimod")
FetchContent_Populate(cimod)
include_directories(${cimod_SOURCE_DIR}/src)
endif()
endif()

2 changes: 1 addition & 1 deletion external/googletest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ if(NOT googletest_POPULATED)
message(STATUS "Fetch googletest for C++ testing")
FetchContent_Populate(googletest)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_SOURCE_DIR}/googlemock)
endif()
endif()
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[build-system]
requires = [
"cmake>=3.18.4",
'setuptools>=56.0.0',
'scikit-build>=0.11.1',
'wheel>=0.36.2',
'numpy>=1.17.3, <=1.20.0',
'Cython>=0.29.21'
]
build-backend = "setuptools.build_meta"
21 changes: 14 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
dimod==0.9.13
numpy==1.18.2
coverage==4.5.1
codecov==2.1.9
numpy==1.19.4; python_version >= '3.6'
numpy==1.18.5; python_version == '3.5'
Cython==0.29.21
dimod==0.9.14
dwave-neal==0.5.7
Deprecated==1.2.10
nbsphinx==0.3.5
Deprecated>=1.2.10
six>=1.15.0
cmake>=3.18.4
setuptools>=56.0.0; python_version >= '3.8'
scikit-build>=0.11.1
cmake>=3.18.2
wheel>=0.36.2
coverage>=4.5.1
codecov>=2.1.9
nbsphinx>=0.8.3; python_version >= '3.8'
nbsphinx==0.3.5; python_version < '3.8'
docutils<0.17,>=0.12; python_version < '3.8'
5 changes: 3 additions & 2 deletions requirements_doctest.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sphinx
sphinx_rtd_theme
Sphinx>=3.5.4
sphinx-rtd-theme>=0.5.2
docutils<0.17,>=0.12; python_version < '3.8'
21 changes: 12 additions & 9 deletions requirements_rtd.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
dimod==0.9.2
numpy==1.18.2
coverage==4.5.1
codecov==2.1.9
dwave-neal==0.5.4
Deprecated==1.2.10
nbsphinx==0.3.5
scikit-build>=0.11.1
cmake>=3.18.2
coverage>=4.5.1
codecov>=2.1.9
dwave-neal>=0.5.4
nbsphinx>=0.3.5
Deprecated>=1.2.10
six>=1.15.0
numpy==1.19.4; python_version >= '3.6'
numpy==1.18.5; python_version == '3.5'
dimod==0.9.14
nbsphinx>=0.8.3; python_version >= '3.8'
nbsphinx==0.3.5; python_version < '3.8'
docutils<0.17,>=0.12; python_version < '3.8'
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.rst
115 changes: 72 additions & 43 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
import os
import re
import sys
import platform
import re
import subprocess
import sys
import sysconfig

from setuptools import Extension
from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion
from setuptools import Command
from importlib.util import find_spec
from multiprocessing import cpu_count

from setuptools import Command, Extension
from setuptools.command.build_ext import build_ext

if os.getenv('READTHEDOCS') or platform.system() == "Linux":
if platform.system() == "Windows":
from setuptools import setup
elif find_spec('skbuild'):
from skbuild import setup
elif os.getenv('NOT_USE_SKBUILD'):
from setuptools import setup
elif os.getenv('READTHEDOCS'):
from skbuild import setup
else:
from setuptools import setup

CPU_COUNT = "-j" + str(cpu_count() + 1)


class PackageInfo(object):
def __init__(self, info_file):
Expand All @@ -26,8 +34,10 @@ def __init__(self, info_file):
def __getattribute__(self, name):
return super(PackageInfo, self).__getattribute__(name)


package_info = PackageInfo(os.path.join('pyqubo', 'package_info.py'))


class CMakeExtension(Extension):
def __init__(self, name, sourcedir=''):
Extension.__init__(self, name, sources=[])
Expand Down Expand Up @@ -60,12 +70,12 @@ def build_extension(self, ext):

if platform.system() == "Windows":
cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)]
if sys.maxsize > 2**32:
if sys.maxsize > 2 ** 32:
cmake_args += ['-A', 'x64']
build_args += ['--', '/m']
else:
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
build_args += ['--', '-j2']
build_args += ['--', str(CPU_COUNT)]

env = os.environ.copy()
env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''),
Expand Down Expand Up @@ -98,44 +108,63 @@ def run(self):
subprocess.call(['./tests/pyqubo_test'],
cwd=os.path.join('build', self.cpplibdir), shell=True)


packages = ['pyqubo', 'pyqubo.integer', 'pyqubo.utils']

install_requires = [
'numpy<1.20,>=1.17.3',
'dimod>=0.9.13',
'dwave-neal>=0.5.7',
'Deprecated>=1.2.10',
'six>=1.11.0'
]

'numpy>=1.17.3',
'dimod>=0.9.14, <=0.10.0',
'dwave-neal>=0.5.7',
'Deprecated>=1.2.12',
'six>=1.15.0'
]

setup_requires = [
'numpy>=1.17.3, <=1.20.0',
'scikit-build>=0.11.1',
'wheel>=0.36.2',
'Cython>=0.29.21'
"cmake>=3.18.4",
'setuptools',
'nbsphinx'
]


tests_require = [
'coverage>=4.5.1',
'codecov>=2.1.9'
]

python_requires = '>=3.5, <3.10'

setup(
name=package_info.__package_name__,
version=package_info.__version__,
description=package_info.__description__,
long_description=open('README.rst').read(),
author=package_info.__contact_names__,
author_email=package_info.__contact_emails__,
maintainer=package_info.__contact_names__,
maintainer_email=package_info.__contact_emails__,
url=package_info.__repository_url__,
download_url=package_info.__download_url__,
license=package_info.__license__,
ext_modules=[CMakeExtension('pyqubo')],
cmdclass=dict(build_ext=CMakeBuild, cpp_test=CppTest),
zip_safe=False,
packages=packages,
keywords=package_info.__keywords__,
install_requires=install_requires,
python_requires=python_requires,
classifiers=[
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'License :: OSI Approved :: Apache Software License',
]
)
name=package_info.__package_name__,
version=package_info.__version__,
description=package_info.__description__,
long_description=open('README.rst').read(),
author=package_info.__contact_names__,
author_email=package_info.__contact_emails__,
maintainer=package_info.__contact_names__,
maintainer_email=package_info.__contact_emails__,
url=package_info.__repository_url__,
download_url=package_info.__download_url__,
license=package_info.__license__,
ext_modules=[CMakeExtension('pyqubo')],
cmdclass=dict(build_ext=CMakeBuild, cpp_test=CppTest),
zip_safe=False,
packages=packages,
keywords=package_info.__keywords__,
install_requires=install_requires,
setup_requires=setup_requires,
python_requires=python_requires,
tests_require=tests_require,
include_package_data=True,
classifiers=[
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'License :: OSI Approved :: Apache Software License',
]
)

0 comments on commit 18ef63c

Please sign in to comment.