Case of study#
The last session of this training will consist of the execution of a project with the objective of putting into practice the main points presented during the training.
The aim is to practice:
The steps of the Software Development Life Cycle, mainly the steps of:
Ideation
Requirements
Development
Testing
Make use of good practices:
environment (using
conda
)project layout
code formatting (using
black
andflake8
)
Use version control collaboratively:
git
GitHub
branches
pull requests
issues
Test-driven development
The Hypotenuse Problem#
Calculating the hypotenuse
General Design
1 squared function
1 sum function
1 square root function
1 hypotenuse function that uses the functions above
Project Workflow#
Ideally, this is a task to be done in pairs.
Install Git, Anaconda, VScode
Create a GitHub repository + Licence + .gitignore + Readme
Setup GH Action for testing (Python Application)
Clone GH repository in local machines
Brainstorm to define all necessary tasks
List all scenarios/tests
Create project structure (source (name of the package) and test folders)
Setup the environment
Develop the test unit (start with
test_
)Develop the main code
Lint code and tests
Develop some documentation (you can use
autoDocstring - Python Docstring Generator on VS Code
)Update the GitHub
Check the action: is your code linted, is your code passing the tests?
Please note that these ideas are just a starting point - participants will be free to design their project, as long as they respect the main idea and requirements.
Solution#
The swd3-demo
repository is a demonstration of how this project can be solved.
It also includes some additional features:
Source Code
Test with Pytest Framework
Documentation website with Sphinx Framework
Installation file for local install
GitHub Actions for Linting, testing, and create documentation
Release