-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
295 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[flake8] | ||
extend-ignore = E203 | ||
exclude = venv,.git,__pycache__,docs/source/conf.py,old,build,dist | ||
max-complexity = 10 | ||
max-line-length = 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: CI Transfermarkt | ||
|
||
# When this action will be executed | ||
on: | ||
# Automatically trigger it when detected changes in repo | ||
push: | ||
branches: | ||
- 'main' | ||
- 'feature/*' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
# Allow manually trigger | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
Quality: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Python 3.10.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.10.8 | ||
|
||
|
||
- name: Install Dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install | ||
- name: Analyze Syntax | ||
run: | | ||
python -m invoke lint | ||
- name: Run Tests | ||
run: | | ||
python -m invoke coverage | ||
- name: Report Coverage | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.github_token }} | ||
|
||
|
||
Release: | ||
needs: Quality | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Python 3.10.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.10.8 | ||
|
||
- name: Upgrading PIP | ||
run: | | ||
python -m pip install --upgrade pip | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install | ||
- name: Python Semantic Release | ||
uses: relekang/python-semantic-release@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
repository_username: __token__ | ||
repository_password: ${{ secrets.PYPI_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.idea | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,73 @@ | ||
# pygen-scaffold | ||
A python program for scaffolding python projects. | ||
|
||
## Setup | ||
|
||
### Step 1. Create a virtual environment | ||
|
||
You only need to do this once, if you've done it before for this project, you can skip this step. | ||
|
||
```bash | ||
python3 -m venv venv | ||
``` | ||
|
||
### Step 2. Activate the virtual environment | ||
|
||
```bash | ||
source venv/bin/activate | ||
``` | ||
|
||
### Step 3. Upgrade PIP | ||
|
||
```bash | ||
pip install --upgrade pip | ||
``` | ||
|
||
### Step 4. Install the dependencies | ||
|
||
```bash | ||
# Install the production dependencies | ||
pip install -r requirements.txt | ||
|
||
# Install development dependencies | ||
pip install -r requirements-dev.txt | ||
``` | ||
|
||
|
||
## Development Usage | ||
|
||
### Clean transient files | ||
|
||
```bash | ||
inv clean | ||
``` | ||
|
||
### Run the tests | ||
|
||
```bash | ||
inv test | ||
``` | ||
|
||
### Generate Coverage Report | ||
|
||
```bash | ||
inv coverage | ||
``` | ||
|
||
### Run the linter | ||
|
||
```bash | ||
inv lint | ||
``` | ||
|
||
### Execute the build process | ||
|
||
```bash | ||
inv | ||
``` | ||
|
||
|
||
|
||
|
||
## References | ||
[Github-flavored Markdown](https://guides.github.com/features/mastering-markdown/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
TN: | ||
SF:tests/__init__.py | ||
DA:1,1,1B2M2Y8AsgTpgAmY7PhCfg | ||
LF:0 | ||
LH:1 | ||
end_of_record | ||
TN: | ||
SF:tests/test_something.py | ||
DA:1,1,lft/kKUJ2v0dlVW7lf9LzQ | ||
DA:2,1,I+zd5u+CbVRpS2nwy89lXg | ||
LF:2 | ||
LH:2 | ||
end_of_record |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[build-system] | ||
requires = ["setuptools>=61.0"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "pygen-scaffold" | ||
version = "0.0.1" | ||
authors = [ | ||
{ name="Omar Crosby", email="omar.crosby@gmail.com" }, | ||
] | ||
description = "A python program for scaffolding python projects." | ||
readme = "README.md" | ||
requires-python = ">=3.10" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: GNU General Public License (GPL)", | ||
"Operating System :: OS Independent", | ||
] | ||
keywords = [ | ||
"scaffold" | ||
] | ||
|
||
[project.urls] | ||
"Homepage" = "https://github.com/ocrosby/pygen-scaffold" | ||
"Bug Tracker" = "https://github.com/ocrosby/pygen-scaffold/issues" | ||
|
||
|
||
[tool.flake8] | ||
ignore = ['C901', 'E203', 'F401', 'W503'] | ||
max-line-length = 88 | ||
exclude = ['.env', '.venv', '.env', 'env', 'migrations', '__pycache__', 'manage.py', 'settings.py'] | ||
|
||
[tool.semantic_release] | ||
version_source = "commit" | ||
version_variable = [ | ||
"src/pygen-scaffold/__init__.py:__version__" | ||
] | ||
version_toml = [ | ||
"pyproject.toml:project.version", | ||
"pyproject.toml:tool.poetry.version" | ||
] | ||
version_pattern = [ | ||
"README.md:rev: v{version}" | ||
] | ||
major_on_zero = true | ||
branch = "main" | ||
upload_to_pypi = true | ||
upload_to_release = true | ||
commit_subject = "chore: release {version} [skip ci] ***NO_CI***" | ||
build_command = "python3 -m pip install --upgrade build && python3 -m build" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[pytest] | ||
minversion = 6.0 | ||
addopts = -ra -q | ||
testpaths = | ||
tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pytest | ||
pytest-cov | ||
pytest-mock | ||
invoke | ||
flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
click |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
if __name__ == "__main__": | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from invoke import task | ||
|
||
|
||
@task(aliases=["i"]) | ||
def install(c): | ||
c.run("pip install -r requirements.txt") | ||
|
||
|
||
@task(aliases=["u"]) | ||
def update_pip(c): | ||
print("Updating dependencies...") | ||
c.run("pip install --upgrade pip") | ||
|
||
|
||
@task(aliases=["c"]) | ||
def clean(c): | ||
print("Cleaning up...") | ||
c.run("rm -f *.png") | ||
c.run("rm -rf coverage") | ||
c.run("rm -rf dist") | ||
c.run("rm -f .coverage") | ||
c.run("rm -f coverage.xml") | ||
c.run("rm -rf htmlcov") | ||
c.run("rm -rf tests/htmlcov") | ||
c.run("rm -rf tests/.pytest_cache") | ||
c.run("rm -rf ./.pytest_cache") | ||
c.run("rm -f tests/coverage.xml") | ||
|
||
|
||
@task(aliases=["t"]) | ||
def test(c): | ||
"""Runs PyTest unit tests.""" | ||
c.run("pytest tests") | ||
|
||
|
||
@task(aliases=["v"]) | ||
def coverage(c): | ||
"""Runs PyTest unit and integration tests with coverage.""" | ||
c.run("coverage run -m pytest") | ||
c.run("coverage lcov -o ./coverage/lcov.info") | ||
|
||
|
||
@task(aliases=["l"]) | ||
def lint(c): | ||
print("Linting...") | ||
c.run( | ||
"flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics" | ||
) | ||
c.run( | ||
"flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics" | ||
) | ||
|
||
|
||
@task(aliases=["b"], pre=[clean, lint, coverage], default=True) | ||
def build(c): | ||
print("Building the project") | ||
c.run("python3 -m pip install --upgrade build") | ||
c.run("python -m build") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def test_something(): | ||
assert True |