Skip to content

Commit 6254a90

Browse files
committed
Turn into proper Python package
This adds the scaffolding from: https://github.com/ethereum/ethereum-python-project-template
1 parent 460adac commit 6254a90

28 files changed

+1190
-3
lines changed

.bumpversion.cfg

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[bumpversion]
2+
current_version = 0.4.0-alpha.0
3+
commit = True
4+
tag = True
5+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<stage>[^.]*)\.(?P<devnum>\d+))?
6+
serialize =
7+
{major}.{minor}.{patch}-{stage}.{devnum}
8+
{major}.{minor}.{patch}
9+
10+
[bumpversion:part:stage]
11+
optional_value = stable
12+
first_value = stable
13+
values =
14+
alpha
15+
beta
16+
stable
17+
18+
[bumpversion:part:devnum]
19+
20+
[bumpversion:file:setup.py]
21+
search = version='{current_version}',
22+
replace = version='{new_version}',
23+

.circleci/config.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
version: 2.0
2+
3+
# heavily inspired by https://raw.githubusercontent.com/pinax/pinax-wiki/6bd2a99ab6f702e300d708532a6d1d9aa638b9f8/.circleci/config.yml
4+
5+
common: &common
6+
working_directory: ~/repo
7+
steps:
8+
- checkout
9+
- run:
10+
name: merge pull request base
11+
command: ./.circleci/merge_pr.sh
12+
- run:
13+
name: merge pull request base (2nd try)
14+
command: ./.circleci/merge_pr.sh
15+
when: on_fail
16+
- run:
17+
name: merge pull request base (3nd try)
18+
command: ./.circleci/merge_pr.sh
19+
when: on_fail
20+
- restore_cache:
21+
keys:
22+
- cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
23+
- run:
24+
name: install dependencies
25+
command: pip install --user tox
26+
- run:
27+
name: run tox
28+
command: ~/.local/bin/tox -r
29+
- save_cache:
30+
paths:
31+
- .hypothesis
32+
- .tox
33+
- ~/.cache/pip
34+
- ~/.local
35+
- ./eggs
36+
key: cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
37+
38+
jobs:
39+
docs:
40+
<<: *common
41+
docker:
42+
- image: circleci/python:3.6
43+
environment:
44+
TOXENV: docs
45+
lint:
46+
<<: *common
47+
docker:
48+
- image: circleci/python:3.6
49+
environment:
50+
TOXENV: lint
51+
py36-core:
52+
<<: *common
53+
docker:
54+
- image: circleci/python:3.6
55+
environment:
56+
TOXENV: py36-core
57+
py37-core:
58+
<<: *common
59+
docker:
60+
- image: circleci/python:3.7
61+
environment:
62+
TOXENV: py37-core
63+
pypy3-core:
64+
<<: *common
65+
docker:
66+
- image: pypy
67+
environment:
68+
TOXENV: pypy3-core
69+
workflows:
70+
version: 2
71+
test:
72+
jobs:
73+
- docs
74+
- lint
75+
- py36-core
76+
- py37-core
77+
- pypy3-core

.circleci/merge_pr.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
4+
PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER
5+
PR_BASE_BRANCH=$(curl -L "$PR_INFO_URL" | python -c 'import json, sys; obj = json.load(sys.stdin); sys.stdout.write(obj["base"]["ref"])')
6+
git fetch origin +"$PR_BASE_BRANCH":circleci/pr-base
7+
# We need these config values or git complains when creating the
8+
# merge commit
9+
git config --global user.name "Circle CI"
10+
git config --global user.email "[email protected]"
11+
git merge --no-edit circleci/pr-base
12+
fi

.github/ISSUE_TEMPLATE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
_If this is a bug report, please fill in the following sections.
2+
If this is a feature request, delete and describe what you would like with examples._
3+
4+
## What was wrong?
5+
6+
### Code that produced the error
7+
8+
```py
9+
CODE_TO_REPRODUCE
10+
```
11+
12+
### Full error output
13+
14+
```sh
15+
ERROR_HERE
16+
```
17+
18+
### Expected Result
19+
20+
_This section may be deleted if the expectation is "don't crash"._
21+
22+
```sh
23+
EXPECTED_RESULT
24+
```
25+
26+
## How can it be fixed?
27+
28+
Fill this section in if you know how this could or should be fixed.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## What was wrong?
2+
3+
Issue #
4+
5+
## How was it fixed?
6+
7+
Summary of approach.
8+
9+
### To-Do
10+
11+
[//]: # (Stay ahead of things, add list items here!)
12+
- [ ] Clean up commit history
13+
14+
[//]: # (For important changes that should go into the release notes please add a newsfragment file as explained here: https://github.com/ethereum/dopple/blob/master/newsfragments/README.md)
15+
16+
[//]: # (See: https://dopple.readthedocs.io/en/latest/contributing.html#pull-requests)
17+
- [ ] Add entry to the [release notes](https://github.com/ethereum/dopple/blob/master/newsfragments/README.md)
18+
19+
#### Cute Animal Picture
20+
21+
![put a cute animal picture link inside the parentheses]()

.gitignore

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
*.py[cod]
2+
3+
# C extensions
4+
*.so
5+
6+
# Packages
7+
*.egg
8+
*.egg-info
9+
dist
10+
build
11+
eggs
12+
.eggs
13+
parts
14+
bin
15+
var
16+
sdist
17+
develop-eggs
18+
.installed.cfg
19+
lib
20+
lib64
21+
venv*
22+
pip-wheel-metadata
23+
24+
# Installer logs
25+
pip-log.txt
26+
27+
# Unit test / coverage reports
28+
.coverage
29+
.tox
30+
nosetests.xml
31+
32+
# Translations
33+
*.mo
34+
35+
# Mr Developer
36+
.mr.developer.cfg
37+
.project
38+
.pydevproject
39+
40+
# Complexity
41+
output/*.html
42+
output/*/index.html
43+
44+
# Sphinx
45+
docs/_build
46+
docs/modules.rst
47+
docs/*.internal.rst
48+
docs/*.utils.rst
49+
docs/*._utils.*
50+
51+
# Blockchain
52+
chains
53+
54+
# Hypothese Property base testing
55+
.hypothesis
56+
57+
# tox/pytest cache
58+
.cache
59+
60+
# Test output logs
61+
logs
62+
### JetBrains template
63+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
64+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
65+
66+
# User-specific stuff:
67+
.idea/workspace.xml
68+
.idea/tasks.xml
69+
.idea/dictionaries
70+
.idea/vcs.xml
71+
.idea/jsLibraryMappings.xml
72+
73+
# Sensitive or high-churn files:
74+
.idea/dataSources.ids
75+
.idea/dataSources.xml
76+
.idea/dataSources.local.xml
77+
.idea/sqlDataSources.xml
78+
.idea/dynamic.xml
79+
.idea/uiDesigner.xml
80+
81+
# Gradle:
82+
.idea/gradle.xml
83+
.idea/libraries
84+
85+
# Mongo Explorer plugin:
86+
.idea/mongoSettings.xml
87+
88+
# VIM temp files
89+
*.sw[op]
90+
91+
# mypy
92+
.mypy_cache
93+
94+
## File-based project format:
95+
*.iws
96+
97+
## Plugin-specific files:
98+
99+
# IntelliJ
100+
/out/
101+
102+
# mpeltonen/sbt-idea plugin
103+
.idea_modules/
104+
105+
# JIRA plugin
106+
atlassian-ide-plugin.xml
107+
108+
# Crashlytics plugin (for Android Studio and IntelliJ)
109+
com_crashlytics_export_strings.xml
110+
crashlytics.properties
111+
crashlytics-build.properties
112+
fabric.properties
113+
114+
# VScode
115+
.vscode
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
PROJECT_ROOT=$(dirname $(dirname $(python -c 'import os, sys; sys.stdout.write(os.path.realpath(sys.argv[1]))' "$0")))
8+
9+
echo "What is your python module name?"
10+
read MODULE_NAME
11+
12+
echo "What is your pypi package name? (default: $MODULE_NAME)"
13+
read PYPI_INPUT
14+
PYPI_NAME=${PYPI_INPUT:-$MODULE_NAME}
15+
16+
echo "What is your github project name? (default: $PYPI_NAME)"
17+
read REPO_INPUT
18+
REPO_NAME=${REPO_INPUT:-$PYPI_NAME}
19+
20+
echo "What is your readthedocs.org project name? (default: $PYPI_NAME)"
21+
read RTD_INPUT
22+
RTD_NAME=${RTD_INPUT:-$PYPI_NAME}
23+
24+
echo "What is your project name (ex: at the top of the README)? (default: $REPO_NAME)"
25+
read PROJECT_INPUT
26+
PROJECT_NAME=${PROJECT_INPUT:-$REPO_NAME}
27+
28+
echo "What is a one-liner describing the project?"
29+
read SHORT_DESCRIPTION
30+
31+
_replace() {
32+
local find_cmd=(find "$PROJECT_ROOT" ! -perm -u=x ! -path '*/.git/*' -type f)
33+
34+
if [[ $(uname) == Darwin ]]; then
35+
"${find_cmd[@]}" -exec sed -i '' "$1" {} +
36+
else
37+
"${find_cmd[@]}" -exec sed -i "$1" {} +
38+
fi
39+
}
40+
_replace "s/<MODULE_NAME>/$MODULE_NAME/g"
41+
_replace "s/<PYPI_NAME>/$PYPI_NAME/g"
42+
_replace "s/<REPO_NAME>/$REPO_NAME/g"
43+
_replace "s/<RTD_NAME>/$RTD_NAME/g"
44+
_replace "s/<PROJECT_NAME>/$PROJECT_NAME/g"
45+
_replace "s/<SHORT_DESCRIPTION>/$SHORT_DESCRIPTION/g"
46+
47+
mkdir -p "$PROJECT_ROOT/$MODULE_NAME"
48+
touch "$PROJECT_ROOT/$MODULE_NAME/__init__.py"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
TEMPLATE_DIR=$(dirname $(readlink -f "$0"))
2+
<"$TEMPLATE_DIR/template_vars.txt" "$TEMPLATE_DIR/fill_template_vars.sh"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dopple
2+
dopple
3+
dopple
4+
dopple
5+
dopple
6+
HTTP proxy to Unix Socket based JSON-RPC servers

.pydocstyle.ini

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[pydocstyle]
2+
; All error codes found here:
3+
; http://www.pydocstyle.org/en/3.0.0/error_codes.html
4+
;
5+
; Ignored:
6+
; D1 - Missing docstring error codes
7+
;
8+
; Selected:
9+
; D2 - Whitespace error codes
10+
; D3 - Quote error codes
11+
; D4 - Content related error codes
12+
select=D2,D3,D4
13+
14+
; Extra ignores:
15+
; D200 - One-line docstring should fit on one line with quotes
16+
; D203 - 1 blank line required before class docstring
17+
; D204 - 1 blank line required after class docstring
18+
; D205 - 1 blank line required between summary line and description
19+
; D212 - Multi-line docstring summary should start at the first line
20+
; D302 - Use u""" for Unicode docstrings
21+
; D400 - First line should end with a period
22+
; D401 - First line should be in imperative mood
23+
; D412 - No blank lines allowed between a section header and its content
24+
add-ignore=D200,D203,D204,D205,D212,D302,D400,D401,D412
25+
26+
; Explanation:
27+
; D400 - Enabling this error code seems to make it a requirement that the first
28+
; sentence in a docstring is not split across two lines. It also makes it a
29+
; requirement that no docstring can have a multi-sentence description without a
30+
; summary line. Neither one of those requirements seem appropriate.

0 commit comments

Comments
 (0)