cfengine 0.2.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. cfengine-0.3.1/.github/dependabot.yml +17 -0
  2. cfengine-0.3.1/.github/workflows/black-check.yml +35 -0
  3. cfengine-0.3.1/.github/workflows/black-format.yml +71 -0
  4. cfengine-0.3.1/.github/workflows/pypi-publish.yml +50 -0
  5. cfengine-0.3.1/.github/workflows/tests.yml +59 -0
  6. cfengine-0.3.1/.gitignore +9 -0
  7. cfengine-0.3.1/.python-version +1 -0
  8. cfengine-0.3.1/HACKING.md +88 -0
  9. cfengine-0.3.1/PKG-INFO +752 -0
  10. cfengine-0.3.1/main.py +6 -0
  11. cfengine-0.3.1/pyproject.toml +46 -0
  12. cfengine-0.3.1/src/cfengine.egg-info/PKG-INFO +752 -0
  13. cfengine-0.3.1/src/cfengine.egg-info/SOURCES.txt +32 -0
  14. cfengine-0.3.1/src/cfengine.egg-info/requires.txt +2 -0
  15. {cfengine-0.2.0 → cfengine-0.3.1/src}/cfengine.egg-info/top_level.txt +0 -1
  16. cfengine-0.3.1/tests/docker/001-docker-install-test.sh +36 -0
  17. cfengine-0.3.1/tests/docker/Dockerfile +10 -0
  18. cfengine-0.3.1/tests/shell/001-help.sh +2 -0
  19. cfengine-0.3.1/uv.lock +320 -0
  20. cfengine-0.2.0/PKG-INFO +0 -78
  21. cfengine-0.2.0/cfengine.egg-info/PKG-INFO +0 -78
  22. cfengine-0.2.0/cfengine.egg-info/SOURCES.txt +0 -20
  23. cfengine-0.2.0/cfengine.egg-info/requires.txt +0 -2
  24. cfengine-0.2.0/cfengine_cli/VERSION +0 -1
  25. cfengine-0.2.0/setup.py +0 -55
  26. {cfengine-0.2.0 → cfengine-0.3.1}/LICENSE +0 -0
  27. {cfengine-0.2.0 → cfengine-0.3.1}/README.md +0 -0
  28. {cfengine-0.2.0 → cfengine-0.3.1}/setup.cfg +0 -0
  29. {cfengine-0.2.0 → cfengine-0.3.1/src}/cfengine.egg-info/dependency_links.txt +0 -0
  30. {cfengine-0.2.0 → cfengine-0.3.1/src}/cfengine.egg-info/entry_points.txt +0 -0
  31. {cfengine-0.2.0 → cfengine-0.3.1/src}/cfengine_cli/__init__.py +0 -0
  32. {cfengine-0.2.0 → cfengine-0.3.1/src}/cfengine_cli/__main__.py +0 -0
  33. {cfengine-0.2.0 → cfengine-0.3.1/src}/cfengine_cli/commands.py +0 -0
  34. {cfengine-0.2.0 → cfengine-0.3.1/src}/cfengine_cli/main.py +0 -0
  35. {cfengine-0.2.0 → cfengine-0.3.1/src}/cfengine_cli/paths.py +0 -0
  36. {cfengine-0.2.0 → cfengine-0.3.1/src}/cfengine_cli/shell.py +0 -0
  37. {cfengine-0.2.0 → cfengine-0.3.1/src}/cfengine_cli/utils.py +0 -0
  38. {cfengine-0.2.0 → cfengine-0.3.1/src}/cfengine_cli/version.py +0 -0
  39. {cfengine-0.2.0 → cfengine-0.3.1}/tests/__init__.py +0 -0
  40. {cfengine-0.2.0 → cfengine-0.3.1}/tests/test_deps.py +0 -0
@@ -0,0 +1,17 @@
1
+ # Please see the documentation for all configuration options:
2
+ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
3
+
4
+ version: 2
5
+ updates:
6
+ - package-ecosystem: "pip"
7
+ directory: "/"
8
+ schedule:
9
+ interval: "weekly"
10
+ prefix: "pip"
11
+ - package-ecosystem: "github-actions"
12
+ directory: "/"
13
+ schedule:
14
+ interval: "weekly"
15
+ reviewers:
16
+ - "olehermanse"
17
+ prefix: "GitHub Actions"
@@ -0,0 +1,35 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
+
4
+ name: Check formatting with Black
5
+
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ pull_request:
10
+ branches: [main]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ check:
17
+ runs-on: ubuntu-22.04
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ python-version: ["3.12"]
22
+
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+ - name: Install dependencies
30
+ run: |
31
+ python -m pip install --upgrade pip
32
+ python -m pip install black
33
+ - name: Check formatting with black
34
+ run: |
35
+ black --check .
@@ -0,0 +1,71 @@
1
+ name: Automatically format with Black and submit PR
2
+
3
+ permissions:
4
+ contents: read
5
+ pull-requests: write
6
+
7
+ on:
8
+ push:
9
+ branches:
10
+ - main
11
+
12
+ workflow_dispatch:
13
+
14
+ jobs:
15
+ format:
16
+ runs-on: ubuntu-22.04
17
+ steps:
18
+ - name: Checks-out repository
19
+ uses: actions/checkout@v4
20
+ - name: Set up Python 3.12
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.12"
24
+ - name: Install black
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ python -m pip install black
28
+ - name: Reformat with black
29
+ run: |
30
+ shopt -s globstar
31
+ black . > black_output.txt 2>&1
32
+ - name: Check if there are changes
33
+ run: |
34
+ git diff --exit-code || touch git_diff_exists
35
+ if [ -f git_diff_exists ]; then echo "Changes need to be commited"; else echo "No changes to commit"; fi
36
+ - name: Create commit message
37
+ if: hashFiles('git_diff_exists') != ''
38
+ run: |
39
+ echo "Reformatted python code using Black formatter" >> commit_message.txt
40
+ echo "" >> commit_message.txt
41
+ echo "Output from black:" >> commit_message.txt
42
+ echo "" >> commit_message.txt
43
+ echo '```' >> commit_message.txt
44
+ cat black_output.txt >> commit_message.txt
45
+ echo '```' >> commit_message.txt
46
+ - name: Commit changes
47
+ if: hashFiles('git_diff_exists') != ''
48
+ run: |
49
+ git config user.name 'GitHub'
50
+ git config user.email '<noreply@github.com>'
51
+ shopt -s globstar
52
+ git add cfengine_cli/*.py cfengine_cli/**/*.py tests/*.py tests/**/*.py
53
+ git commit -F commit_message.txt
54
+ - id: commit-message-from-file
55
+ name: Parse commit message from file into variable
56
+ if: hashFiles('git_diff_exists') != ''
57
+ run: |
58
+ body=$(cat commit_message.txt)
59
+ body="${body//$'\n'/'%0A'}"
60
+ echo ::set-output name=body::$body
61
+ - name: Create Pull Request
62
+ if: hashFiles('git_diff_exists') != ''
63
+ uses: cfengine/create-pull-request@158a28c1bf5c08c846b8e7d26d13becbd4136eda # v7.0.7a
64
+ with:
65
+ title: Reformatted python code using Black formatter
66
+ body: ${{ steps.commit-message-from-file.outputs.body }}
67
+ reviewers: |
68
+ olehermanse
69
+ larsewi
70
+ vpodzime
71
+ branch: formatting-action
@@ -0,0 +1,50 @@
1
+ # Taken from GH docs:
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ release-build:
9
+ runs-on: ubuntu-24.04
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.x"
20
+
21
+ - name: Build release distributions
22
+ run: |
23
+ git fetch --all --tags
24
+ python -m pip install pip
25
+ pip install uv
26
+ uv lock --check
27
+ uv build
28
+
29
+ - name: Upload release-dists as artifact
30
+ uses: actions/upload-artifact@v4
31
+ with:
32
+ name: release-dists
33
+ path: dist/
34
+
35
+ pypi-publish:
36
+ runs-on: ubuntu-24.04
37
+ needs:
38
+ - release-build
39
+ permissions:
40
+ id-token: write
41
+
42
+ steps:
43
+ - name: Retrieve release distributions
44
+ uses: actions/download-artifact@v4
45
+ with:
46
+ name: release-dists
47
+ path: dist/
48
+
49
+ - name: Publish release distributions to PyPI
50
+ uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc
@@ -0,0 +1,59 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
+
4
+ name: Tests
5
+
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ pull_request:
10
+ branches: [main]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ python_version:
17
+ runs-on: ubuntu-22.04
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
22
+
23
+ steps:
24
+ - uses: actions/checkout@v3
25
+ with:
26
+ fetch-depth: 0
27
+ - name: Set up Python ${{ matrix.python-version }}
28
+ uses: actions/setup-python@v5
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ - name: Install dependencies
32
+ run: |
33
+ python -m pip install --upgrade pip
34
+ python -m pip install uv
35
+ - name: Check lockfile
36
+ run: |
37
+ uv lock --check
38
+ - name: Lint with flake8
39
+ run: |
40
+ # stop the build if there are Python syntax errors or undefined names
41
+ uv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
42
+ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
43
+ uv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
44
+ - name: Test with pytest
45
+ run: |
46
+ uv run pytest
47
+ - name: Install
48
+ run: |
49
+ uv lock --check
50
+ uv build
51
+ pip install .
52
+ - name: Sanity check
53
+ run: cfengine --version
54
+ - name: Run docker tests
55
+ run: |
56
+ bash tests/docker/0*.sh
57
+ - name: Run shell tests
58
+ run: |
59
+ bash tests/shell/0*.sh
@@ -0,0 +1,9 @@
1
+ build
2
+ dist
3
+ VERSION
4
+ cfengine.egg-info
5
+ venv
6
+ .venv
7
+ __pycache__
8
+ .DS_STORE
9
+ .pytest_cache
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,88 @@
1
+ # Developing / maintaining the CFEngine CLI
2
+
3
+ This document aims to have relevant information for people contributing to and maintaining the CFEngine CLI.
4
+ It is not necessary for users of the tool to know about these processes.
5
+ For general user information, see the [README](./README.md).
6
+
7
+ ## Releasing new versions
8
+
9
+ Releases are [automated using a GH Action](https://github.com/cfengine/cfengine-cli/blob/main/.github/workflows/pypi-publish.yml)
10
+ We create tags and releases through the GitHub UI.
11
+ Go to the releases section in GitHub:
12
+
13
+ https://github.com/cfengine/cfengine-cli/releases
14
+
15
+ Determine the new version number according to SemVer:
16
+
17
+ - Look at what is the latest released version.
18
+ - Increase the first number if you are releasing breaking changes.
19
+ - Or, increase the second number if there are new features (but no breaking changes).
20
+ - Otherwise, increase the last number (only backwards compatible bugfixes).
21
+
22
+ Sometimes, it's not 100% clear, so use your best judgement.
23
+
24
+ Once you know the version number, proceed with making the release:
25
+
26
+ 1. Enter the version number into the **Choose a tag** dropdown.
27
+ 2. Click the **Create new tag on publish** alternative.
28
+ 3. Target should say **main**, don't change it.
29
+ 4. Put exactly the same version number into the **Release title** field.
30
+ 5. Click **Generate release notes**.
31
+ - In general, it's not necessary to edit the release notes.
32
+ - Sometimes you might want to add a link to a release blog post.
33
+ - Or, if there is a lot of noise, for example changes to docs and tests which don't affect users, you can remove those.
34
+ 6. Leave the checkboxes below as is (latest release checked, pre-release unchecked).
35
+ 7. Click **Publish release**.
36
+ 8. Watch the release happen:
37
+ - In GitHub Actions: https://github.com/cfengine/cfengine-cli/actions
38
+ - And if all is well, the new version should appear on PyPI: https://pypi.org/project/cfengine/
39
+
40
+ If it does not work, click the failing GitHub Actions and try to understand what went wrong.
41
+
42
+ ### Releasing using GitHub CLI (gh)
43
+
44
+ The process is virtually identical to using the GUI.
45
+ Once you've determined what the version number should be, use the `gh release create`, and answer the prompts in a similar way to above:
46
+
47
+ ```
48
+ $ gh release create
49
+ ? Choose a tag Create a new tag
50
+ ? Tag name 0.2.0
51
+ ? Title (optional) 0.2.0
52
+ ? Release notes Write using generated notes as template
53
+ ? Is this a prerelease? No
54
+ ? Submit? Publish release
55
+ https://github.com/cfengine/cfengine-cli/releases/tag/0.2.0
56
+ $
57
+ ```
58
+
59
+ Then check that everything went well;
60
+
61
+ https://github.com/cfengine/cfengine-cli/actions
62
+
63
+ https://pypi.org/project/cfengine/
64
+
65
+ ## Rotating secrets
66
+
67
+ The GH Action shown above requires a PyPI token to have access to publish new versions to PyPI.
68
+ Sometimes, this needs to be rotated.
69
+ [Log in](https://pypi.org/account/login/) to PyPI (need account access) and go to account settings:
70
+
71
+ https://pypi.org/manage/account/
72
+
73
+ Delete the old `cfengine-cli` token and generate a new one with the same name and correct scope (only access to `cfengine` project).
74
+ Copy the token and paste it into the GitHub Secret named `PYPI_PASSWORD`.
75
+ `PYPI_USERNAME` should be there already, you don't have to edit it, it is simply `__token__`.
76
+ Don't store the token anywhere else - we generate new tokens if necessary.
77
+
78
+ ## Code formatting
79
+
80
+ We use automated code formatters to ensure consistent code style / indentation.
81
+ Please format Python code with [black](https://pypi.org/project/black/), and YAML and markdown files with [Prettier](https://prettier.io/).
82
+ For simplicity's sake, we don't have a custom configuration, we use the tool's defaults.
83
+
84
+ If your editor does not do this automatically, you can run these tools from the command line:
85
+
86
+ ```
87
+ black . && prettier . --write
88
+ ```