Skip to content

Commit

Permalink
Merge pull request #2095 from pacrob/join-to-template
Browse files Browse the repository at this point in the history
Merge in less-sensitive updates from the project template
  • Loading branch information
pacrob committed Apr 12, 2023
2 parents 636aaa1 + 09d2e2b commit 158f0c9
Show file tree
Hide file tree
Showing 23 changed files with 326 additions and 49 deletions.
6 changes: 3 additions & 3 deletions .bumpversion.cfg
Expand Up @@ -10,13 +10,13 @@ serialize =
[bumpversion:part:stage]
optional_value = stable
first_value = stable
values =
values =
alpha
beta
stable

[bumpversion:part:devnum]

[bumpversion:file:setup.py]
search = version='{current_version}',
replace = version='{new_version}',
search = version="{current_version}",
replace = version="{new_version}",
17 changes: 0 additions & 17 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

70 changes: 70 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,70 @@
name: Bug Report
description: File a bug report
labels: ["bug"]
body:
- type: markdown
attributes:
value: "## What was wrong"
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us what you expected to happen
validations:
required: true
- type: textarea
id: code-that-caused
attributes:
label: Code that produced the error
description: Formats to Python, no backticks needed
render: python
validations:
required: false
- type: textarea
id: error-output
attributes:
label: Full error output
description: Formats to shell, no backticks needed
render: shell
validations:
required: false
- type: markdown
attributes:
value: "## Potential Solutions"
- type: textarea
id: how-to-fix
attributes:
label: Fill this section in if you know how this could or should be fixed
description: Include any relevant examples or reference material
validations:
required: false
- type: input
id: lib-version
attributes:
label: py-evm Version
description: Which version of py-evm are you using?
placeholder: x.x.x
validations:
required: false
- type: input
id: py-version
attributes:
label: Python Version
description: Which version of Python are you using?
placeholder: x.x.x
validations:
required: false
- type: input
id: os
attributes:
label: Operating System
description: Which operating system are you using?
placeholder: osx/linux/win
validations:
required: false
- type: textarea
id: pip-freeze
attributes:
label: Output from pip-freeze
description: Run `pip-freeze` and paste the output below
render: shell
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Questions about using py-evm?
url: https://discord.gg/GHryRvPB84
about: You can ask and answer usage questions on the Ethereum Python Community Discord
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,11 @@
name: Feature Request
description: Request a new feature
labels: ["feature_request"]
body:
- type: textarea
id: feature-description
attributes:
label: What feature should we add?
description: Include any relevant examples or reference material
validations:
required: true
17 changes: 0 additions & 17 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

17 changes: 17 additions & 0 deletions .github/pull_request_template.md
@@ -0,0 +1,17 @@
### What was wrong?

Related to Issue #
Closes Issue #

### How was it fixed?

### Todo:
- [ ] Clean up commit history

- [ ] Add or update documentation related to these changes

- [ ] Add entry to the [release notes](https://github.com/ethereum/web3.py/blob/master/newsfragments/README.md)

#### Cute Animal Picture

![Put a link to a cute animal picture inside the parenthesis-->]()
52 changes: 52 additions & 0 deletions .gitignore
Expand Up @@ -9,14 +9,17 @@
dist
build
eggs
.eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
pip-wheel-metadata
venv*

# Installer logs
pip-log.txt
Expand Down Expand Up @@ -79,3 +82,52 @@ monkeytype.sqlite3

# .DS_Store files
.DS_Store
docs/*.internal.rst
docs/*.utils.rst
docs/*._utils.*

# Blockchain
chains

# Hypothese Property base testing
.hypothesis

# tox/pytest cache
.cache
.pytest_cache

# Test output logs
logs

# VIM temp files
*.sw[op]

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# For a more precise, explicit template, see:
# https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

## General
.idea/*
.idea_modules/*

## File-based project format:
*.iws

## IntelliJ
out/

## Plugin-specific files:

### 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

# END JetBrains section
71 changes: 71 additions & 0 deletions .project-template/fill_template_vars.py
@@ -0,0 +1,71 @@
#!/usr/bin/env python3

import os
import sys
import re
from pathlib import Path


def _find_files(project_root):
path_exclude_pattern = r"\.git($|\/)|venv|_build|\.tox"
file_exclude_pattern = r"fill_template_vars\.py|\.swp$"
filepaths = []
for dir_path, _dir_names, file_names in os.walk(project_root):
if not re.search(path_exclude_pattern, dir_path):
for file in file_names:
if not re.search(file_exclude_pattern, file):
filepaths.append(str(Path(dir_path, file)))

return filepaths


def _replace(pattern, replacement, project_root):
print(f"Replacing values: {pattern}")
for file in _find_files(project_root):
try:
with open(file) as f:
content = f.read()
content = re.sub(pattern, replacement, content)
with open(file, "w") as f:
f.write(content)
except UnicodeDecodeError:
pass


def main():
project_root = Path(os.path.realpath(sys.argv[0])).parent.parent

module_name = input("What is your python module name (ex: What would you import (no dashes)? ")

pypi_input = input(f"What is your pypi package name? (default: {module_name}) ")
pypi_name = pypi_input or module_name

repo_input = input(f"What is your github project name? (default: {pypi_name}) ")
repo_name = repo_input or pypi_name

rtd_input = input(
f"What is your readthedocs.org project name? (default: {pypi_name}) "
)
rtd_name = rtd_input or pypi_name

project_input = input(
f"What is your project name (ex: at the top of the README)? (default: {repo_name}) "
)
project_name = project_input or repo_name

short_description = input("What is a one-liner describing the project? ")

_replace("<MODULE_NAME>", module_name, project_root)
_replace("<PYPI_NAME>", pypi_name, project_root)
_replace("<REPO_NAME>", repo_name, project_root)
_replace("<RTD_NAME>", rtd_name, project_root)
_replace("<PROJECT_NAME>", project_name, project_root)
_replace("<SHORT_DESCRIPTION>", short_description, project_root)

os.makedirs(project_root / module_name, exist_ok=True)
Path(project_root / module_name / "__init__.py").touch()
Path(project_root / module_name / "py.typed").touch()


if __name__ == "__main__":
main()
39 changes: 39 additions & 0 deletions .project-template/refill_template_vars.py
@@ -0,0 +1,39 @@
#!/usr/bin/env python3

import os
import sys
from pathlib import Path
import subprocess


def main():
template_dir = Path(os.path.dirname(sys.argv[0]))
template_vars_file = template_dir / "template_vars.txt"
fill_template_vars_script = template_dir / "fill_template_vars.py"

with open(template_vars_file, "r") as input_file:
content_lines = input_file.readlines()

process = subprocess.Popen(
[sys.executable, str(fill_template_vars_script)],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)

for line in content_lines:
process.stdin.write(line)
process.stdin.flush()

stdout, stderr = process.communicate()

if process.returncode != 0:
print(f"Error occurred: {stderr}")
sys.exit(1)

print(stdout)


if __name__ == "__main__":
main()
6 changes: 6 additions & 0 deletions .project-template/template_vars.txt
@@ -0,0 +1,6 @@
eth
py-evm
py-evm
py-evm
py-evm
An implementation of the Ethereum Virtual Machine (EVM) written in Python
30 changes: 30 additions & 0 deletions .pydocstyle.ini
@@ -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
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright 2017-2019 Ethereum Foundation
Copyright (c) 2017-2023 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

0 comments on commit 158f0c9

Please sign in to comment.