Skip to content

Commit

Permalink
Merge branch 'main' into windows-support
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens authored Mar 4, 2024
2 parents 331af30 + 997f06f commit a301c91
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Typechecks
name: Type checks

on: [push]

Expand All @@ -9,10 +9,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.9
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.12

- name: Install Project
run: make install
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/variants.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Python/VENV/Installer Variants

on: [push]

jobs:
build:
strategy:
fail-fast: false
matrix:
python-version:
# we test on lowest and highest supported versions
- "3.8"
- "3.12"
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: VENV to be created with pip
run: |
make VENV_ENABLED=true VENV_CREATE=true PYTHON_PACKAGE_INSTALLER=pip test
make clean
- name: VENV to be created with uv to be installed
run: |
make VENV_ENABLED=true VENV_CREATE=true PYTHON_PACKAGE_INSTALLER=uv MXENV_UV_GLOBAL=false test
make clean
- name: VENV to be created with uv globally pre-installed
run: |
pip install uv
make VENV_ENABLED=true VENV_CREATE=true PYTHON_PACKAGE_INSTALLER=uv MXENV_UV_GLOBAL=true test
make clean
pip uninstall -y uv
- name: VENV pre-installed with pip
run: |
python -m venv existingvenv
make VENV_ENABLED=true VENV_CREATE=false VENV_FOLDER=existingvenv PYTHON_PACKAGE_INSTALLER=pip test
make clean
rm -rf existingvenv
- name: VENV pre-installed with uv to be installed
run: |
python -m venv existingvenv
make VENV_ENABLED=true VENV_CREATE=false VENV_FOLDER=existingvenv PYTHON_PACKAGE_INSTALLER=uv MXENV_UV_GLOBAL=false test
make clean
rm -rf existingvenv
- name: VENV pre-installed with uv globally pre-installed
run: |
python -m venv existingvenv
pip install uv
make VENV_ENABLED=true VENV_CREATE=false VENV_FOLDER=existingvenv PYTHON_PACKAGE_INSTALLER=uv MXENV_UV_GLOBAL=true test
make clean
pip uninstall -y uv
rm -rf existingvenv
- name: Global Python with pip
run: |
make VENV_ENABLED=false VENV_CREATE=false PYTHON_PACKAGE_INSTALLER=pip test
make clean
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ __pycache__
/.mypy_cache/
/.pytest_cache/
/.ruff_cache/
/.venv/
/.vscode/
/build/
/constraints-mxdev.txt
/dist/
/docs/html/
/requirements-mxdev.txt
/venv/
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@

- Add phony target `cookiecutter` to be able to just install it.

- Add feature to pass options to zest-releaser commands.

- Change default for venv folder to `.venv`, since this is established practice.

## 1.0a3 (2024-02-06)

- Add `typecheck` target and use it for mypy instead of `check` target.
Expand Down
35 changes: 29 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ VENV_CREATE?=true
# target folder for the virtual environment. If `VENV_ENABLED` is `true` and
# `VENV_CREATE` is false it is expected to point to an existing virtual
# environment. If `VENV_ENABLED` is `false` it is ignored.
# Default: venv
VENV_FOLDER?=venv
# Default: .venv
VENV_FOLDER?=.venv

# mxdev to install in virtual environment.
# Default: mxdev
Expand Down Expand Up @@ -166,6 +166,24 @@ MYPY_SRC?=src
# Default: types-setuptools
MYPY_REQUIREMENTS?=types-setuptools types-docutils

## applications.zest-releaser

# Options to pass to zest.releaser prerelease command.
# No default value.
ZEST_RELEASER_PRERELEASE_OPTIONS?=

# Options to pass to zest.releaser release command.
# No default value.
ZEST_RELEASER_RELEASE_OPTIONS?=

# Options to pass to zest.releaser postrelease command.
# No default value.
ZEST_RELEASER_POSTRELEASE_OPTIONS?=

# Options to pass to zest.releaser fullrelease command.
# No default value.
ZEST_RELEASER_FULLRELEASE_OPTIONS?=

##############################################################################
# END SETTINGS - DO NOT EDIT BELOW THIS LINE
##############################################################################
Expand Down Expand Up @@ -220,6 +238,11 @@ ifeq ($(shell [[ "$(VENV_ENABLED)" == "true" && "$(VENV_FOLDER)" == "" ]] && ech
$(error "VENV_FOLDER must be configured if VENV_ENABLED is true")
endif

# Check if global python is used with uv (this is not supported by uv)
ifeq ("$(VENV_ENABLED)$(PYTHON_PACKAGE_INSTALLER)","falseuv")
$(error "Package installer uv does not work with a global Python interpreter.")
endif

# Determine the executable path
ifeq ("$(VENV_ENABLED)", "true")
export PATH:=$(abspath $(VENV_FOLDER))/bin:$(PATH)
Expand Down Expand Up @@ -592,22 +615,22 @@ $(ZEST_RELEASER_TARGET): $(MXENV_TARGET)
.PHONY: zest-releaser-prerelease
zest-releaser-prerelease: $(ZEST_RELEASER_TARGET)
@echo "Run prerelease"
@prerelease
@prerelease $(ZEST_RELEASER_PRERELEASE_OPTIONS)

.PHONY: zest-releaser-release
zest-releaser-release: $(ZEST_RELEASER_TARGET)
@echo "Run release"
@release
@release $(ZEST_RELEASER_RELEASE_OPTIONS)

.PHONY: zest-releaser-postrelease
zest-releaser-postrelease: $(ZEST_RELEASER_TARGET)
@echo "Run postrelease"
@postrelease
@postrelease $(ZEST_RELEASER_POSTRELEASE_OPTIONS)

.PHONY: zest-releaser-fullrelease
zest-releaser-fullrelease: $(ZEST_RELEASER_TARGET)
@echo "Run fullrelease"
@fullrelease
@fullrelease $(ZEST_RELEASER_FULLRELEASE_OPTIONS)

.PHONY: zest-releaser-dirty
zest-releaser-dirty:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ It targets the development environments for Python packages but may be used outs
[![Tests](https://github.com/mxstack/mxmake/actions/workflows/test.yml/badge.svg)](https://github.com/mxstack/mxmake/actions/workflows/test.yml)
[![Typecheck](https://github.com/mxstack/mxmake/actions/workflows/typecheck.yml/badge.svg)](https://github.com/mxstack/mxmake/actions/workflows/typecheck.yml)
[![Lint](https://github.com/mxstack/mxmake/actions/workflows/lint.yml/badge.svg)](https://github.com/mxstack/mxmake/actions/workflows/lint.yml)
[![Variants](https://github.com/mxstack/mxmake/actions/workflows/variants.yml/badge.svg)](https://github.com/mxstack/mxmake/actions/workflows/variants.yml)

# Documentation

Expand Down
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "mxmake"
description = "Generates a Python project-specific Makefile by using an extensible library of configurable Makefile snippets."
version = "1.0a4.dev0"
keywords = ["development", "deployment", "environment"]
keywords = ["development", "deployment", "make"]
authors = [
{name = "MX Stack Developers", email = "[email protected]" }
]
Expand All @@ -15,11 +15,11 @@ classifiers = [
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"Jinja2",
Expand All @@ -36,7 +36,7 @@ test = ["zope.testrunner"]
Homepage = "https://github.com/mxstack/mxmake"
Documentation = "https://mxstack.github.io/mxmake"
"Bug Reports" = "https://github.com/mxstack/mxmake/issues"
Source = "https://github.com/mxstack/mxmake"
Source = "https://github.com/mxstack/mxmake/tree/main"

[project.scripts]
mxmake = "mxmake.main:main"
Expand All @@ -61,9 +61,6 @@ build-backend = "setuptools.build_meta"
[tool.distutils.bdist_wheel]
universal = true

[tool.setuptools]
zip-safe = false

[tool.setuptools.dynamic]
readme = {file = ["README.md", "CHANGES.md", "LICENSE.md"], content-type = "text/markdown"}

Expand All @@ -82,3 +79,4 @@ lines_after_imports = 2

[tool.mypy]
ignore_missing_imports = true
python_version = 3.8
11 changes: 8 additions & 3 deletions src/mxmake/tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def test_Makefile(self, tempdir):
"core.mxenv.MXENV_UV_GLOBAL": "false",
"core.mxenv.VENV_ENABLED": "true",
"core.mxenv.VENV_CREATE": "true",
"core.mxenv.VENV_FOLDER": "venv",
"core.mxenv.VENV_FOLDER": ".venv",
"core.mxenv.MXDEV": "mxdev",
"core.mxenv.MXMAKE": "mxmake",
}
Expand Down Expand Up @@ -617,8 +617,8 @@ def test_Makefile(self, tempdir):
# target folder for the virtual environment. If `VENV_ENABLED` is `true` and
# `VENV_CREATE` is false it is expected to point to an existing virtual
# environment. If `VENV_ENABLED` is `false` it is ignored.
# Default: venv
VENV_FOLDER?=venv
# Default: .venv
VENV_FOLDER?=.venv
# mxdev to install in virtual environment.
# Default: mxdev
Expand Down Expand Up @@ -677,6 +677,11 @@ def test_Makefile(self, tempdir):
$(error "VENV_FOLDER must be configured if VENV_ENABLED is true")
endif
# Check if global python is used with uv (this is not supported by uv)
ifeq ("$(VENV_ENABLED)$(PYTHON_PACKAGE_INSTALLER)","falseuv")
$(error "Package installer uv does not work with a global Python interpreter.")
endif
# Determine the executable path
ifeq ("$(VENV_ENABLED)", "true")
export PATH:=$(abspath $(VENV_FOLDER))/bin:$(PATH)
Expand Down
24 changes: 20 additions & 4 deletions src/mxmake/topics/applications/zest-releaser.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,31 @@
#:[target.zest-releaser-prerelease]
#:description = Run prerelease command of zest.releaser
#:
#:[setting.ZEST_RELEASER_PRERELEASE_OPTIONS]
#:description = Options to pass to zest.releaser prerelease command.
#:default =
#:
#:[target.zest-releaser-release]
#:description = Run release command of zest.releaser
#:
#:[setting.ZEST_RELEASER_RELEASE_OPTIONS]
#:description = Options to pass to zest.releaser release command.
#:default =
#:
#:[target.zest-releaser-postrelease]
#:description = Run postrelease command of zest.releaser
#:
#:[setting.ZEST_RELEASER_POSTRELEASE_OPTIONS]
#:description = Options to pass to zest.releaser postrelease command.
#:default =
#:
#:[target.zest-releaser-fullrelease]
#:description = Run fullrelease command of zest.releaser
#:
#:[setting.ZEST_RELEASER_FULLRELEASE_OPTIONS]
#:description = Options to pass to zest.releaser fullrelease command.
#:default =
#:
#:[target.zest-releaser-dirty]
#:description = Marks zest.releaser dirty
#:
Expand All @@ -35,22 +51,22 @@ $(ZEST_RELEASER_TARGET): $(MXENV_TARGET)
.PHONY: zest-releaser-prerelease
zest-releaser-prerelease: $(ZEST_RELEASER_TARGET)
@echo "Run prerelease"
@prerelease
@prerelease $(ZEST_RELEASER_PRERELEASE_OPTIONS)

.PHONY: zest-releaser-release
zest-releaser-release: $(ZEST_RELEASER_TARGET)
@echo "Run release"
@release
@release $(ZEST_RELEASER_RELEASE_OPTIONS)

.PHONY: zest-releaser-postrelease
zest-releaser-postrelease: $(ZEST_RELEASER_TARGET)
@echo "Run postrelease"
@postrelease
@postrelease $(ZEST_RELEASER_POSTRELEASE_OPTIONS)

.PHONY: zest-releaser-fullrelease
zest-releaser-fullrelease: $(ZEST_RELEASER_TARGET)
@echo "Run fullrelease"
@fullrelease
@fullrelease $(ZEST_RELEASER_FULLRELEASE_OPTIONS)

.PHONY: zest-releaser-dirty
zest-releaser-dirty:
Expand Down
7 changes: 6 additions & 1 deletion src/mxmake/topics/core/mxenv.mk
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#: target folder for the virtual environment. If `VENV_ENABLED` is `true` and
#: `VENV_CREATE` is false it is expected to point to an existing virtual
#: environment. If `VENV_ENABLED` is `false` it is ignored.
#:default = venv
#:default = .venv
#:
#:[setting.MXDEV]
#:description = mxdev to install in virtual environment.
Expand Down Expand Up @@ -91,6 +91,11 @@ ifeq ($(shell [[ "$(VENV_ENABLED)" == "true" && "$(VENV_FOLDER)" == "" ]] && ech
$(error "VENV_FOLDER must be configured if VENV_ENABLED is true")
endif

# Check if global python is used with uv (this is not supported by uv)
ifeq ("$(VENV_ENABLED)$(PYTHON_PACKAGE_INSTALLER)","falseuv")
$(error "Package installer uv does not work with a global Python interpreter.")
endif

# Determine the executable path
ifeq ("$(VENV_ENABLED)", "true")
export PATH:=$(abspath $(VENV_FOLDER))/bin:$(PATH)
Expand Down

0 comments on commit a301c91

Please sign in to comment.