Skip to content

Commit 2155103

Browse files
jseop-limKirade
authored andcommitted
REF: Lint markdown
1 parent 6e526d6 commit 2155103

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
66
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/8percent/python-library/master.svg)](https://results.pre-commit.ci/latest/github/8percent/python-library/master)
77

8-
98
This repository is a [template repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) providing boilerplate for Python library.
109

1110
Developer can start writing code without wasting so much time to set up basic stuffs like CI, lint, etc.
1211

1312
## Table of Content
13+
1414
- [Usage](#usage)
1515
- [Installation](#installation)
1616
- [Install Poetry](#install-poetry)
@@ -26,6 +26,7 @@ Developer can start writing code without wasting so much time to set up basic st
2626
---
2727

2828
## Usage
29+
2930
We recommand to use GitHub's `Use this template` button to kick off this template.
3031
But yet, you can set up copy this template by cloning or downloading this repository.
3132

@@ -38,15 +39,18 @@ Subsequent Installation step might be helpful.
3839
## Installation
3940

4041
### Install Poetry
42+
4143
Please read this [installation guide](https://python-poetry.org/docs/) to install poetry.
4244

4345
Then install package dependencies with this command at project root.
4446
This will resolve package dependencies and install it in poetry managed virtual environment.
47+
4548
```
46-
$ poetry install
49+
poetry install
4750
```
4851

4952
### (Optional) Install Pyenv
53+
>
5054
> pyenv lets you easily switch between multiple versions of Python.
5155
It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.
5256

@@ -55,6 +59,7 @@ As quoted [pyenv readme](https://github.com/pyenv/pyenv/blob/master/README.md) d
5559
### Configuration
5660

5761
#### pyproject.toml
62+
5863
This file contains build system requirements and information, which are used by poetry to build the package.
5964
We tried to gather every package related settings as much as possible here.
6065
Through this design decision, project could remove package dependant configuration files like `.isort.cfg`, `pytest.ini`, etc.
@@ -68,6 +73,7 @@ Through this design decision, project could remove package dependant configurati
6873
Except **[build-system]**, We suggest you to update every settings above.
6974

7075
#### .github/workflows/ci.yml
76+
7177
We choose GitHub action as Continuous Integration tool. It contains package-build, unittest, and lint job.
7278
Each job works concurrently on different virtual machines.
7379

@@ -78,6 +84,7 @@ Each job works concurrently on different virtual machines.
7884
Change `python-version` value in this file according to package compatible python versions which configured at `pyproject.toml`.
7985

8086
#### tox.ini
87+
8188
Tox runs test against packages which built in isolated virtual environment.
8289

8390
- **[tox]**: Tox global settings.
@@ -87,19 +94,23 @@ Tox runs test against packages which built in isolated virtual environment.
8794
According to package's python compatible versions, **[tox.envlist]** and **[gh-actions]** should be defined.
8895

8996
#### Source code
97+
9098
Make your own named package in src directory.
9199

92100
**NOTE**: package setting in `pyproject.toml` should be changed as you set up your own package.
101+
93102
```
94103
packages = [
95104
{ include = "{your-python-package-name}", from = "src" },
96105
]
97106
```
98107

99108
#### Test Code
109+
100110
Every test code should resides in `tests` package at project root.
101111

102112
To test your source code, simply use 'pytest' or 'tox'.
113+
103114
```
104115
# Use pytest
105116
$ pytest tests/
@@ -111,9 +122,11 @@ $ tox
111122
---
112123

113124
## Architecture
125+
114126
Detailed explanation about stacks used in this template is covered in this section.
115127

116128
### Project Layout
129+
117130
This template repository follows src layout style. As the name suggests, its distinctive feature is subdirectory named `src`.
118131
Main python packages lives inside `src` directory.
119132

@@ -123,6 +136,7 @@ Src layout helps to achieve this condition. By separating source code from proje
123136
This layout is better explained in this [blog post by Ionel Cristian Mărieș](https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure).
124137

125138
### Dependency Management & Packaging
139+
126140
We use [Poetry](https://github.com/python-poetry/poetry) to control dependencies and build package.
127141
Advantages of using poetry is well explained in their [README.md](https://github.com/python-poetry/poetry/blob/master/README.md).
128142

@@ -131,9 +145,11 @@ It frees developer from virtual environment management. But also offers option t
131145
For more information read this [docs](https://python-poetry.org/docs/managing-environments/)
132146

133147
### Continuous Integration
148+
134149
Our GitHub action consists of two workflows. one for CI, and one for release draft.
135150

136151
`ci.yml` workflow contains three different jobs. Those are package-build, unittest, lint.
152+
137153
- **package-build** job is responsible for build package and test it. so it uses tox and can have multiple python versions.
138154
- **unittest** job is in charge of test on source code, and report test coverage.
139155
- **lint** job processes every linting stuffs.
@@ -144,27 +160,32 @@ Release draft template can be modified by editing `.github/release-drafter.yml`
144160
It demonstrates how draft should be presented.
145161

146162
### Testing
163+
147164
[Pytest](https://github.com/pytest-dev/pytest/) is our main test runner.
148165

149166
### Linting
167+
150168
Code is double-checked during development process. One at commit phase, and the other at CI process.
151169

152170
[pre-commit](https://pre-commit.com/) is help us to check at commit time. By executing installation command `pre-commit install`,
153171
It automatically adds pre commit hooks. Types of hook are managed using `.pre-commit-config.yaml`.
154172

155173
### Coverage
174+
156175
Coverage of test functions is one of important metrics which decides code quality.
157176
`ci.yml` workflow runs unittest and reports coverage report on pull request comment.
158177
We use [orgoros's github action](https://github.com/orgoro/coverage) as our coverage component of our CI workflow.
159178

160179
---
161180

162181
## Contributing
182+
163183
Pull requests are always welcome.
164184

165185
Check CONTRIBUTING.md for more details.
166186

167187
---
168188

169189
## License
190+
170191
Distributed under the terms of the MIT license.

0 commit comments

Comments
 (0)