Skip to content

Commit fa5b510

Browse files
committed
Merge remote-tracking branch 'upstream/main' into ex1
2 parents 80c7674 + 4126334 commit fa5b510

7 files changed

Lines changed: 83 additions & 26 deletions

File tree

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ on:
1313
- "docs/**"
1414

1515
jobs:
16-
test:
16+
lint:
1717
runs-on: ubuntu-latest
1818

1919
steps:
20-
- uses: actions/checkout@v2
21-
- name: Set up Python 3.10
22-
uses: actions/setup-python@v2
20+
- uses: actions/checkout@v6
21+
- name: Set up Python 3.14
22+
uses: actions/setup-python@v6
2323
with:
24-
python-version: "3.10"
24+
python-version: "3.14"
2525
- name: Install dependencies for requirements and testing
2626
run: |
2727
python -m pip install --upgrade pip
@@ -41,5 +41,8 @@ jobs:
4141
- name: Lint with mypy
4242
run: mypy $(git ls-files '*.py')
4343

44-
# - name: Test with pytest
45-
# run: pytest --cov src tests/
44+
- name: Check code formatting with black
45+
run: black --check --diff $(git ls-files '*.py')
46+
47+
- name: Check code formatting with isort
48+
run: isort --check-only --diff $(git ls-files '*.py')

‎.github/workflows/test.yml‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths-ignore:
7+
- "README.md"
8+
- "docs/**"
9+
pull_request:
10+
branches: [main]
11+
paths-ignore:
12+
- "README.md"
13+
- "docs/**"
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v6
21+
- name: Set up Python 3.14
22+
uses: actions/setup-python@v6
23+
with:
24+
python-version: "3.14"
25+
- name: Install dependencies for requirements and testing
26+
run: |
27+
python -m pip install --upgrade pip
28+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29+
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
30+
31+
- name: Test with pytest
32+
run: pytest --cov src tests/

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
**/*.pyc
33
**/.DS_Store
44
.coverage
5+
venv/

‎.pylintrc‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ py-version=3.10
8989
# Discover python modules and packages in the file system subtree.
9090
recursive=no
9191

92-
# When enabled, pylint would attempt to guess common misconfiguration and emit
93-
# user-friendly hints instead of false-positive error messages.
94-
suggestion-mode=yes
95-
9692
# Allow loading of arbitrary C extensions. Extensions are imported into the
9793
# active Python interpreter and may run arbitrary code.
9894
unsafe-load-any-extension=no
@@ -307,8 +303,8 @@ min-public-methods=2
307303
[EXCEPTIONS]
308304

309305
# Exceptions that will emit a warning when caught.
310-
overgeneral-exceptions=BaseException,
311-
Exception
306+
overgeneral-exceptions=builtins.BaseException,
307+
builtins.Exception
312308

313309

314310
[FORMAT]

‎README.md‎

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,44 @@
22

33
This repository has been created to give a python template project which includes pytest instructions.
44

5-
### Install requirements
5+
### 1️⃣ How to start (one-time step)
66

7-
Use pip or pip3 to install the dev requirements for the software testing:
7+
Fork this repository and clone your fork into your machine using:
88

99
```bash
10-
pip install -r requirements_dev.txt
10+
git clone git@github.com:USERNAME/qd-starter-pack.git
1111
```
1212

13-
### 1️⃣ How to start
13+
enter to your project directory using:
1414

15-
Fork this repository and clone your fork into your machine using:
1615
```bash
17-
git clone git@github.com:USERNAME/qd-starter-pack.git
16+
cd qd-starter-pack
1817
```
1918

20-
enter to your project directory using:
19+
Setup virtualenv:
20+
2121
```bash
22-
cd qd-starter-pack
22+
python3 -m pip install venv
23+
python3 -m venv venv
24+
source ./venv/bin/activate
2325
```
2426

27+
After running these commands you'll see a `(venv)` in your terminal, if so, you are running the python version of the local environment.
28+
29+
Then, install the tests requirements in your local virtual environment
30+
31+
```bash
32+
pip install -r requirements_dev.txt
33+
```
34+
35+
⚠️ Note: You need to run `source ./venv/bin/activate` every time you open a new terminal to activate the local virtual environment.
36+
2537
---
2638

2739
### 2️⃣ How to make a branch
2840

2941
To create a new `branch` from the main repository and work on a specific exercise (ex. `ex1.py`) you can use the following commands:
42+
3043
```bash
3144
git checkout main
3245

@@ -38,38 +51,44 @@ git checkout -b new-branch-name
3851
### 3️⃣ How to make a commit
3952

4053
From this step you can edit your `ex1.py` and make some commits using:
54+
4155
```bash
42-
git add exercises/ex1.py
56+
git add src/ex1.py
4357

4458
git commit -m 'feat: description'
4559
```
60+
4661
Use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) when you write a commit description.
4762

4863
---
4964

5065
### 4️⃣ How to make a PR
5166

5267
Push the commits into GitHub using:
68+
5369
```bash
5470
git push -u origin new-branch-name
5571
```
5672

57-
Afterward, it is possible to create a Pull Request by going to your fork `https://github.com/USERNAME/git-course-exercises.git` clicking on "create Pull Request" or going to the right section "Pull Request" -> "New Pull Request".
73+
Afterward, it is possible to create a Pull Request by going to your fork `https://github.com/USERNAME/qd-starter-pack.git` clicking on "create Pull Request" or going to the right section "Pull Request" -> "New Pull Request".
5874

5975
If you want to work on another `ex1.py`, go to step 2️⃣.
6076

6177
---
6278

6379
Use git wisely.
6480

65-
66-
<!-- ### Software Testing
81+
### Software Testing
6782

6883
How to run properly the tests with the related html report:
6984

7085
```bash
7186
$ pytest --cov src tests/ --cov-report=html
72-
``` -->
87+
88+
# or
89+
90+
$ pytest .
91+
```
7392

7493
### Clean code
7594

‎requirements_dev.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ pytest-cov
44
pylint
55
mypy
66
flake8
7+
black
8+
isort

‎src/sum.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
def sum(a: int, b: int) -> int:
22
return a + b
3+
4+
5+
if __name__ == "__main__": # pragma: no cover
6+
print(sum(3, 5))

0 commit comments

Comments
 (0)