setup.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. from setuptools import setup
  2. import distutils.command.check
  3. class TestCommand(distutils.command.check.check):
  4. """Custom test command."""
  5. def run(self):
  6. # run tests using doctest
  7. import doctest
  8. # set specific seed for pseudo-random process
  9. import random
  10. import numpy as np
  11. # discrete and continuous solutions module
  12. from macop.solutions import discrete
  13. from macop.solutions import continuous
  14. # operators module
  15. from macop.operators.discrete import mutators as discrete_mutators
  16. from macop.operators.discrete import crossovers as discrete_crossovers
  17. # policies module
  18. from macop.policies import classicals
  19. from macop.policies import reinforcement
  20. # evaluators module
  21. from macop.evaluators.discrete import mono as discrete_mono
  22. from macop.evaluators.discrete import multi as discrete_multi
  23. # algorithms
  24. from macop.algorithms import mono as algo_mono
  25. from macop.algorithms import multi as algo_multi
  26. # run all doctest
  27. print("==============================")
  28. print("Runs test command...")
  29. random.seed(42)
  30. np.random.seed(42)
  31. # discrete solutions module
  32. doctest.testmod(discrete)
  33. doctest.testmod(continuous)
  34. random.seed(42)
  35. np.random.seed(42)
  36. # operators module
  37. doctest.testmod(discrete_mutators)
  38. doctest.testmod(discrete_crossovers)
  39. random.seed(42)
  40. np.random.seed(42)
  41. # policies module
  42. doctest.testmod(classicals)
  43. doctest.testmod(reinforcement)
  44. random.seed(42)
  45. np.random.seed(42)
  46. # policies module
  47. doctest.testmod(discrete_mono)
  48. doctest.testmod(discrete_multi)
  49. random.seed(42)
  50. np.random.seed(42)
  51. # policies module
  52. doctest.testmod(algo_mono)
  53. doctest.testmod(algo_multi)
  54. # pass test using doctest
  55. distutils.command.check.check.run(self)
  56. setup(
  57. name='macop',
  58. version='1.0.14',
  59. description='Minimalist And Customisable Optimisation Package',
  60. long_description=open('README.md').read(),
  61. long_description_content_type='text/markdown',
  62. classifiers=[
  63. 'Development Status :: 5 - Production/Stable',
  64. 'License :: OSI Approved :: MIT License',
  65. 'Programming Language :: Python :: 3.8',
  66. 'Topic :: Scientific/Engineering',
  67. 'Topic :: Utilities'
  68. ],
  69. url='https://github.com/prise-3d/macop',
  70. author='Jérôme BUISINE',
  71. author_email='jerome.buisine@univ-littoral.fr',
  72. license='MIT',
  73. packages=['macop',
  74. 'macop.algorithms',
  75. 'macop.callbacks',
  76. 'macop.evaluators',
  77. 'macop.evaluators.discrete',
  78. 'macop.evaluators.continuous',
  79. 'macop.operators',
  80. 'macop.operators.discrete',
  81. 'macop.operators.continuous',
  82. 'macop.policies',
  83. 'macop.solutions',
  84. 'macop.utils'],
  85. install_requires=[
  86. 'numpy',
  87. ],
  88. cmdclass={
  89. 'test': TestCommand,
  90. },
  91. zip_safe=False)