Skip to main content

The GMU PyPi template repository.

Project description


The GMU PyPi Template


birdie_logo_64x96.png

https://www.thegmu.com/

Authors:

Mybrid Wonderful, Gregg Yearwood

Date:

03/16/2019

Support:

mybrid@thegmu.com

Version:

1.0.1


Introduction

The GMU PyPi template is for developers to install a set of files for starting a Python project at The Gregg & Mybrid Upgrade, Inc. This README.rst is displayed as help for the Makefile in this director. The utility of this template is to standardize on various Python project tools and configuration files for new Python projects.

If you are not a developer for The GMU then feel free to clone the git repo and salt-and-pepper to your taste.

git clone https://bitbucket.org/thegmu/thegmu-pypi-template

New GMU Python Project Instructions

# Minimal configuration
PROJECT_NAME=fun
PROJECT_DIR=fun
# 1. Create a Python3 virtualenv.
python3.6 -m venv ~/workspace/run/py36_$PROJECT_NAME

# 2. Create an empty Python3 project directory.
mkdir ~/workspace/gmu/$PROJECT_NAME

# 3. Activate the Python3 virtualenv.
. ~/workspace/run/py36_$PROJECT_NAME/bin/activate

# 4. Install thegmu-pypi-template.
# TEST: pip install --index-url https://test.pypi.org/simple/ thegmu-pypi-template
pip install thegmu-pypi-template

# 5. Change directory into the empty Python3 project directory.
cd  ~/workspace/gmu/$PROJECT_NAME

# 6. Run the install script to install the files into the current directory.
thegmu-pypi-template

# 7. Rename the project directory.
mv thegmu_pypi_template $PROJECT_DIR

# 7. Edit the Makefile and edit the four variables:
#    PROJECTNAME, PROJECTDIR, VENVDIR, PYTHON.

Makefile:PROJECTNAME:=fun
Makefile:PROJECTDIR:=fun
Makefile:VENVDIR:=${HOME}/workspace/run/py36_fun
Makefile:PYTHON=python3.6

# 8 Edit tox.ini and set the python version.
tox.ini:envlist = py36

# 9. Edit setup.py and change the NAME to your PROJECTNAME
#    and remove bin/thegmu-pypi-template script
setup.py:NAME = "fun"
setup.py:SCRIPTS = []

# 10. Edit tests/sample_test.py and change the import directory to your project.
tests/sample_test.py: from fun.sample import Sample

# 11. Validate the minimal configuraiton by running the following make commands.
make init
make test
make dist
make test-dist

# Complete configuration
# 12. Edit fully the configuration files.
#     The following is a list of files that will need to be updated
#     such as changing the email address, a new software version '0.1.0', etc.
#     Makefile - update variables
#     README.rst - complete rewrite
#     setup.py - update variables
#     $PROJECT_NAME/__init__.py - complete rewrite
#     $PROJECT_NAME/sample.py - delete
#     tests/sample_test.py - delete

Requirements

  1. Encourage Python standards are followed for packaging and source.

  2. Pylint for validating PEP8 standards of code.

  3. Sphinx documentation to integrate with readthedocs.org

  4. Test automation in the dedicated tests directory.

  5. PyPi package deployment.

  6. ReadTheDocs documentation deployment.

Tools:

  1. autopep8: pep8 code beautifier

  2. pylint: coding standards

  3. pytest: test source

  4. readthedocs.org: public documentation using sphinx

  5. sphinx: html documentation

  6. tox: test the source as installed package

  7. twine: deploy the package to pypi.org, test.pypi.org

  8. Makefile: run the tools

Configuration files:

  1. .gitignore: ignore pylint, pytest, tox and build files as well .settings, .project, and .pydevproject directories from Eclipse.

  2. .pylintrc: The GMU specific PEP8 suppression.


Makefile Options

make <option>

_default:

Same as help.

clean:

Removes Python compiled files, pytest files, and tox test files. See clean-pyc and clean-tox.

clean-dist:

Removes Python packaging files.

clean-docs:

Removes sphinx documentation build files. Configuration files are not removed.

clean-pyc:

Removes Python compiled files and pytest files.

clean-tox:

Removes tox test files.

dist:

Creates source and binary Python packages suitable for PyPi.

docs-init:

Creates the configuration files for sphinx.

docs:

Build the the HTML documentation files in docs/_build.

help:

Displays this file.

init:

Install Python tools used by this Makefile.

pep8:

Run autopep8 and update all the project and test files in place with white space changes.

publish:

Publish the package to production ‘pypi.org’. User name and password prompt are given.

publish-test:

Publish the package to test ‘test-pypi.org’. User name and password prompt are given.

pylint:

Run pylint and output results. No other action is taken. See pep8 option to fix white space problems.

requirements:

Python ‘pip’ packages for the tools.

test:

Run the tests from source using pytest.

test-dist:

Build the packages and then run the test as packages in temporary Python virtualenv environments.

upgrade:

Upgrade Python ‘pip’ packages for the tools.


The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. –George Bernard Shaw

The End

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thegmu-pypi-template-1.0.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

thegmu_pypi_template-1.0.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file thegmu-pypi-template-1.0.1.tar.gz.

File metadata

  • Download URL: thegmu-pypi-template-1.0.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

File hashes

Hashes for thegmu-pypi-template-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6c485c3ee4ec2ab211da33030cd3b1253ba784e09bb1bc49b686376f0d78d15c
MD5 7d8b36776d12863a42f1011baeec2dd0
BLAKE2b-256 4d10a84e074fd54f79c4a0d1be55a7f351e441e0e3e30758259894e405052677

See more details on using hashes here.

File details

Details for the file thegmu_pypi_template-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: thegmu_pypi_template-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

File hashes

Hashes for thegmu_pypi_template-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 77b241f83e6c5fab6eaaf228d528a5dd75f5a878de46dbf2c2754de22cae067b
MD5 d886863aa859270b93ff090a68d7ffab
BLAKE2b-256 183b70296176f880dac0eaf06140a0a2e8f2e02839282ff6ee110501974aebd1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page