Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
62c24f5
fix: dummy change to trigger please release patch bump
runemalm Jul 11, 2025
81c7135
Merge master.
runemalm Jul 15, 2025
8f66244
chore(ci): add cz toml file
runemalm Jul 15, 2025
4e1059a
chore(ci): replace bump version package with custom script
runemalm Jul 15, 2025
ae3f6e2
chore: install typing-extensions missing after uninstalled package
runemalm Jul 15, 2025
a16a2f1
feat: add support for adding value object intents
runemalm Jul 15, 2025
27b9833
Merge branch 'master' into develop
runemalm Jul 15, 2025
7ce2f15
chore: add missing permission to release workflow
runemalm Jul 15, 2025
d9e6383
Merge branch 'master' into develop
runemalm Jul 15, 2025
0c3a73b
Merge branch 'master' into develop
runemalm Jul 15, 2025
49f739f
chore: fix bump_version.py script (look at all commits since last rel…
runemalm Jul 15, 2025
37c26cf
chore: fix badge in readme
runemalm Jul 15, 2025
2825dbd
Add target to test install released codius package with a specific py…
runemalm Jul 19, 2025
8a0be1b
Move makefile targets.
runemalm Jul 19, 2025
f8a38d0
chore: replace pipenv with poetry
runemalm Jul 19, 2025
806799a
chore: regenerate poetry.lock after pyproject.toml changes
runemalm Jul 19, 2025
f9e12fd
chore: install missing pyfakefs dev package
runemalm Jul 19, 2025
7a7a88b
chore: sync version to pyproject.toml on bump
runemalm Jul 20, 2025
acf9441
chore: fix dependency issues
runemalm Jul 20, 2025
6a5a263
chore: move plan step example json to plan_examples.py
runemalm Jul 20, 2025
3c5fa92
fix: deletion flow lead to crash
runemalm Jul 20, 2025
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
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,35 @@ jobs:
with:
python-version: '3.12'

- name: Install pipenv and dependencies
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install pipenv
pipenv install --dev
pip install poetry

- name: Auto bump version
- name: Install dependencies
run: poetry install --with dev

- name: Bump version
id: bump
run: |
python scripts/bump_version.py
VERSION=$(grep '__version__' src/codius/version.py | cut -d'"' -f2)
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Sync version to pyproject.toml
run: |
python scripts/sync_version.py

- name: Commit and push version bump
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add src/codius/version.py
git add src/codius/version.py pyproject.toml
git commit -m "chore(release): bump version to ${{ steps.bump.outputs.version }}"
git push

- name: Build package
run: pipenv run python -m build
run: poetry build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/run-unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install pipenv
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install pipenv
pip install poetry

- name: Install dependencies
run: pipenv install --dev --deploy
run: poetry install --with dev

- name: Run unittests
run: |
mkdir -p reports
PYTHONPATH=./src:./tests pipenv run pytest ./tests/unit --junitxml=reports/report.xml
PYTHONPATH=./src:./tests poetry run pytest ./tests/unit --junitxml=reports/report.xml

- name: Upload JUnit report
uses: actions/upload-artifact@v4
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ __pycache__/
env/
venv/
ENV/
env.bak/
venv.bak/

# Logs
*.log
Expand Down
222 changes: 100 additions & 122 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,99 +30,60 @@ help:

.PHONY: test
test: ## run test suite
PYTHONPATH=$(SRC):$(TESTS) pipenv run pytest $(TESTS)

##########################################################################
# DOCS
##########################################################################

.PHONY: sphinx-quickstart
sphinx-quickstart: ## run the sphinx quickstart
pipenv run docker run -it --rm -v $(PWD)/docs:/docs sphinxdoc/sphinx sphinx-quickstart

.PHONY: sphinx-html
sphinx-html: ## build the sphinx html
pipenv run make -C docs html

.PHONY: sphinx-rebuild
sphinx-rebuild: ## re-build the sphinx docs
cd $(DOCS) && \
pipenv run make clean && pipenv run make html

.PHONY: sphinx-autobuild
sphinx-autobuild: ## activate autobuild of docs
cd $(DOCS) && \
pipenv run sphinx-autobuild . _build/html --watch $(SRC)

################################################################################
# WORKFLOWS
################################################################################
PYTHONPATH=$(SRC):$(TESTS) poetry run pytest $(TESTS)

.PHONY: test-all-versions
test-all-versions: ## Run tests across all supported Python versions with pyenv + pipenv
test-all-versions: ## Run tests across all supported Python versions with pyenv + poetry
@for PY in 3.9 3.10 3.11 3.12; do \
echo "\n>>> Running tests with Python $$PY"; \
PYTHON_BIN=$$(pyenv prefix $$PY)/bin/python; \
VENV_DIR=.venv-$$PY; \
$$PYTHON_BIN -m venv $$VENV_DIR && \
$$VENV_DIR/bin/pip install --upgrade pip && \
$$VENV_DIR/bin/pip install pipenv && \
cd $(PWD) && \
$$VENV_DIR/bin/pipenv install --dev --deploy && \
PYTHONPATH=./src:./tests $$VENV_DIR/bin/pipenv run pytest ./tests/unit || exit 1; \
rm -rf $$VENV_DIR; \
. $$VENV_DIR/bin/activate && \
pip install --upgrade pip && \
pip install poetry && \
poetry install --with dev && \
PYTHONPATH=./src:./tests poetry run pytest ./tests || exit 1; \
deactivate && rm -rf $$VENV_DIR; \
done

.PHONY: test-version
test-version: ## Run tests with a specific Python version via pyenv + pipenv. Usage: make test-version PY=3.10
test-version: ## Run tests with a specific Python version via pyenv + poetry. Usage: make test-version PY=3.10
@if [ -z "$(PY)" ]; then \
echo "❌ PY is required. Usage: make test-version PY=3.10"; exit 1; \
fi
PYTHON_BIN=$$(pyenv prefix $(PY))/bin/python; \
VENV_DIR=.venv-$(PY); \
$$PYTHON_BIN -m venv $$VENV_DIR && \
$$VENV_DIR/bin/pip install --upgrade pip && \
$$VENV_DIR/bin/pip install pipenv && \
cd $(PWD) && \
$$VENV_DIR/bin/pipenv install --dev --deploy && \
PYTHONPATH=./src:./tests $$VENV_DIR/bin/pipenv run pytest ./tests/unit || exit 1; \
rm -rf $$VENV_DIR

.PHONY: release-please-pr-dry-run
release-please-pr-dry-run: ## Preview next release version and change log using release-please
release-please release-pr \
--config-file release-please-config.json \
--manifest-file .release-please-manifest.json \
--token=${GITHUB_TOKEN} \
--repo-url=runemalm/codius-cli \
--target-branch=master \
--release-type=python \
--debug \
--dry-run
. $$VENV_DIR/bin/activate && \
pip install --upgrade pip && \
pip install poetry && \
poetry install --with dev && \
PYTHONPATH=./src:./tests poetry run pytest ./tests || exit 1; \
deactivate && rm -rf $$VENV_DIR

################################################################################
# RELEASE (LOCALLY)
# RELEASE
################################################################################

.PHONY: build
build: ## build the python package
pipenv run python setup.py sdist bdist_wheel
poetry build

.PHONY: clean
clean: ## clean the build
python setup.py clean
rm -rf build dist
find . -type f -name '*.py[co]' -delete
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type d -name '*.egg-info' -exec rm -rf {} +

.PHONY: upload-test
upload-test: ## upload package to testpypi repository
TWINE_USERNAME=$(PYPI_USERNAME_TEST) TWINE_PASSWORD=$(PYPI_PASSWORD_TEST) pipenv run twine upload --repository testpypi --skip-existing --repository-url https://test.pypi.org/legacy/ dist/*
upload-test: ## upload package to test.pypi.org
poetry publish --repository testpypi

.PHONY: upload
upload: ## upload package to pypi repository
TWINE_USERNAME=$(PYPI_USERNAME) TWINE_PASSWORD=$(PYPI_PASSWORD) pipenv run twine upload --skip-existing dist/*
upload: ## upload package to PyPI
poetry publish

.PHONY: act-release
act-release: ## Run release workflow locally with act
Expand All @@ -131,97 +92,114 @@ act-release: ## Run release workflow locally with act
.PHONY: test-install-all-py
test-install-all-py:
@for PY in 3.9 3.10 3.11 3.12; do \
echo "\n>>> Testing with Python $$PY"; \
PYTHON_BIN=$$(pyenv prefix $$PY)/bin/python; \
VENV_DIR=.venv-$$PY; \
$$PYTHON_BIN -m venv $$VENV_DIR && \
$$VENV_DIR/bin/pip install --upgrade pip && \
$$VENV_DIR/bin/pip install --index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
codius && \
mkdir -p /tmp/test-codius && \
$$VENV_DIR/bin/codius /tmp/test-codius --version || echo "❌ Failed to run codius with Python $$PY"; \
rm -rf $$VENV_DIR /tmp/test-codius; \
( \
set -e; \
echo "\n>>> Testing with Python $$PY"; \
PYTHON_BIN=$$(pyenv prefix $$PY)/bin/python; \
VENV_DIR=.venv-$$PY; \
TRAP_CMD="rm -rf $$VENV_DIR /tmp/test-codius"; \
trap "$$TRAP_CMD" EXIT; \
$$PYTHON_BIN -m venv $$VENV_DIR; \
$$VENV_DIR/bin/pip install --upgrade pip; \
$$VENV_DIR/bin/pip install --index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
codius; \
mkdir -p /tmp/test-codius; \
$$VENV_DIR/bin/codius /tmp/test-codius --version; \
) || exit 1; \
done

.PHONY: test-install-version
test-install-version: ## Test installing package from TestPyPI with a specific Python version. Usage: make test-install-version PY...
@if [ -z "$(PY)" ]; then \
echo "❌ PY is required. Usage: make test-install-version PY=3.10"; exit 1; \
fi
PYTHON_BIN=$$(pyenv prefix $(PY))/bin/python; \
VENV_DIR=.venv-$(PY); \
$$PYTHON_BIN -m venv $$VENV_DIR && \
$$VENV_DIR/bin/pip install --upgrade pip && \
$$VENV_DIR/bin/pip install --index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
codius && \
mkdir -p /tmp/test-codius && \
$$VENV_DIR/bin/codius /tmp/test-codius --version || echo "❌ Failed to run codius with Python $(PY)"; \
rm -rf $$VENV_DIR /tmp/test-codius

.PHONY: bump-version
bump-version: ## Bump version and update pyproject.toml
python scripts/bump_version.py
make sync-version

.PHONY: sync-version
sync-version: ## Sync version.py to pyproject.toml
python scripts/sync_version.py

################################################################################
# PRE-COMMIT HOOKS
################################################################################

.PHONY: black
black: ## format code using black
pipenv run black --line-length 88 $(SRC)
poetry run black --line-length 88 $(SRC)

.PHONY: black-check
black-check: ## check code don't violate black formatting rules
pipenv run black --check --line-length 88 $(SRC)
poetry run black --check --line-length 88 $(SRC)

.PHONY: flake
flake: ## lint code with flake
pipenv run flake8 --max-line-length=200 $(SRC)
poetry run flake8 --max-line-length=200 $(SRC)

.PHONY: pre-commit-install
pre-commit-install: ## install the pre-commit git hook
pipenv run pre-commit install
poetry run pre-commit install

.PHONY: pre-commit-run
pre-commit-run: ## run the pre-commit hooks
pipenv run pre-commit run --all-files
poetry run pre-commit run --all-files

################################################################################
# PIPENV
# POETRY
################################################################################

.PHONY: pipenv-rm
pipenv-rm: ## remove the virtual environment
pipenv --rm
.PHONY: poetry-install-with-dev
poetry-install-with-dev: ## Install all dependencies including dev group
poetry install --with dev

.PHONY: pipenv-install
pipenv-install: ## setup the virtual environment
pipenv install --dev
.PHONY: poetry-env-remove
poetry-env-remove: ## Remove the Poetry virtual environment
poetry env info --path >/dev/null 2>&1 && poetry env remove python || echo "No Poetry environment found."

.PHONY: pipenv-install-package
pipenv-install-package: ## install a package (uses PACKAGE)
pipenv install $(PACKAGE)
.PHONY: poetry-shell
poetry-shell: ## Activate the Poetry virtual environment
poetry shell

.PHONY: pipenv-install-package-dev
pipenv-install-package-dev: ## install a dev package (uses PACKAGE)
pipenv install --dev $(PACKAGE)
.PHONY: poetry-env-info-path
poetry-env-info-path: ## Show the path to the Poetry virtual environment
poetry env info --path

.PHONY: pipenv-graph
pipenv-graph: ## Check installed packages
pipenv graph

.PHONY: pipenv-generate-requirements
pipenv-generate-requirements: ## Check a requirements.txt
pipenv lock -r > requirements.txt

.PHONY: pipenv-shell
pipenv-shell: ## Activate the virtual environment
pipenv shell

.PHONY: pipenv-venv
pipenv-venv: ## Show the path to the venv
pipenv --venv

.PHONY: pipenv-lock-and-install
pipenv-lock-and-install: ## Lock the pipfile and install (after updating Pipfile)
pipenv lock && \
pipenv install --dev

.PHONY: pipenv-pip-freeze
pipenv-pip-freeze: ## Run pip freeze in the virtual environment
pipenv run pip freeze
.PHONY: poetry-add
poetry-add: ## Install a runtime package (uses PACKAGE)
@if [ -z "$(PACKAGE)" ]; then \
echo "❌ PACKAGE is required. Usage: make poetry-add PACKAGE=your-package"; exit 1; \
fi
poetry add $(PACKAGE)

.PHONY: pipenv-sync-setup
pipenv-sync-setup: ## Update install_requires in setup.py from Pipfile
pipenv run python scripts/sync_setup.py --sync Pipfile setup.py
.PHONY: poetry-add-dev
poetry-add-dev: ## Install a dev package (uses PACKAGE)
@if [ -z "$(PACKAGE)" ]; then \
echo "❌ PACKAGE is required. Usage: make poetry-add-dev PACKAGE=your-package"; exit 1; \
fi
poetry add --group dev $(PACKAGE)

.PHONY: pipenv-sync-setup-dry-run
pipenv-sync-setup-dry-run: ## Dry run: preview install_requires from Pipfile
pipenv run python scripts/sync_setup.py --dry-run Pipfile setup.py
.PHONY: poetry-show-tree
poetry-show-tree: ## Show dependency tree
poetry show --tree

.PHONY: pipenv-install-cli-editable
pipenv-install-cli-editable: ## Install the package in editable mode (for CLI use)
pipenv run pip install -e .
.PHONY: poetry-export-requirements-txt
poetry-export-requirements-txt: ## Export requirements.txt (for Docker or CI)
poetry export --without-hashes --format=requirements.txt > requirements.txt

.PHONY: poetry-show-codius
poetry-show-codius: ## Show installed details for the codius package
poetry run pip show -f codius || echo "❌ codius is not installed yet. Run 'make poetry-install'"
Loading