Skip to content

Commit

Permalink
Switch build system to flit.
Browse files Browse the repository at this point in the history
  • Loading branch information
fishinthecalculator committed Oct 26, 2024
1 parent 9f4c7e8 commit b600bac
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 467 deletions.
29 changes: 15 additions & 14 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
if has guix; then
GUIX_PROFILE="${PWD}/.guix-root"
rm -f "$GUIX_PROFILE"
use guix git-cal python-wrapper poetry pre-commit
use guix git-cal python-wrapper python-virtualenv python-flit python-keyring
else
venv_dir="${PWD}/.venv"
export FLIT_INSTALL_PYTHON="${venv_dir}/bin/python"

# Add development scripts to PATH
PATH_add "$(pwd)/scripts"

venv_dir=".venv"

if [ ! -e "$venv_dir/bin/python" ] ; then
if [ ! -e "$FLIT_INSTALL_PYTHON" ] ; then
rm -rvf "$venv_dir"
pre-commit uninstall
fi
if [ ! -d "$venv_dir" ] ; then
poetry install
pre-commit install
virtualenv -p `which python3` "$venv_dir"
flit install
fi
fi

# Add development scripts to PATH
PATH_add "$(pwd)/scripts"

if has git-cal; then
clear
git-cal --author="$(git config user.name)"
fi

cat << EOF
cat << EOF
The 'scripts' directory has been added to your PATH: you can now invoke scripts without typing the relative path.
EOF

fi
EOF
39 changes: 22 additions & 17 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,39 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
poetry-version: ["1.1.12", "1.7.0"]
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install flit and virtualenv
run: |
pip install flit virtualenv
- name: Setup a local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
virtualenv .venv
# - uses: actions/cache@v3
# name: Define a cache for the virtual environment based on the dependencies lock file
# with:
# path: ./.venv
# key: venv-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
poetry install
. ./.venv/bin/activate
export FLIT_INSTALL_PYTHON="./.venv/bin/python"
flit install
- name: Lint with flake8
run: |
. ./.venv/bin/activate
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --exclude .venv --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --exclude .venv --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --exclude .venv --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 . --exclude .venv --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build wheel
run: |
. ./.venv/bin/activate
export FLIT_INSTALL_PYTHON="./.venv/bin/python"
flit build
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.pypirc
.idea
.venv
*.pyc
__pycache__
dist
.vscode
.vscode
4 changes: 2 additions & 2 deletions .guix/modules/ocui.scm
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
(list
;; There are no unit tests currently.
#:tests? #f))
(native-inputs (list poetry
python-debugpy
(native-inputs (list python-debugpy
python-flake8
python-flit
python-textual-dev))
(propagated-inputs (list python-appdirs
python-textual-0.41
Expand Down
11 changes: 11 additions & 0 deletions ocui/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
ocui is a terminal user interface to facilitate the most common tasks around
OCI containers running on a single host. You can create, start and kill
containers with few keystrokes, as well as look at logs in real time, or
inspect images.
ocui continually watches the system for changes and offers adequate commands
to interact with the system resources.
"""

__version__ = "0.1.0"
Loading

0 comments on commit b600bac

Please sign in to comment.