Contribute to This Project¶
yojenkins
is a Python project that is an on-going effort, slowly adding various features and improvements.
If you would like to contribute, please fork the project, make your changes,
and submit a pull request.
Big Thank You
Any help, ideas, or user testing is much appreciated!
There is definitely work to be done. If you spot an issue you are able to fix, or if you are eying a open issue or feature request, feel free to submit some code.
For guides and information on how to get started and help out, check out the various sections on this page.
Roadmap¶
Note
The roadmap is currently in flux and is yet to be refined
Please see the TODO
and FIXME
kanban board for this projects on GitHub
Forking and Locally Cloning Project¶
The purpose of forking this project GitHub repository is to create a local copy of the project, make changes to it, and submit a pull request of your work into the original repository.
Here is a guide by GitHub on how to fork and clone a project:
Environment Setup¶
The following steps assume that you have successfully cloned the project and are in the root directory of the project.
-
Add the system dependencies, if applicable
Platform Command MacOS and Windows Not needed Ubuntu sudo apt update && apt-get install -y python3-dev python3-pip libasound2-dev
CentOS sudo yum update && yum install -y python3-devel gcc alsa-lib-devel
-
Ensure Python is installed and is a compatible version for this project
python --version
- If it is not, install it: Guide
- Ensure that
pip
is installedpip --version
- If it is not, install it: Guide
- Upgrade tooling and install
pipenv
python -m pip install --upgrade pip setuptools wheel virtualenv pipenv
- With
pipenv
, set up the development virtual environmentpipenv sync --three --dev
- Get into (activate) the virtual environment
pipenv shell
- Test if
yojenkins
starts up without any errorsyojenkins --help
Making Changes¶
git
This project uses the "trunk-based"
git
version control workflow. Each time you make a change, you should create a new branch
and push your changes to the main
branch.
These days you do not have to be a git
terminal master in order to get going with a git
source controlled project. Depending on your preferences, there are many visual UI-based git
clients such as GitHub Desktop,
SourceTree, or even through the Visual Studio Code IDE.
- Create a new
git
branch from themain
branchgit checkout main
git pull
git checkout -b <YOUR NEW GIT BRANCH NAME>
- Update your virtual environment
pipenv sync --three --dev
- Activate/Enter the virtual environment
pipenv shell
- Make your changes to the project ...
- Run the changes
yojenkins
- This works because the current package is marked as editable inPipfile
python yojenkins/__main__py
- This is effectively what is run when runningyojenkins
- Stage the changes
git add .
- Run
pre-commit
(See section below)pre-commit run
- Stage and commit the changes
git commit -m "<YOUR GIT COMMIT MESSAGE>"
- Once all your changes and commits are complete, increment and tag the build version of
yojenkins
bumpversion patch
- Push changes to your development branch
git push origin <YOUR NEW GIT BRANCH NAME>
- On GitHub, open a new pull request into the original repository
Adding New Dependencies¶
Sometimes a new Python dependency is required for the project. In these cases, you can add dependencies as follows:
- Add the dependency to the
Pipfile
- Lock the dependency, updating the
Pipfile.lock
pipenv lock --clear
- Update
requirements.txt
with the new dependency and its version- Typically you can search it inside
Pipfile.lock
- Typically you can search it inside
Caution
Some dependencies are exclusive to a specific Operating system (ie. Windows). Make sure to specify these appropriately as seen with other dependencies.
Formatting and Linting¶
Both, formatting and linting are standardized and automated using pre-commit
.
pre-commit
is a tool that runs a set of predefined tasks and checks on your code when you
run git commit
.
This projects holds a .pre-commit-config.yaml
file, which dictates which tasks are run.
Currently, this file outlines the following tasks and checks:
- Remove any trailing whitespace
- Fix end of the file with a newline
- Check if Python docstrings are listed first
- Check JSON file formatting
- Check YAML file formatting
- Check TOML file formatting
- Check if tests have the right naming
- Python Code Formatting (yapf)
- Python Imports Sorting (isort)
- Python Code Linting (pylint)
You can manually run these checks by running pre-commit run
, or you can add the pre-commit
command to your .git/hooks/pre-commit
file by running pre-commit install
. This adding a
git hook is a good way to make sure your code is formatted and linted before you commit.
Note
pre-commit
will only run on files that have been staged. However, if you want to run
pre-commit
on the entire project, you can run pre-commit run --all-files
Note
Make sure you have the project's virtual environment activated before running the checks.
The workflow for running pre-commit
checks is typically as follows:
- Make and finish up code changes
- Stage the changes with
git add .
- Run
pre-commit run
- Stage any changes made by
pre-commit
- Commit the staged changes with
git commit
Unit Testing¶
Currently, there are no unit tests. This big tech debt is mainly caused by
the the focus so far being on the development of yojenkins
and its various features.
However, the outline of a unit test framework is in place. The directory tests
holds the outline
of a pytest
framework.
Adding unit tests to the various functions, classes, methods, and the CLI tool as a whole is deeply needed.
Documentation¶
This project uses mkdocs
to generate documentation. mkdocs
is a static site generator that is
used to generate documentation for this project. To learn more about mkdocs
, check out its
documentation.
Layout¶
In this project, all work related to documentation is inside the docs
directory as follows:
docs/
|-- site/
|-- source/
|-- index.md
|-- contributing.md
|-- <etc>
|-- mkdocs.yml
site/
is the directory where the documentation will be generated.
Anything inside this directory is not touched by anyone directly.
source/
is the directory where the documentation source files are located.
This directory holds all the files that will be edited and used to generate the documentation.
mkdocs.yml
is the configuration file for mkdocs
. Most content inside this file is
fairly constant except the nav
section, which may changes if a new site is added.
Live Server for Preview¶
While editing and working with the documentation, you may want to preview the documentation
in real time as you change it. mkdocs
offers a live server feature that will automatically
rebuild the documentation when you save a file.
In order to start this live server
- Open a terminal and navigate to the
docs
directory. - Inside
docs
, run the following command:mkdocs serve
- Open a browser and navigate to http://127.0.0.1:8000 to actively view your changes
Building the Documentation¶
The documentation is built using mkdocs
, which will use the source
directory and
the mkdocs.yml
configuration file.
- Open a terminal and navigate to the
docs
directory. - Inside
docs
, run the following command:mkdocs build
- Watch out for any warnings or errors that may need to be fixed.
Note
Currently the documentation is build manually using the mkdocs
command. However, future plans
adding this task to GitHub Actions to automate the build process.
Deploying The Documentation to GitHub Pages¶
Deploying to GitHub Pages is a separate process where mkdocs
will generate the documentation on
its own branch in the yojenkins
repository under branch name gh-pages
.
- Open a terminal and navigate to the
docs
directory. - Inside
docs
, run the following command:mkdocs gh-deploy --site-dir site --verbose --config-file mkdocs.yml
Visual Studio Code Setup (Optional)¶
Here included are some general suggestions for setting up your VS Code environment in order to operate and contribute on this project. The main reason for including this section is to encourage even beginner level developers to hopefully contribute to this project.
Note
This entire section is a mare suggestions. Developers can be picky about their tools and everyone tends to have their own ways of doing things
Extensions¶
- Python - General Python Language Support
- Better TOML - TOML Language Support
- YAML - YAML Language Support
- XML - XML Language Support
- Markdown Preview Enhancements - Live Markdown File Preview
- Git Graph - Clear view of git history
- GitLens - All kinds of useful git tools
- Pylance - Code assistance for Python
- Visual Studio IntelliCode - Code assistance for Visual Studio
- Path Intellisense - Auto-complete for paths in code
- Docker - Manage docker containers within VS Code
VS Code Settings¶
Changing Settings¶
VS Code setting can be changed by editing the settings JSON file.
Note
When adding or removing JSON settings, do not forget to add commas and quotes appropriately as all the other settings are formatted in the JSON.
- User Settings
- Settings applied globally to the user
- To edit:
Ctrl + Shift + P
type:Preferences: Open Settings (JSON)
- Workspace Settings
- Settings applied for a current workspace or project
- To edit:
Ctrl + Shift + P
type:Preferences: Open Workspace Settings (JSON)
Settings to Change¶
- Show
.git
directory in the file tree
"files.exclude": {
"**/.git": false
}
- Increase terminal scroll back history
"terminal.integrated.scrollback": 5000,
- Increase the visibility of scroll bars
"editor.scrollbar.verticalScrollbarSize": 30,
"editor.scrollbar.horizontal": "visible",
"editor.scrollbar.horizontalScrollbarSize": 30,
- Add a Vertical Line at Line Length / Column Position
"editor.rulers": [100],
Contributors¶
- Ismet Handžić: GitHub: @ismet55555