Skip to content

moving from pdm to poetry #214

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

Merged
merged 15 commits into from
Feb 2, 2025
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
25 changes: 25 additions & 0 deletions .build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
from os import chdir, getenv, system
from pathlib import Path
from shutil import copytree


def build_ui():
print(f"[+] Running custom build hook in {Path(__file__)}")

# if the DEVBOX_PROJECT_ROOT exists, it'll be returned as a string, make sure it's a Path object
root = Path(getenv("DEVBOX_PROJECT_ROOT", Path.cwd()))

Path(root / "mmpm" / "ui").mkdir(exist_ok=True, parents=True)
chdir(root / "ui")

system("bun install --legacy-peer-deps")
system("./node_modules/@angular/cli/bin/ng.js build --configuration production --output-hashing none --base-href /")

chdir(root)

copytree(root / "ui" / "build", root / "mmpm" / "ui", dirs_exist_ok=True)


if __name__ == "__main__":
build_ui()
59 changes: 34 additions & 25 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,40 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Virtualenv
run: |
python -m venv ${{ github.workspace }}/.venv
source ${{ github.workspace }}/.venv/bin/activate
- name: Cache Python Dependencies
uses: actions/cache@v3
with:
python-version: ${{ matrix.python-version }}
path: |
~/.cache/pip
${{ github.workspace }}/.venv
key: ${{ runner.os }}-python-deps-${{ hashFiles('**/pdm.lock') }}
key: python-deps-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-deps-${{ hashFiles('**/pdm.lock') }}
python-deps-${{ hashFiles('**/poetry.lock') }}
- name: Python Dependencies
run: |
python -m pip install pdm
pdm install
source ${{ github.workspace }}/.venv/bin/activate
python -m pip install poetry
poetry install --no-interaction
- name: Python Tests
run: |
pdm run lint
pdm run mypy
pdm run test
pdm run report
source ${{ github.workspace }}/.venv/bin/activate
pylint mmpm
mypy mmpm
coverage run -m pytest test
coverage report
- name: Python Build
run: |
pdm build
source ${{ github.workspace }}/.venv/bin/activate
pylint mmpm
poetry build
- name: Install Test
run: |
pdm install
source ${{ github.workspace }}/.venv/bin/activate
poetry install --no-interaction
options=("version" "--help" "completion --help" "db --help" "guided-setup --help" "install --help" "list --help" "logs --help" "mm-ctl --help" "mm-pkg --help" "open --help" "remove --help" "search --help" "show --help" "ui --help" "update --help" "upgrade --help" "version --help")

for option in "${options[@]}"; do ${{ github.workspace }}/.venv/bin/mmpm $option; done
Expand All @@ -67,18 +75,18 @@ jobs:
with:
path: |
'./ui/node_modules'
key: ${{ runner.os }}-angular-deps-${{ hashFiles('**/package-lock.json') }}
key: angular-deps-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-angular-deps-${{ hashFiles('**/package-lock.json') }}
angular-deps-${{ hashFiles('**/package-lock.json') }}

- name: Cache Angular Build Artifacts
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/ui/build
key: ${{ runner.os }}-angular-build-${{ hashFiles('**/package-lock.json') }}
key: angular-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-angular-build-${{ hashFiles('**/package-lock.json') }}
angular-build-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand Down Expand Up @@ -110,35 +118,36 @@ jobs:
path: |
~/.cache/pip
${{ github.workspace }}/.venv
key: ${{ runner.os }}-python-deps-${{ hashFiles('**/pdm.lock') }}
key: python-deps-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-deps-${{ hashFiles('**/pdm.lock') }}
python-deps-${{ hashFiles('**/poetry.lock') }}

- name: Restore Angular Build Artifacts Cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/ui/build
key: ${{ runner.os }}-angular-build-${{ hashFiles('**/package-lock.json') }}
key: angular-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-angular-build-${{ hashFiles('**/package-lock.json') }}
angular-build-${{ hashFiles('**/package-lock.json') }}

- name: Package MMPM
run: |
python -m pip install pdm
pdm install
source ${{ github.workspace }}/.venv/bin/activate
python -m pip install poetry
poetry install --no-interaction
mkdir -p ${{ github.workspace }}/mmpm/ui
cp -r ${{ github.workspace }}/ui/build/* ${{ github.workspace }}/mmpm/ui
pdm build
poetry build

- name: Cache MMPM Artifacts
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/dist
key: ${{ runner.os }}-python-build-${{ hashFiles('**/pdm.lock') }}
key: python-build-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-build-${{ hashFiles('**/pdm.lock') }}
python-build-${{ hashFiles('**/poetry.lock') }}

- name: Publish to PyPi
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -151,7 +160,7 @@ jobs:

- name: Publish Release
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: ${{ github.workspace }}/dist/
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,4 @@ TODO.md
htmlcov
.idea
mmpm/ui
.pdm-python
mmpm/ui
.devbox
.devbox
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,8 @@

- Dropped support for Python<=3.8
- Update dependencies

## Version 4.2.1

- moved to use of PDM package manager to Poetry and adjusted build scripts accordingly

1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

18 changes: 10 additions & 8 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
"packages": [
"gcc13Stdenv.cc.cc.lib",
"pm2@5.4.2",
"bun@1.1.31",
"nodejs@22.10.0",
"python-full@3.12.6",
"pdm@2.18.2"
"bun@1.2.0"
],
"env": {
"VENV_DIR": "$PWD/.venv",
Expand All @@ -14,11 +13,12 @@
"shell": {
"init_hook": [
"[ ! -d $VENV_DIR ] && echo 'Creating virtualenv ...' && python3 -m venv $VENV_DIR",
"source $VENV_DIR/bin/activate"
"source $VENV_DIR/bin/activate",
"[[ ! $(command -v poetry) ]] && python -m pip install poetry=='2.0.1' && printf '\n\nRun `devbox run setup` to install dependencies\n'"
],
"scripts": {
"setup": [
"pdm install",
"poetry install",
"cd ui && bun install"
],
"build-ui": [
Expand Down Expand Up @@ -57,12 +57,14 @@
"pm2 logs mmpm"
],
"deploy": [
"cd ui && npm install --legacy-peer-deps && cd ..",
"cd ui && ./node_modules/@angular/cli/bin/ng.js build --configuration production --output-hashing none --base-href / && cd ..",
"pdm install",
"cd ui",
"bun install --legacy-peer-deps",
"./node_modules/@angular/cli/bin/ng.js build --configuration production --output-hashing none --base-href /",
"cd ..",
"mkdir -p mmpm/ui",
"cp -r ui/build/* mmpm/ui",
"pdm build"
"poetry install --no-interaction",
"poetry build"
]
}
}
Expand Down
90 changes: 13 additions & 77 deletions devbox.lock
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
{
"lockfile_version": "1",
"packages": {
"bun@1.1.31": {
"last_modified": "2024-11-03T14:18:04Z",
"resolved": "github:NixOS/nixpkgs/4ae2e647537bcdbb82265469442713d066675275#bun",
"bun@1.2.0": {
"last_modified": "2025-01-27T20:31:03Z",
"resolved": "github:NixOS/nixpkgs/f898cbfddfab52593da301a397a17d0af801bbc3#bun",
"source": "devbox-search",
"version": "1.1.31",
"version": "1.2.0",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/gmvlpnhc673pjwai7q0ydvikif8r1gg5-bun-1.1.31",
"path": "/nix/store/xxfrmp6y0hpnbi0i4hiqlxs5q03z38ih-bun-1.2.0",
"default": true
}
],
"store_path": "/nix/store/gmvlpnhc673pjwai7q0ydvikif8r1gg5-bun-1.1.31"
"store_path": "/nix/store/xxfrmp6y0hpnbi0i4hiqlxs5q03z38ih-bun-1.2.0"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/4xbdp3yb549g0c50qjb2majdg3b484i1-bun-1.1.31",
"path": "/nix/store/q2vlfs8ndyn11r81g9d6xqsvimn7swhi-bun-1.2.0",
"default": true
}
],
"store_path": "/nix/store/4xbdp3yb549g0c50qjb2majdg3b484i1-bun-1.1.31"
"store_path": "/nix/store/q2vlfs8ndyn11r81g9d6xqsvimn7swhi-bun-1.2.0"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/rvf4znnp3zy53f6wc8wkccrz3n59l552-bun-1.1.31",
"path": "/nix/store/sa4jc9rnihflx9r27xgplsxz6mfwhgmi-bun-1.2.0",
"default": true
}
],
"store_path": "/nix/store/rvf4znnp3zy53f6wc8wkccrz3n59l552-bun-1.1.31"
"store_path": "/nix/store/sa4jc9rnihflx9r27xgplsxz6mfwhgmi-bun-1.2.0"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/gimbmhysr6l7fbzk25alznv0mphiy97a-bun-1.1.31",
"path": "/nix/store/738z8xcfqmxd60dc74n02bmc8awa0mrg-bun-1.2.0",
"default": true
}
],
"store_path": "/nix/store/gimbmhysr6l7fbzk25alznv0mphiy97a-bun-1.1.31"
"store_path": "/nix/store/738z8xcfqmxd60dc74n02bmc8awa0mrg-bun-1.2.0"
}
}
},
Expand Down Expand Up @@ -129,70 +129,6 @@
}
}
},
"pdm@2.18.2": {
"last_modified": "2024-09-29T13:45:20Z",
"resolved": "github:NixOS/nixpkgs/7eee17a8a5868ecf596bbb8c8beb527253ea8f4d#pdm",
"source": "devbox-search",
"version": "2.18.2",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/zkm4nxf0qm0zlszg8as3c4828fryf32r-pdm-2.18.2",
"default": true
},
{
"name": "dist",
"path": "/nix/store/cnxv85c3qs3w7p4qcv36yp4mpmysvn83-pdm-2.18.2-dist"
}
],
"store_path": "/nix/store/zkm4nxf0qm0zlszg8as3c4828fryf32r-pdm-2.18.2"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/cdsi576pkgpvcbd5ksqphq1axgg3gkvi-pdm-2.18.2",
"default": true
},
{
"name": "dist",
"path": "/nix/store/706cijccllz3wr132l4siph8nirp2qsg-pdm-2.18.2-dist"
}
],
"store_path": "/nix/store/cdsi576pkgpvcbd5ksqphq1axgg3gkvi-pdm-2.18.2"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/wf3wpprjxdxqwq9kn65asc3skzn0v7pj-pdm-2.18.2",
"default": true
},
{
"name": "dist",
"path": "/nix/store/jybjz97pig3grnl6ci6qsawl5ipmivvq-pdm-2.18.2-dist"
}
],
"store_path": "/nix/store/wf3wpprjxdxqwq9kn65asc3skzn0v7pj-pdm-2.18.2"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/jjsyzf1vkp8caapssqnpxmg6z030j7k0-pdm-2.18.2",
"default": true
},
{
"name": "dist",
"path": "/nix/store/02lv35cq28if46578kaixx9fd2rn9g4s-pdm-2.18.2-dist"
}
],
"store_path": "/nix/store/jjsyzf1vkp8caapssqnpxmg6z030j7k0-pdm-2.18.2"
}
}
},
"pm2@5.4.2": {
"last_modified": "2024-11-03T14:18:04Z",
"resolved": "github:NixOS/nixpkgs/4ae2e647537bcdbb82265469442713d066675275#pm2",
Expand Down Expand Up @@ -243,7 +179,7 @@
},
"python-full@3.12.6": {
"last_modified": "2024-10-13T23:44:06Z",
"plugin_version": "0.0.3",
"plugin_version": "0.0.4",
"resolved": "github:NixOS/nixpkgs/d4f247e89f6e10120f911e2e2d2254a050d0f732#python312Full",
"source": "devbox-search",
"version": "3.12.6",
Expand Down
2 changes: 1 addition & 1 deletion mmpm/__version__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
major = 4
minor = 2
patch = 0
patch = 1

version = f"{major}.{minor}.{patch}"
Loading
Loading