New Project Checklist
Steps to follow when setting up a new project in this course.
Java
New Project
- Clone empty GitHub repository into
java
folder:
git clone <url> java
curl -s "https://get.sdkman.io" | bash
- Close and Reopen Terminal
- Install Gradle
sdk install gradle 7.6
- Change directory to
java
folder:
cd java
- Initialize Gradle Project
gradle init
Recommended options:
1. Type of project - 2: application
1. Implementation language - 3: Java
1. Split functionality across multiple subprojects - 1: no - only one application project
1. Build script DSL - 1: Groovy
1. Generate build using new APIs and behavior - no
1. Test Framework - 4: JUnit Jupiter
1. Project name - <name>
1. Source package - <name>
7. Add JaCoCo Plugin to build.gradle
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
// JaCoCo plugin for code coverage
id 'jacoco'
}
// ... rest of file here
// Configure Jacoco plugin
test {
finalizedBy jacocoTestReport // report is always generated after tests run
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/reports/jacoco")
}
}
- Configure JavaDoc in
build.gradle
// .. rest of file here
// Add tests to Javadoc
javadoc {
classpath += project.sourceSets.test.compileClasspath
source += project.sourceSets.test.allJava
}
- Add Checkstyle to
build.gradle
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
// JaCoCo plugin for code coverage
id 'jacoco'
// Checkstyle plugin for linting
id 'checkstyle'
}
// ... rest of file here
// Force Checkstyle to be more current version
checkstyle {
toolVersion '10.6.0'
}
- Store Google Checkstyle XML at
config/checkstyle/checkstyle.xml
- Optionally update
Indentation
section to match Codio values:
- Optionally update
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="4"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="8"/>
<property name="lineWrappingIndentation" value="8"/>
<property name="arrayInitIndent" value="4"/>
</module>
- Add additional libraries to
build.gradle
as needed (Hamcrest, JUnit Parameters, etc.)
Existing Project or Example Project
- Clone existing project into
java
folder:
git clone <url> java
curl -s "https://get.sdkman.io" | bash
- Close and Reopen Terminal
- Install Gradle
sdk install gradle 7.6
- Change directory to
java
folder:
cd java
- Compile and Test Existing Project
gradle run
gradle check
Python
New Project
- Clone empty GitHub repository into
python
folder:
git clone <url> python
- Change directory to
python
folder:
cd python
- Check Python Version:
python3 --version
- Create
requirements.txt
file
coverage
flake8<5.0.0
flake8-docstrings
flake8-html
lxml
mypy
pdoc3
pep8-naming
pyhamcrest
pytest
pytest-html
tox
- Install Python Libraries
pip3 install -r requirements.txt
- Create
tox.ini
file
[tox]
envlist = py39
skipsdist = True
[testenv]
deps = -rrequirements.txt
ignore_errors = true
commands = python3 -m mypy -p src --html-report reports/mypy
python3 -m coverage run --source src -m pytest --html=reports/pytest/index.html
python3 -m coverage html -d reports/coverage
python3 -m flake8 --docstring-convention google --format=html --htmldir=reports/flake
python3 -m pdoc --html --force --output-dir reports/doc .
- Create
.gitignore
file
__pycache__/
.tox
reports/
.coverage
- Create
src
andtest
directories
mkdir src
mkdir test
- Add empty
conftest.py
tosrc
directory - Add empty
__init__.py
tosrc
andtest
directory to make them packages - Create additional packages as needed
- Add
__main__.py
tosrc
and include code to call main method
Existing Project
- Clone existing project into
python
folder:
git clone <url> python
- Change directory to
python
folder:
cd python
- Check Python Version:
python3 --version
- Confirm Python Version matches the
envlist
entry intox.ini
- Python 3.6.x -
py36
- Python 3.9.x -
py39
- Python 3.10.x -
py310
- Python 3.6.x -
- Update Packages in
requirements.txt
- Lock
flake8
to version before 5.0:flake8<5.0.0
- Lock
- Install Python Libraries
pip3 install -r requirements.txt
- Run Existing Project
python3 -m src
or (For flask projects)
python3 -m flask run
- Run
tox
using Recreate Option To Test Existing Project
tox -r
GitHub Commit and Release
- Git Commit and Push
git add .
git commit -m "Message"
git push
- On GitHub Site, create Release