diff --git a/.vscode/extensions.json b/.vscode/extensions.json index b4aad4fc..3eeefedd 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,11 +1,13 @@ { "recommendations": [ + "DavidAnson.vscode-markdownlint", "PascalReitermann93.vscode-yaml-sort", "charliermarsh.ruff", - "esbenp.prettier-vscode", "ms-python.black-formatter", + "ms-python.mypy-type-checker", "ms-python.python", "richie5um2.vscode-sort-json", + "shd101wyy.markdown-preview-enhanced", "streetsidesoftware.code-spell-checker", "trond-snekvik.simple-rst" ] diff --git a/.vscode/settings.json b/.vscode/settings.json index 8a7d5649..f1ceaacf 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,7 +3,7 @@ "editor.defaultFormatter": "vscode.json-language-features" }, "[markdown]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "DavidAnson.vscode-markdownlint" }, "[python]": { "editor.codeActionsOnSave": { @@ -24,6 +24,7 @@ "huxuan", "interruptible", "isort", + "JPKXI", "mypy", "pathjoin", "pipenv", @@ -57,8 +58,7 @@ "files.insertFinalNewline": true, "files.trimFinalNewlines": true, "files.trimTrailingWhitespace": true, - "python.formatting.provider": "black", - "python.linting.mypyEnabled": true, + "markdown-preview-enhanced.breakOnSingleNewLine": false, "sortJSON.contextMenu": { "sortJSONAlphaNum": false, "sortJSONAlphaNumReverse": false, diff --git a/Makefile b/Makefile index 37083553..3b88b8a7 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ tests: ${PIPRUN} python -m coverage report ######################################################################################## -# Packages +# Package ######################################################################################## # Show currently installed dependecies excluding the package itself with versions diff --git a/Makefile.jinja b/Makefile.jinja index 21a9ecb7..a771e9f0 100644 --- a/Makefile.jinja +++ b/Makefile.jinja @@ -95,7 +95,7 @@ tests: ${PIPRUN} python -m coverage report ######################################################################################## -# Packages +# Package ######################################################################################## # Show currently installed dependecies excluding the package itself with versions diff --git a/README.md b/README.md index 6d6c1d83..f777d87e 100644 --- a/README.md +++ b/README.md @@ -18,83 +18,70 @@ A development-focused Python project template with various integrations, configu [![Serious Scaffold Python](docs/_static/images/logo.svg)](https://github.com/serious-scaffold/serious-scaffold-python) -Project setup often involves more than just creating a basic project structure. It includes tasks like setting up GitHub Actions or GitLab CI/CD, configuring linters, tests and documentation, and implementing settings and logging modules. If you are tired of this repetitive process, [Serious Scaffold Python](https://github.com/serious-scaffold/serious-scaffold-python) is here to help. Utilizing the power of [`copier`](https://copier.readthedocs.io/), you can generate a new Python project with just one command. Simply answer a few questions, and your project will be fully set up. Additionally, your project can be updated alongside the advancement of the template. +Setting up a project often involves more than just establishing a basic project structure. It involves tasks like integrating GitHub Actions or GitLab CI/CD, configuring linters, tests and documentation, as well as implementing settings, logging and other frequently used modules. [Serious Scaffold Python](https://github.com/serious-scaffold/serious-scaffold-python) streamlines this process. Powered by [`copier`](https://copier.readthedocs.io/), bootstrapping a new Python project can be done with a single command. By answering a few questions, the project will be fully configured and ready for development. Furthermore, the project can be updated alongside the advancement of the template. If you find this helpful, please consider [sponsorship](https://github.com/sponsors/huxuan). -## 🛠 Features - -- **Template Rendering** - - Harness [`copier`](https://copier.readthedocs.io/) to initiate projects and enable template updates. -- **Environment Management** - - Utilize [`pipenv`](https://pipenv.pypa.io/) for virtual environment management. - - Use containers and system-level `pip` for CI/CD. -- **Dependency Management** - - Manage dependencies categorically with [constraints](https://pip.pypa.io/en/stable/user_guide/#constraints-files) for different environments. -- **Code Quality Checks** - - Incorporate linters including [`black`](https://github.com/psf/black), [`isort`](https://pycqa.github.io/isort/), [`mypy`](http://www.mypy-lang.org/), [`ruff`](https://github.com/charliermarsh/ruff), and [`toml-sort`](https://github.com/pappasam/toml-sort). - - Integrate [`pre-commit`](https://github.com/pre-commit/pre-commit) for Git hooks automation. -- **Tests** - - Execute tests with [`pytest`](https://pytest.org/), supplemented by [`coverage`](https://coverage.readthedocs.io) reports and thresholds. -- **Documentation** - - Use [`sphinx`](https://www.sphinx-doc.org/) with the [`furo`](https://pradyunsg.me/furo) theme. - - Include [MyPy](https://mypy.readthedocs.io/en/stable/command_line.html?report-generation) and [Coverage](https://coverage.readthedocs.io/en/7.3.0/cmd.html#html-reporting-coverage-html) reports. -- **Continuous Integration** - - Offer a unified `Makefile` for common actions. - - Provide configurations for [GitHub Actions](https://docs.github.com/actions) and [GitLab CI/CD](https://docs.gitlab.com/ee/ci/). - - Support [Read the Docs](https://readthedocs.org/) integration. -- **Common Modules** - - Use [`typer`](https://typer.tiangolo.com/) for CLI tasks, including tests, documentation, and configuration. - - Adopt [`setuptools-scm`](https://github.com/pypa/setuptools_scm/) for versioning via git metadata. - - Implement [`pydantic-settings`](https://docs.pydantic.dev/latest/usage/pydantic_settings/) for robust settings management. -- **Miscellaneous** - - Offer VSCode [settings](.vscode/settings.json) and recommended [extensions](.vscode/extensions.json). - -## 🔧 Prerequisites +## :hammer_and_wrench: Features + +- Project setup and template update with [`copier`](https://copier.readthedocs.io/). +- Manage [virtual environments](https://docs.python.org/3/glossary.html#term-virtual-environment) for development with [`pipenv`](https://pipenv.pypa.io/). +- Manage dependency with categorized [requirements](https://pip.pypa.io/en/stable/user_guide/#requirements-files) and [constraints](https://pip.pypa.io/en/stable/user_guide/#constraints-files). +- Automate Git hooks with [pre-commit hooks](https://github.com/pre-commit/pre-commit-hooks) and [local](https://pre-commit.com/#repository-local-hooks) linters. +- Lint with [`black`](https://github.com/psf/black), [`isort`](https://pycqa.github.io/isort/), [`mypy`](http://www.mypy-lang.org/), [`ruff`](https://github.com/charliermarsh/ruff), and [`toml-sort`](https://github.com/pappasam/toml-sort). +- Test with [`pytest`](https://pytest.org/) and [`coverage`](https://coverage.readthedocs.io) for threshold and reports. +- Document with [`sphinx`](https://www.sphinx-doc.org/), the [`furo`](https://pradyunsg.me/furo) theme, and [mypy](https://mypy.readthedocs.io/en/stable/command_line.html?report-generation)/[coverage](https://coverage.readthedocs.io/en/7.3.0/cmd.html#html-reporting-coverage-html) reports. +- Version the package using git metadata with [`setuptools-scm`](https://github.com/pypa/setuptools_scm/). +- Continuous Integration with [GitHub Actions](https://docs.github.com/actions) and [GitLab CI/CD](https://docs.gitlab.com/ee/ci/). +- [Versioned documentation](https://docs.readthedocs.io/en/stable/versions.html) with [Read the Docs](https://readthedocs.org/) integration. +- Develop Command Line Interfaces with [`typer`](https://typer.tiangolo.com/). +- Manage configurations with [`pydantic-settings`](https://docs.pydantic.dev/latest/usage/pydantic_settings/). +- Centralize common actions with a unified [`Makefile`](Makefile). +- VSCode [settings](.vscode/settings.json) with recommended [extensions](.vscode/extensions.json). + +## :wrench: Prerequisites Certain system-level Python applications are needed and it is recommended to use [`pipx`](https://pypa.github.io/pipx/) to install and run them in isolated environments. Refer to pipx's installation instructions [here](https://pypa.github.io/pipx/installation/). Once `pipx` is set up, install the necessary tools using the following commands. ```bash # Copier: Template rendering for projects. pipx install copier - # Pipenv: Virtual environment and package manager for Python. pipx install pipenv - # Pre-commit: Automates Git hooks for code quality checks. pipx install pre-commit ``` -## 🚀 Quickstart +## :rocket: Quickstart -1. Generate the project by answering several questions. +1. Generate the project. ```bash copier copy gh:serious-scaffold/serious-scaffold-python /path/to/project ``` -1. Initialize an empty git repository. +2. Navigate to the project directory and initialize a git repository. ```bash cd /path/to/project git init ``` -1. Prepare development environment. +3. Set up the development environment. ```bash make dev ``` -1. Commit the initialized project. +4. Commit the initialized project. ```bash git add . - git commit -m "Init from serious-scaffold-python." + git commit -m "Initialize from serious-scaffold-python." ``` -1. Initialization Done! Focus on the logical code within `src` folder now. +5. That's it! Feel free to focus on the coding within `src` folder. -## 📜 License +## :scroll: License MIT, for more details, see the [LICENSE](LICENSE) file. diff --git a/README.md.jinja b/README.md.jinja index 9d5140a3..5b89586d 100644 --- a/README.md.jinja +++ b/README.md.jinja @@ -18,83 +18,70 @@ [![{{ project_name }}](docs/_static/images/logo.svg)](https://github.com/{{ repo_namespace }}/{{ repo_name }}) -Project setup often involves more than just creating a basic project structure. It includes tasks like setting up GitHub Actions or GitLab CI/CD, configuring linters, tests and documentation, and implementing settings and logging modules. If you are tired of this repetitive process, [Serious Scaffold Python](https://github.com/serious-scaffold/serious-scaffold-python) is here to help. Utilizing the power of [`copier`](https://copier.readthedocs.io/), you can generate a new Python project with just one command. Simply answer a few questions, and your project will be fully set up. Additionally, your project can be updated alongside the advancement of the template. +Setting up a project often involves more than just establishing a basic project structure. It involves tasks like integrating GitHub Actions or GitLab CI/CD, configuring linters, tests and documentation, as well as implementing settings, logging and other frequently used modules. [Serious Scaffold Python](https://github.com/serious-scaffold/serious-scaffold-python) streamlines this process. Powered by [`copier`](https://copier.readthedocs.io/), bootstrapping a new Python project can be done with a single command. By answering a few questions, the project will be fully configured and ready for development. Furthermore, the project can be updated alongside the advancement of the template. If you find this helpful, please consider [sponsorship](https://github.com/sponsors/{{ author_name }}). -## 🛠 Features - -- **Template Rendering** - - Harness [`copier`](https://copier.readthedocs.io/) to initiate projects and enable template updates. -- **Environment Management** - - Utilize [`pipenv`](https://pipenv.pypa.io/) for virtual environment management. - - Use containers and system-level `pip` for CI/CD. -- **Dependency Management** - - Manage dependencies categorically with [constraints](https://pip.pypa.io/en/stable/user_guide/#constraints-files) for different environments. -- **Code Quality Checks** - - Incorporate linters including [`black`](https://github.com/psf/black), [`isort`](https://pycqa.github.io/isort/), [`mypy`](http://www.mypy-lang.org/), [`ruff`](https://github.com/charliermarsh/ruff), and [`toml-sort`](https://github.com/pappasam/toml-sort). - - Integrate [`pre-commit`](https://github.com/pre-commit/pre-commit) for Git hooks automation. -- **Tests** - - Execute tests with [`pytest`](https://pytest.org/), supplemented by [`coverage`](https://coverage.readthedocs.io) reports and thresholds. -- **Documentation** - - Use [`sphinx`](https://www.sphinx-doc.org/) with the [`furo`](https://pradyunsg.me/furo) theme. - - Include [MyPy](https://mypy.readthedocs.io/en/stable/command_line.html?report-generation) and [Coverage](https://coverage.readthedocs.io/en/7.3.0/cmd.html#html-reporting-coverage-html) reports. -- **Continuous Integration** - - Offer a unified `Makefile` for common actions. - - Provide configurations for [GitHub Actions](https://docs.github.com/actions) and [GitLab CI/CD](https://docs.gitlab.com/ee/ci/). - - Support [Read the Docs](https://readthedocs.org/) integration. -- **Common Modules** - - Use [`typer`](https://typer.tiangolo.com/) for CLI tasks, including tests, documentation, and configuration. - - Adopt [`setuptools-scm`](https://github.com/pypa/setuptools_scm/) for versioning via git metadata. - - Implement [`pydantic-settings`](https://docs.pydantic.dev/latest/usage/pydantic_settings/) for robust settings management. -- **Miscellaneous** - - Offer VSCode [settings](.vscode/settings.json) and recommended [extensions](.vscode/extensions.json). - -## 🔧 Prerequisites +## :hammer_and_wrench: Features + +- Project setup and template update with [`copier`](https://copier.readthedocs.io/). +- Manage [virtual environments](https://docs.python.org/3/glossary.html#term-virtual-environment) for development with [`pipenv`](https://pipenv.pypa.io/). +- Manage dependency with categorized [requirements](https://pip.pypa.io/en/stable/user_guide/#requirements-files) and [constraints](https://pip.pypa.io/en/stable/user_guide/#constraints-files). +- Automate Git hooks with [pre-commit hooks](https://github.com/pre-commit/pre-commit-hooks) and [local](https://pre-commit.com/#repository-local-hooks) linters. +- Lint with [`black`](https://github.com/psf/black), [`isort`](https://pycqa.github.io/isort/), [`mypy`](http://www.mypy-lang.org/), [`ruff`](https://github.com/charliermarsh/ruff), and [`toml-sort`](https://github.com/pappasam/toml-sort). +- Test with [`pytest`](https://pytest.org/) and [`coverage`](https://coverage.readthedocs.io) for threshold and reports. +- Document with [`sphinx`](https://www.sphinx-doc.org/), the [`furo`](https://pradyunsg.me/furo) theme, and [mypy](https://mypy.readthedocs.io/en/stable/command_line.html?report-generation)/[coverage](https://coverage.readthedocs.io/en/7.3.0/cmd.html#html-reporting-coverage-html) reports. +- Version the package using git metadata with [`setuptools-scm`](https://github.com/pypa/setuptools_scm/). +- Continuous Integration with [GitHub Actions](https://docs.github.com/actions) and [GitLab CI/CD](https://docs.gitlab.com/ee/ci/). +- [Versioned documentation](https://docs.readthedocs.io/en/stable/versions.html) with [Read the Docs](https://readthedocs.org/) integration. +- Develop Command Line Interfaces with [`typer`](https://typer.tiangolo.com/). +- Manage configurations with [`pydantic-settings`](https://docs.pydantic.dev/latest/usage/pydantic_settings/). +- Centralize common actions with a unified [`Makefile`](Makefile). +- VSCode [settings](.vscode/settings.json) with recommended [extensions](.vscode/extensions.json). + +## :wrench: Prerequisites Certain system-level Python applications are needed and it is recommended to use [`pipx`](https://pypa.github.io/pipx/) to install and run them in isolated environments. Refer to pipx's installation instructions [here](https://pypa.github.io/pipx/installation/). Once `pipx` is set up, install the necessary tools using the following commands. ```bash # Copier: Template rendering for projects. pipx install copier - # Pipenv: Virtual environment and package manager for Python. pipx install pipenv - # Pre-commit: Automates Git hooks for code quality checks. pipx install pre-commit ``` -## 🚀 Quickstart +## :rocket: Quickstart -1. Generate the project by answering several questions. +1. Generate the project. ```bash copier copy gh:serious-scaffold/serious-scaffold-python /path/to/project ``` -1. Initialize an empty git repository. +2. Navigate to the project directory and initialize a git repository. ```bash cd /path/to/project git init ``` -1. Prepare development environment. +3. Set up the development environment. ```bash make dev ``` -1. Commit the initialized project. +4. Commit the initialized project. ```bash git add . - git commit -m "Init from serious-scaffold-python." + git commit -m "Initialize from serious-scaffold-python." ``` -1. Initialization Done! Focus on the logical code within `src` folder now. +5. That's it! Feel free to focus on the coding within `src` folder. -## 📜 License +## :scroll: License MIT, for more details, see the [LICENSE](LICENSE) file. diff --git a/tests/settings_test.py b/tests/settings_test.py index 3c7dee5c..771b1881 100644 --- a/tests/settings_test.py +++ b/tests/settings_test.py @@ -6,5 +6,8 @@ def test_settings() -> None: """Tests for settings.""" - assert settings.logging_level == os.getenv("SERIOUS_SCAFFOLD_LOGGING_LEVEL", "INFO") + assert settings.logging_level == os.getenv( + "SERIOUS_SCAFFOLD_LOGGING_LEVEL", + "INFO", + ) assert str(global_settings.ci).lower() == os.getenv("CI", "False").lower() diff --git a/tests/settings_test.py.jinja b/tests/settings_test.py.jinja index 464eb721..4ba8a225 100644 --- a/tests/settings_test.py.jinja +++ b/tests/settings_test.py.jinja @@ -6,5 +6,8 @@ from {{ module_name }}.settings import global_settings, settings def test_settings() -> None: """Tests for settings.""" - assert settings.logging_level == os.getenv("{{ module_name|upper }}_LOGGING_LEVEL", "INFO") + assert settings.logging_level == os.getenv( + "{{ module_name|upper }}_LOGGING_LEVEL", + "INFO", + ) assert str(global_settings.ci).lower() == os.getenv("CI", "False").lower()