Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build system to prepare for Flatpak release #254

Merged
merged 10 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application
name: Python CI

on:
push:
branches: [ master ]
branches: [master, beta]
pull_request:
branches: [ master ]
branches: [master, beta]

jobs:
build:

runs-on: ubuntu-22.04

ci:
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
os: [ubuntu-22.04]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache pip
python-version: ${{matrix.python-version}}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Set up local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: Cache packages
uses: actions/cache@v4
with:
# This path is specific to ubuntu
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: |
sudo apt install qt6-base-dev libsystemd-dev gcc
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
poetry install
- name: Compile ui, translations and resources
run: ./scripts/build_ui.sh
run: poetry run ./scripts/build_ui.sh
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
poetry run pytest -v
168 changes: 163 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,169 @@
*~
__pycache__
build-test*
build-ui-*
.vscode
yin_yang/build.py
setup.py
c_cpp_properties.json

.idea/
# Taken from https://github.com/github/gitignore/blob/main/Python.gitignore
# 12/18/2023

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
.venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
67 changes: 38 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
![](https://img.shields.io/badge/Build%20with-Python-yellow)
![](https://img.shields.io/github/license/oskarsh/yin-yang)

Auto Night-mode for Linux, it supports popular Desktops like KDE, GNOME, Budgie
Auto Night-mode for Linux, it supports popular Desktops like KDE, GNOME, Budgie
and also themes your favourite editors like VSCode or Atom.

You might also want to take a look at our [**discussions page**](https://github.com/oskarsh/Yin-Yang/discussions), where we talk about the future of the app and other cool stuff!
Expand All @@ -16,53 +16,58 @@ You might also want to take a look at our [**discussions page**](https://github.

## Features

* Changes your themes at certain times or sunrise and sunset
* Supported Desktops:
* GNOME
* Budgie
* KDE Plasma
* Supported applications:
* VSCode, Atom, gedit
* Firefox & Brave
* Kvantum
* Konsole
* OnlyOffice
* and more...
* Miscellaneous:
* Wallpaper change
* Notifications on theme change
* Play a sound
* Ability to run custom scripts
- Changes your themes at certain times or sunrise and sunset
- Supported Desktops:
- GNOME
- Budgie
- KDE Plasma
- Supported applications:
- VSCode, Atom, gedit
- Firefox & Brave
- Kvantum
- Konsole
- OnlyOffice
- and more...
- Miscellaneous:
- Wallpaper change
- Notifications on theme change
- Play a sound
- Ability to run custom scripts

> To see planned features and the development status, visit the [project status page](https://github.com/oskarsh/Yin-Yang/projects?type=classic).
## Installation

### Arch-based distributions
Yin-Yang can be downloaded from AUR as [yin-yang](https://aur.archlinux.org/packages/yin-yang) package.

Yin-Yang can be downloaded from AUR as [yin-yang](https://aur.archlinux.org/packages/yin-yang) package.

### Source
Yin-Yang depends on `python-systemd` and `pyside6` from pypi. `python-systemd` requires you have installed the systemd-headers from your package manager. You also need python development headers (e.g. `python3-devel`).

Yin-Yang depends on `python-systemd` and `pyside6` from pypi. `python-systemd` requires you have installed the systemd-headers from your package manager. You also need python development headers (e.g. `python3-devel`) and the poetry build system for python.

For CentOS, RHEL, and Fedora:

```bash
sudo dnf install gcc systemd-devel python3-devel libnotify
```
sudo dnf install gcc systemd-devel python3-devel libnotify poetry
```

For OpenSUSE:

```bash
sudo zypper refresh
sudo zypper install gcc systemd-devel libnotify
sudo zypper install gcc systemd-devel libnotify python311-poetry
```

For Debian, Ubuntu, etc.

```bash
sudo apt update
sudo apt install libsystemd-dev gcc pkg-config python3-dev libnotify-bin
sudo apt install libsystemd-dev gcc pkg-config python3-dev libnotify-bin python3-poetry
```

Then you can install Yin-Yang in a python virtual environment:

```bash
# bash is necessary to run the source command
bash
Expand All @@ -73,11 +78,15 @@ cd Yin-Yang
./scripts/install.sh
```

For development, skip the install and instead create a venv in your home directory:
For development, skip the install and instead build python using Poetry. A virtual environment will be created for you:

```bash
python -m venv .venv
source .venv/bin/activate # this is for bash, there are similar scripts in the that directory for other shells like fish
pip install -r requirements.txt
# Install dependencies
poetry install --sync
# Load into virtual environment
poetry env use python
# Load Yin-Yang
poetry run python -m yin_yang
```

### Uninstall
Expand All @@ -88,7 +97,7 @@ Run `scripts/uninstall.sh` from a terminal and fill out the password.

Want to help out? Check out the wiki to learn how to contribute translations, plugins and more!

[![Generic badge](https://img.shields.io/badge/Visit-Wiki-BLUE.svg)](<https://github.com/oskarsh/Yin-Yang/wiki>)
[![Generic badge](https://img.shields.io/badge/Visit-Wiki-BLUE.svg)](https://github.com/oskarsh/Yin-Yang/wiki)

## Related or similar projects

Expand Down
Loading