Skip to content

Commit

Permalink
Merge pull request #140 from carver/upgrade-template
Browse files Browse the repository at this point in the history
Merge in project template
  • Loading branch information
carver committed Feb 26, 2020
2 parents 15a96b1 + 139e545 commit a2639e9
Show file tree
Hide file tree
Showing 30 changed files with 479 additions and 128 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ common: &common
key: v4-cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}

jobs:
doctest:
docs:
<<: *common
docker:
- image: circleci/python:3.6
environment:
TOXENV: doctest
TOXENV: docs
lint:
<<: *common
docker:
Expand All @@ -64,7 +64,7 @@ workflows:
version: 2
test:
jobs:
- doctest
- docs
- lint
- py36-core
- py37-core
38 changes: 30 additions & 8 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
* Version: x.x.x
* Python: 2.7/3.4/3.5
* OS: osx/linux/win
_If this is a bug report, please fill in the following sections.
If this is a feature request, delete and describe what you would like with examples._

## What was wrong?

### What was wrong?
### Code that produced the error

Please include any of the following that are applicable:
```py
CODE_TO_REPRODUCE
```

* The code which produced the error
* The full output of the error
### Full error output

```sh
ERROR_HERE
```

### How can it be fixed?
### Expected Result

_This section may be deleted if the expectation is "don't crash"._

```sh
EXPECTED_RESULT
```

### Environment

```sh
# run this:
$ python -m eth_utils

# then copy the output here:
OUTPUT_HERE
```

## How can it be fixed?

Fill this section in if you know how this could or should be fixed.
16 changes: 13 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
### What was wrong?
## What was wrong?

Issue #

## How was it fixed?

### How was it fixed?
Summary of approach.

### To-Do

[//]: # (Stay ahead of things, add list items here!)
- [ ] Clean up commit history

[//]: # (For important changes that should go into the release notes please add a newsfragment file as explained here: https://github.com/ethereum/eth-abi/blob/master/newsfragments/README.md)

[//]: # (See: https://eth-abi.readthedocs.io/en/latest/contributing.html#pull-requests)
- [ ] Add entry to the [release notes](https://github.com/ethereum/eth-abi/blob/master/newsfragments/README.md)

#### Cute Animal Picture

![Cute animal picture]()
![put a cute animal picture link inside the parentheses]()
76 changes: 67 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*.egg-info
dist
build
.eggs
eggs
.eggs
parts
bin
var
Expand All @@ -18,19 +18,15 @@ develop-eggs
.installed.cfg
lib
lib64
venv
venv*

# Installer logs
pip-log.txt

# Unit test / coverage reports
.mypy_cache
.coverage
htmlcov/
.tox
nosetests.xml
.cache
.pytest_cache

# Translations
*.mo
Expand All @@ -46,9 +42,71 @@ output/*/index.html

# Sphinx
docs/_build
docs/modules.rst
docs/*.internal.rst
docs/*.utils.rst
docs/*._utils.*

# Blockchain
chains

# Hypothesis
# Hypothese Property base testing
.hypothesis

# Editors
*.swp
# tox/pytest cache
.cache

# Test output logs
logs
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

# VIM temp files
*.sw[op]

# mypy
.mypy_cache

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

49 changes: 49 additions & 0 deletions .project-template/fill_template_vars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

PROJECT_ROOT=$(dirname $(dirname $(python -c 'import os, sys; sys.stdout.write(os.path.realpath(sys.argv[1]))' "$0")))

echo "What is your python module name?"
read MODULE_NAME

echo "What is your pypi package name? (default: $MODULE_NAME)"
read PYPI_INPUT
PYPI_NAME=${PYPI_INPUT:-$MODULE_NAME}

echo "What is your github project name? (default: $PYPI_NAME)"
read REPO_INPUT
REPO_NAME=${REPO_INPUT:-$PYPI_NAME}

echo "What is your readthedocs.org project name? (default: $PYPI_NAME)"
read RTD_INPUT
RTD_NAME=${RTD_INPUT:-$PYPI_NAME}

echo "What is your project name (ex: at the top of the README)? (default: $REPO_NAME)"
read PROJECT_INPUT
PROJECT_NAME=${PROJECT_INPUT:-$REPO_NAME}

echo "What is a one-liner describing the project?"
read SHORT_DESCRIPTION

_replace() {
echo "Replacing values: $1"
local find_cmd=(find "$PROJECT_ROOT" ! -perm -u=x ! -path '*/.git/*' ! -path '*/venv*/*' -type f)

if [[ $(uname) == Darwin ]]; then
"${find_cmd[@]}" -exec sed -i '' "$1" {} +
else
"${find_cmd[@]}" -exec sed -i "$1" {} +
fi
}
_replace "s/<MODULE_NAME>/$MODULE_NAME/g"
_replace "s/<PYPI_NAME>/$PYPI_NAME/g"
_replace "s/<REPO_NAME>/$REPO_NAME/g"
_replace "s/<RTD_NAME>/$RTD_NAME/g"
_replace "s/<PROJECT_NAME>/$PROJECT_NAME/g"
_replace "s/<SHORT_DESCRIPTION>/$SHORT_DESCRIPTION/g"

mkdir -p "$PROJECT_ROOT/$MODULE_NAME"
touch "$PROJECT_ROOT/$MODULE_NAME/__init__.py"
2 changes: 2 additions & 0 deletions .project-template/refill_template_vars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TEMPLATE_DIR=$(dirname $(readlink -f "$0"))
<"$TEMPLATE_DIR/template_vars.txt" "$TEMPLATE_DIR/fill_template_vars.sh"
6 changes: 6 additions & 0 deletions .project-template/template_vars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
eth_abi
eth_abi
eth-abi
eth-abi
Ethereum Contract Interface (ABI) Utility
Python utilities for working with Ethereum ABI definitions, especially encoding and decoding
30 changes: 30 additions & 0 deletions .pydocstyle.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[pydocstyle]
; All error codes found here:
; http://www.pydocstyle.org/en/3.0.0/error_codes.html
;
; Ignored:
; D1 - Missing docstring error codes
;
; Selected:
; D2 - Whitespace error codes
; D3 - Quote error codes
; D4 - Content related error codes
select=D2,D3,D4

; Extra ignores:
; D200 - One-line docstring should fit on one line with quotes
; D203 - 1 blank line required before class docstring
; D204 - 1 blank line required after class docstring
; D205 - 1 blank line required between summary line and description
; D212 - Multi-line docstring summary should start at the first line
; D302 - Use u""" for Unicode docstrings
; D400 - First line should end with a period
; D401 - First line should be in imperative mood
; D412 - No blank lines allowed between a section header and its content
add-ignore=D200,D203,D204,D205,D212,D302,D400,D401,D412

; Explanation:
; D400 - Enabling this error code seems to make it a requirement that the first
; sentence in a docstring is not split across two lines. It also makes it a
; requirement that no docstring can have a multi-sentence description without a
; summary line. Neither one of those requirements seem appropriate.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Piper Merriam
Copyright (c) 2019 The Ethereum Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
include LICENSE
include VERSION
include README.md
include requirements.txt
include requirements-docs.txt

global-include *.pyi

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
26 changes: 22 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ help:
@echo "test - run tests quickly with the default Python"
@echo "testall - run tests on every Python version with tox"
@echo "release - package and upload a release"
@echo "sdist - package"
@echo "dist - package"

clean: clean-build clean-pyc

Expand All @@ -24,14 +24,14 @@ clean-pyc:
find . -name '*~' -exec rm -f {} +

lint:
tox -e lint
tox -elint

lint-roll:
isort --recursive eth_abi tests
$(MAKE) lint

test:
py.test tests
pytest tests

test-all:
tox
Expand All @@ -40,21 +40,39 @@ build-docs:
sphinx-apidoc -o docs/ . setup.py 'eth_abi/utils/*' 'eth_abi/tools/*' 'tests/*'
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(MAKE) -C docs doctest
./newsfragments/validate_files.py
towncrier --draft --version preview

docs: build-docs
open docs/_build/html/index.html

linux-docs: build-docs
xdg-open docs/_build/html/index.html

notes:
# Let UPCOMING_VERSION be the version that is used for the current bump
$(eval UPCOMING_VERSION=$(shell bumpversion $(bump) --dry-run --list | grep new_version= | sed 's/new_version=//g'))
# Now generate the release notes to have them included in the release commit
towncrier --yes --version $(UPCOMING_VERSION)
# Before we bump the version, make sure that the towncrier-generated docs will build
make build-docs
git commit -m "Compile release notes"

release: clean
# require that you be on a branch that's linked to upstream/master
git status -s -b | head -1 | grep "\.\.upstream/master"
# verify that docs build correctly
./newsfragments/validate_files.py is-empty
make build-docs
CURRENT_SIGN_SETTING=$(git config commit.gpgSign)
git config commit.gpgSign true
bumpversion $(bump)
git push upstream && git push upstream --tags
python setup.py sdist bdist_wheel
twine upload dist/*
git config commit.gpgSign "$(CURRENT_SIGN_SETTING)"

sdist: clean
dist: clean
python setup.py sdist bdist_wheel
ls -l dist

0 comments on commit a2639e9

Please sign in to comment.