cd dir/repos
mkdir project_name
cd project_name
code .
Anaconda
conda activate py38
add .gitignore by using property tools
git init
install a version control integration tool: pip install pre-commit
sample .pre-commit-config.yaml
# <https://pre-commit.com/#top_level-default_language_version>
repos:
- repo: <https://github.com/pre-commit/pre-commit-hooks>
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
exclude: ^LICENSE|\.(html|csv|txt|svg|py)$
- id: requirements-txt-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
exclude: \.(html|svg)$
- repo: <https://github.com/pycqa/isort>
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
args:
- "--profile=black"
- "--line-length=100"
- repo: <https://github.com/psf/black>
rev: 23.1.0
hooks:
- id: black
args:
- "--line-length=100"
- repo: <https://github.com/codespell-project/codespell>
rev: v2.2.4
hooks:
- id: codespell
args:
- "--skip=*.requirements.*"
- repo: <https://github.com/PyCQA/flake8>
rev: 3.8.4
hooks:
- id: flake8
args:
- "--max-line-length=100"
- "--ignore=W503,E203"
- "--max-complexity=18"
additional_dependencies:
- "mccabe"
- repo: <https://github.com/pre-commit/mirrors-mypy>
rev: v0.902
hooks:
- id: mypy
exclude: ^tests/
args: [--strict]
- repo: <https://github.com/PyCQA/bandit>
rev: 1.7.5
hooks:
- id: bandit
sample README.md:
# README
[](<https://www.python.org/downloads/release/python-380/>)
[](<https://pycqa.github.io/isort/>)
[](<https://github.com/psf/black>)
[](<https://github.com/python/mypy>)
[](<https://github.com/PyCQA/bandit>)
##
{
"python.envFile": "${workspaceFolder}/.env",
// testing
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"-s",
"tests"
],
// isort
"isort.check": true,
"isort.args": [
"--profile",
"black"
],
// format
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--line-length=100"
],
// linting
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--max-line-length=100",
"--ignore=W503,E203",
],
// Code Spell Checker
"cSpell.enabled": true,
"cSpell.language": "en",
"cSpell.maxNumberOfProblems": 100,
"cSpell.numSuggestions": 8,
"cSpell.minWordLength": 4,
"cSpell.enabledLanguageIds": [
"python",
"markdown",
"plaintext",
"yml",
"json"
],
"cSpell.allowCompoundWords": false,
"cSpell.ignoreWords": [],
"cSpell.userWords": [],
"cSpell.ignorePaths": [
".venv",
"data"
],
"cSpell.flagWords": [
"hte",
"fuck"
]
}
# use project venv to install minimal dependencies
pip install virtualenv
virtualenv .venv
source venv/bin/activate