Skip to content

Commit

Permalink
Simplify Project Structure with bare minimum requirements
Browse files Browse the repository at this point in the history
Links to Protean 0.5.0
  • Loading branch information
subhashb committed Jul 2, 2020
1 parent 37f81b3 commit 7849d84
Show file tree
Hide file tree
Showing 20 changed files with 282 additions and 187 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2019, Subhash Bhushan C
Copyright (c) 2018-20, Subhash Bhushan C
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand All @@ -20,4 +20,4 @@ SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, I
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.
POSSIBILITY OF SUCH DAMAGE.
29 changes: 4 additions & 25 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Notes:

This template chooses some project implementations to be available default:

* Pytest_ for testing the business logic
* Pytest_ as the Test Framework
* bumpversion_ for maintaining a semantic version

Requirements
------------

Projects using this template have these minimal dependencies:
Projects using this template have these dependencies:

* Cookiecutter_ - just for creating the project
* Setuptools_ - for building the package, wheels etc. Setuptools is now packaged by default with most Python Virtual environment managers.
Expand Down Expand Up @@ -112,30 +112,13 @@ You will be asked for these fields:
"0.1.0"
- Release version (see ``.bumpversion.cfg``).

* - ``command_line_interface``
- .. code:: python

"plain"
- Option to enable a CLI (a bin/executable file). Available options:

* ``plain`` - a very simple command.
* ``argparse`` - a command implemented with ``argparse``.
* ``click`` - a command implemented with `click <http://click.pocoo.org/>`_ - which you can use to build more complex commands.
* ``no`` - no CLI at all.

* - ``command_line_interface_bin_name``
- .. code:: python

"domain"
- Name of the CLI bin/executable file (set the console script name in ``setup.py``).

After this you can create the initial repository (make sure you `create <https://github.com/new>`_ an *empty* Github
project)::

git init .
git add .
git commit -m "Initial skel."
git remote add origin [email protected]:subhashb/python-domain.git
git commit -m "Initial commit"
git remote add origin [email protected]:<username>/<repo_name>.git
git push -u origin master

Developing the project
Expand All @@ -145,10 +128,6 @@ To run all the tests, just run::

pytest

Releasing the project
`````````````````````
Before releasing your package on PyPI you should have all the tox environments passing.

Version management
''''''''''''''''''

Expand Down
25 changes: 9 additions & 16 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
{
"full_name": "Subhash Bhushan C",
"email": "subhash.bhushan@gmail.com",
"website": "https://proteanhq.com",
"github_username": "subhashb",
"project_name": "Domain",
"repo_name": "protean-{{ cookiecutter.project_name|lower|replace(' ','-') }}",
"full_name": "John Doe",
"email": "john.doe.12345@gmail.com",
"website": "https://johndoe12345.com",
"github_username": "johndoe",
"project_name": "New Project",
"repo_name": "{{ cookiecutter.project_name|lower|replace(' ','-') }}",
"package_name": "{{ cookiecutter.project_name|lower|replace(' ','_')|replace('-','_') }}",
"distribution_name": "{{ cookiecutter.package_name|replace('_','-') }}",
"project_short_description": "A basic Protean Application package. Generated with cookiecutter-protean.",
"version": "0.0.1",
"command_line_interface": [
"plain",
"argparse",
"click",
"no"
],
"command_line_interface_bin_name": "{{ cookiecutter.distribution_name }}"
}
"project_short_description": "{{ cookiecutter.project_name }} - A basic Protean Application, generated with cookiecutter-protean.",
"version": "0.0.1"
}
4 changes: 3 additions & 1 deletion {{cookiecutter.repo_name}}/.cookiecutterrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cSpell: disable

# This file exists so you can easily regenerate your project.
#
# `cookiepatcher` is a convenient shim around `cookiecutter`
Expand All @@ -17,4 +19,4 @@
default_context:
{% for key, value in cookiecutter.items()|sort %}
{{ "{0:26}".format(key + ":") }} {{ "{0!r}".format(value).strip("u") }}
{%- endfor %}
{%- endfor %}
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Overview
========

{{ cookiecutter.project_name }} - {{ cookiecutter.version }}
##{{ cookiecutter.project_name }} - {{ cookiecutter.version }}

{{ cookiecutter.project_short_description|wordwrap(119) }}

Expand Down
1 change: 0 additions & 1 deletion {{cookiecutter.repo_name}}/protean.ini

This file was deleted.

1 change: 0 additions & 1 deletion {{cookiecutter.repo_name}}/requirements.txt

This file was deleted.

4 changes: 0 additions & 4 deletions {{cookiecutter.repo_name}}/requirements/dev.txt

This file was deleted.

1 change: 0 additions & 1 deletion {{cookiecutter.repo_name}}/requirements/prod.txt

This file was deleted.

6 changes: 0 additions & 6 deletions {{cookiecutter.repo_name}}/requirements/test.txt

This file was deleted.

3 changes: 1 addition & 2 deletions {{cookiecutter.repo_name}}/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[flake8]
max-line-length = 199
exclude = tests/*.py
max-line-length = 119
103 changes: 50 additions & 53 deletions {{cookiecutter.repo_name}}/setup.py
Original file line number Diff line number Diff line change
@@ -1,81 +1,78 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function

import io
import re
from __future__ import absolute_import, print_function

import io, re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from os.path import basename, dirname, join, splitext

from setuptools import find_packages
from setuptools import setup
# ThirdParty Library Imports
from setuptools import find_packages, setup


def read(*names, **kwargs):
with io.open(
join(dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8')
join(dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8")
) as fh:
return fh.read()


testing_requires = [
"flake8-commas==2.0.0",
"future==0.18.2",
"mock==4.0.2",
"pytest-bdd==3.2.1",
"pytest-cov==2.8.1",
"pytest-flake8==1.0.4",
"pytest-flask==0.15.1",
"pytest-freezegun==0.4.1",
"pytest-mock==2.0.0",
"pytest==5.2.1",
]

dev_requires = testing_requires + [
"bump2version==1.0.0",
]

setup(
name='{{ cookiecutter.distribution_name }}',
version='{{ cookiecutter.version }}',
description={{ '{0!r}'.format(cookiecutter.project_short_description).lstrip('ub') }},
long_description='%s\n%s' % (
re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.rst')),
re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))
name="{{ cookiecutter.distribution_name }}",
version="{{ cookiecutter.version }}",
description={{"{0!r}".format(cookiecutter.project_short_description).lstrip("ub")}},
long_description="%s\n%s"
% (
re.compile("^.. start-badges.*^.. end-badges", re.M | re.S).sub(
"", read("README.rst")
),
re.sub(":[a-z]+:`~?(.*?)`", r"``\1``", read("CHANGELOG.rst")),
),
author={{ '{0!r}'.format(cookiecutter.full_name).lstrip('ub') }},
author_email={{ '{0!r}'.format(cookiecutter.email).lstrip('ub') }},
url='https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}',
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
author={{"{0!r}".format(cookiecutter.full_name).lstrip("ub")}},
author_email={{"{0!r}".format(cookiecutter.email).lstrip("ub")}},
url="https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}",
packages=find_packages("src"),
package_dir={"": "src"},
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
include_package_data=True,
zip_safe=False,
classifiers=[
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Operating System :: Unix',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Utilities',
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3 :: Only",
],
project_urls={
'Issue Tracker': 'https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}/issues',
},
keywords=[
# eg: 'keyword1', 'keyword2', 'keyword3',
],
python_requires='>=3.6',
python_requires=">=3.7",
install_requires=[
'protean==0.0.10',
{%- if cookiecutter.command_line_interface == 'click' %}
'click',
{%- endif %}
"protean==0.5.0",
# eg: 'aspectlib==1.1.1', 'six>=1.7',
],
extras_require={
'dev': ['check-manifest'],
'test': ['coverage'],
},
{%- if cookiecutter.command_line_interface != 'no' %}
entry_points={
'console_scripts': [
'{{ cookiecutter.command_line_interface_bin_name }} = {{ cookiecutter.package_name }}.cli:main',
]
"test": testing_requires,
"tests": testing_requires,
"testing": testing_requires,
"dev": dev_requires,
"all": dev_requires,
},
{%- endif %}
)

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7849d84

Please sign in to comment.