Skip to content

Commit

Permalink
2017-09-06
Browse files Browse the repository at this point in the history
  • Loading branch information
MacHu-GWU committed Sep 6, 2017
1 parent 6afc0f6 commit b1e3887
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 32 deletions.
13 changes: 9 additions & 4 deletions .travis.yml
@@ -1,19 +1,24 @@
language: python

python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"

install:
- pip install --editable . # Install it self
- pip install --upgrade pytest # Upgrade pytest to lastest
- pip install --upgrade pytest-cov # Upgrade pytest-cov to latest
- pip install coveralls # Install coverall
- pip install coveralls # Install coveralls

script:
- pytest tests --cov=elementary_math
- pytest tests --cov=elementary_math # Run unittest

notifications:
slack:
slack: # Mute email notification
on_success: never
on_failure: never

after_success:
coveralls
coveralls # travis-ci will transfer data to coveralls after success
10 changes: 5 additions & 5 deletions README.rst
Expand Up @@ -17,9 +17,9 @@
:target: https://github.com/MacHu-GWU/elementary_math-project


Welcome to elementary_math Documentation
========================================
``elementary_math`` is a project to demonstrate: how to setup a fancy open source python library project on github includes these **powerful components**:
Welcome to ``elementary_math`` Documentation
============================================
``elementary_math`` is a project to demonstrate: how to setup environment and toolsets for a python library project on github, includes these **powerful components**:

- virtual environment setup (one command install everything)
- setup.py file (one click **install**/**uninstall**)
Expand All @@ -34,8 +34,8 @@ Welcome to elementary_math Documentation
- publish to `PyPI <https://pypi.python.org/pypi/your-package-name>`_


**Quick Links**
---------------
Quick Links
-----------
- `GitHub Homepage <https://github.com/MacHu-GWU/elementary_math-project>`_
- `Online Documentation <http://www.wbh-doc.com.s3.amazonaws.com/elementary_math/index.html>`_
- `PyPI download <https://pypi.python.org/pypi/elementary_math>`_
Expand Down
55 changes: 40 additions & 15 deletions start-a-project/init_project.py
Expand Up @@ -3,6 +3,8 @@

"""
This script can generate automate scripts for open source python project.
Scroll to ``if __name__ == "__main__":`` for more info.
"""

from __future__ import print_function
Expand All @@ -12,19 +14,6 @@
from os.path import join, abspath, dirname, basename


#--- EDIT THESE VARIABLE based on your own situation ---
package_name = "pathlib_mate" # IMPORTANT
repo_name = "{package_name}-project".format(package_name=package_name)
python_version = "python%s%s" % (sys.version_info.major, sys.version_info.minor)
github_username = "MacHu-GWU" # IMPORTANT
author_name = "Sanhe Hu" # IMPORTANT
author_email = "husanhe@gmail.com" # IMPORTANT
maintainer_name = author_name
maintainer_email = author_email
year = str(datetime.datetime.utcnow().year)
s3_bucket = "www.wbh-doc.com" # IMPORTANT


def write(s, path, encoding="utf-8"):
"""Write string to text file.
"""
Expand All @@ -39,7 +28,18 @@ def read(path, encoding="utf-8"):
return f.read().decode(encoding)


def generate_files():
def initiate_project(
package_name,
repo_name,
python_version,
github_username,
author_name,
author_email,
maintainer_name,
maintainer_email,
year,
s3_bucket,
):
"""
Generate project start files.
"""
Expand Down Expand Up @@ -81,5 +81,30 @@ def generate_files():
write(content, dst)
print(" Complete!")


if __name__ == "__main__":
generate_files()
# --- EDIT THESE VARIABLE based on your own situation ---
package_name = "elementary_math" # IMPORTANT
repo_name = "{package_name}-project".format(package_name=package_name)
python_version = "python%s%s" % (
sys.version_info.major, sys.version_info.minor)
github_username = "MacHu-GWU" # IMPORTANT
author_name = "Sanhe Hu" # IMPORTANT
author_email = "husanhe@gmail.com" # IMPORTANT
maintainer_name = author_name
maintainer_email = author_email
year = str(datetime.datetime.utcnow().year)
s3_bucket = "www.wbh-doc.com" # IMPORTANT

initiate_project(
package_name,
repo_name,
python_version,
github_username,
author_name,
author_email,
maintainer_name,
maintainer_email,
year,
s3_bucket,
)
13 changes: 9 additions & 4 deletions start-a-project/template/.travis.yml
@@ -1,19 +1,24 @@
language: python

python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"

install:
- pip install --editable . # Install it self
- pip install --upgrade pytest # Upgrade pytest to lastest
- pip install --upgrade pytest-cov # Upgrade pytest-cov to latest
- pip install coveralls # Install coverall
- pip install coveralls # Install coveralls

script:
- pytest tests --cov={{ package_name }}
- pytest tests --cov={{ package_name }} # Run unittest

notifications:
slack:
slack: # Mute email notification
on_success: never
on_failure: never

after_success:
coveralls
coveralls # travis-ci will transfer data to coveralls after success
9 changes: 5 additions & 4 deletions start-a-project/template/README.rst
Expand Up @@ -17,13 +17,14 @@
:target: https://github.com/{{ github_username }}/{{ repo_name }}


Welcome to {{ package_name }} Documentation
===========================================
Welcome to ``{{ package_name }}`` Documentation
==============================================================================

This is just a example project for demonstration purpose.


**Quick Links**
---------------
Quick Links
-----------
- `GitHub Homepage <https://github.com/{{ github_username }}/{{ repo_name }}>`_
- `Online Documentation <http://{{ s3_bucket }}.s3.amazonaws.com/{{ package_name }}/index.html>`_
- `PyPI download <https://pypi.python.org/pypi/{{ package_name }}>`_
Expand Down

0 comments on commit b1e3887

Please sign in to comment.