Generate a Python package project using the Python Cookiecutter package
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

66 lines
2.2KB

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import pip
  4. try: # for pip >= 10
  5. from pip._internal.req import parse_requirements
  6. except ImportError: # for pip <= 9.0.3
  7. from pip.req import parse_requirements
  8. try:
  9. from setuptools import setup
  10. except ImportError:
  11. from distutils.core import setup
  12. with open("README.md") as readme_file:
  13. readme = readme_file.read()
  14. with open("HISTORY.md") as history_file:
  15. history = history_file.read()
  16. github_url = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}"
  17. ## workaround derived from: https://github.com/pypa/pip/issues/7645#issuecomment-578210649
  18. parsed_requirements = parse_requirements("requirements/prod.txt", session="workaround")
  19. parsed_dev_requirements = parse_requirements(
  20. "requirements/dev.txt", session="workaround"
  21. )
  22. parsed_test_requirements = parse_requirements(
  23. "requirements/test.txt", session="workaround"
  24. )
  25. requirements = [str(ir.req) for ir in parsed_requirements]
  26. dev_requirements = [str(ir.req) for ir in parsed_dev_requirements]
  27. test_requirements = [str(tr.req) for tr in parsed_test_requirements]
  28. setup(
  29. name="{{ cookiecutter.project_slug }}",
  30. version="{{ cookiecutter.version }}",
  31. description="{{ cookiecutter.project_short_description }}",
  32. long_description=readme + "\n\n" + history,
  33. long_description_content_type="text/markdown",
  34. author="{{ cookiecutter.full_name }}",
  35. author_email="{{ cookiecutter.email }}",
  36. url=github_url,
  37. license="LGPL-3",
  38. keywords="{{ cookiecutter.project_slug }}",
  39. project_urls={"Source": github_url},
  40. packages=[
  41. "{{ cookiecutter.project_slug }}",
  42. ],
  43. package_dir={"{{ cookiecutter.project_slug }}": "{{ cookiecutter.project_slug }}"},
  44. include_package_data=True,
  45. install_requires=requirements,
  46. extras_require={"dev": dev_requirements},
  47. tests_require=test_requirements,
  48. test_suite="tests",
  49. zip_safe=False,
  50. classifiers=[
  51. "Programming Language :: Python :: 3",
  52. "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
  53. "Operating System :: POSIX :: Linux",
  54. "Natural Language :: English",
  55. ],
  56. )