PyProd 0.1.0__tar.gz → 0.2.0.post1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. pyprod-0.2.0.post1/.github/workflows/publish.yml +40 -0
  2. pyprod-0.2.0.post1/.github/workflows/test.yml +38 -0
  3. {pyprod-0.1.0 → pyprod-0.2.0.post1}/PKG-INFO +4 -8
  4. {pyprod-0.1.0 → pyprod-0.2.0.post1}/README.rst +3 -7
  5. {pyprod-0.1.0 → pyprod-0.2.0.post1}/docs/conf.py +6 -6
  6. {pyprod-0.1.0 → pyprod-0.2.0.post1}/docs/prodfile.rst +18 -19
  7. {pyprod-0.1.0 → pyprod-0.2.0.post1}/pyproject.toml +1 -1
  8. pyprod-0.1.0/sample/build-c/Prodfile.py → pyprod-0.2.0.post1/sample/build-c/PRODFILE.py +1 -2
  9. {pyprod-0.1.0/sample/build-c → pyprod-0.2.0.post1/sample/generate-doc}/.gitignore +1 -1
  10. {pyprod-0.1.0 → pyprod-0.2.0.post1}/src/pyprod/prod.py +1 -0
  11. pyprod-0.1.0/.github/workflows/test.yml +0 -22
  12. pyprod-0.1.0/.vscode/settings.json +0 -5
  13. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/.gitignore +0 -2
  14. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/bin/Activate.ps1 +0 -248
  15. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/bin/activate +0 -75
  16. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/bin/activate.csh +0 -27
  17. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/bin/activate.fish +0 -69
  18. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/bin/jp.py +0 -54
  19. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/bin/pip +0 -8
  20. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/bin/pip3 +0 -8
  21. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/bin/pip3.13 +0 -8
  22. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/bin/python +0 -1
  23. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/bin/python3 +0 -1
  24. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/bin/python3.13 +0 -1
  25. pyprod-0.1.0/.xxx/.Prodfile.py.pyprod/pyvenv.cfg +0 -5
  26. pyprod-0.1.0/.xxx/Prodfile.py +0 -11
  27. pyprod-0.1.0/.xxx/data.txt +0 -1
  28. pyprod-0.1.0/.xxx/output/hello.txt +0 -1
  29. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/bin/Activate.ps1 +0 -247
  30. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/bin/activate +0 -70
  31. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/bin/activate.csh +0 -27
  32. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/bin/activate.fish +0 -69
  33. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/bin/normalizer +0 -8
  34. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/bin/pip +0 -8
  35. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/bin/pip3 +0 -8
  36. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/bin/pip3.12 +0 -8
  37. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/bin/python +0 -1
  38. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/bin/python3 +0 -1
  39. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/bin/python3.12 +0 -1
  40. pyprod-0.1.0/sample/generate-doc/.PRODFILE.py.pyprod/pyvenv.cfg +0 -5
  41. pyprod-0.1.0/sample/generate-doc/.gitignore +0 -2
  42. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/.gitignore +0 -2
  43. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/bin/Activate.ps1 +0 -248
  44. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/bin/activate +0 -75
  45. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/bin/activate.csh +0 -27
  46. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/bin/activate.fish +0 -69
  47. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/bin/pip +0 -8
  48. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/bin/pip3 +0 -8
  49. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/bin/pip3.13 +0 -8
  50. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/bin/pygmentize +0 -8
  51. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/bin/python +0 -1
  52. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/bin/python3 +0 -1
  53. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/bin/python3.13 +0 -1
  54. pyprod-0.1.0/sample/md-to-pdf/.Prodfile.py.pyprod/pyvenv.cfg +0 -5
  55. pyprod-0.1.0/sample/md-to-pdf/.build/doc.html +0 -28
  56. pyprod-0.1.0/sample/md-to-pdf/.gitignore +0 -1
  57. pyprod-0.1.0/sample/md-to-pdf/doc.pdf +0 -0
  58. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/.gitignore +0 -2
  59. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/bin/Activate.ps1 +0 -248
  60. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/bin/activate +0 -75
  61. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/bin/activate.csh +0 -27
  62. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/bin/activate.fish +0 -69
  63. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/bin/jp.py +0 -54
  64. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/bin/pip +0 -8
  65. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/bin/pip3 +0 -8
  66. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/bin/pip3.13 +0 -8
  67. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/bin/python +0 -1
  68. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/bin/python3 +0 -1
  69. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/bin/python3.13 +0 -1
  70. pyprod-0.1.0/sample/s3files/.PRODFILE.py.pyprod/pyvenv.cfg +0 -5
  71. {pyprod-0.1.0 → pyprod-0.2.0.post1}/.gitignore +0 -0
  72. {pyprod-0.1.0 → pyprod-0.2.0.post1}/.python-version +0 -0
  73. {pyprod-0.1.0 → pyprod-0.2.0.post1}/.readthedocs.yaml +0 -0
  74. {pyprod-0.1.0 → pyprod-0.2.0.post1}/LICENSE +0 -0
  75. {pyprod-0.1.0 → pyprod-0.2.0.post1}/docs/Makefile +0 -0
  76. {pyprod-0.1.0 → pyprod-0.2.0.post1}/docs/commandline.rst +0 -0
  77. {pyprod-0.1.0 → pyprod-0.2.0.post1}/docs/index.rst +0 -0
  78. {pyprod-0.1.0 → pyprod-0.2.0.post1}/docs/make.bat +0 -0
  79. {pyprod-0.1.0 → pyprod-0.2.0.post1}/docs/pyprod2.png +0 -0
  80. {pyprod-0.1.0 → pyprod-0.2.0.post1}/docs/quickstart.rst +0 -0
  81. {pyprod-0.1.0 → pyprod-0.2.0.post1}/docs/requirements.txt +0 -0
  82. {pyprod-0.1.0 → pyprod-0.2.0.post1}/pyprod.webp +0 -0
  83. {pyprod-0.1.0 → pyprod-0.2.0.post1}/pyprod2.png +0 -0
  84. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/build-c/Makefile +0 -0
  85. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/build-c/hello.c +0 -0
  86. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/build-c/hello.h +0 -0
  87. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/build-c/main.c +0 -0
  88. pyprod-0.1.0/sample/generate-doc/Prodfile.py → pyprod-0.2.0.post1/sample/generate-doc/PRODFILE.py +5 -5
  89. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/generate-doc/a.txt +0 -0
  90. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/generate-doc/b.txt +0 -0
  91. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/generate-doc/c.txt +0 -0
  92. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/generate-doc/inc1.txt +0 -0
  93. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/generate-doc/inc2.txt +0 -0
  94. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/md-to-pdf/Prodfile.py +0 -0
  95. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/md-to-pdf/doc.md +0 -0
  96. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/md-to-pdf/md_to_html.py +0 -0
  97. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/md-to-pdf/template.html +0 -0
  98. /pyprod-0.1.0/sample/s3files/Prodfile.py → /pyprod-0.2.0.post1/sample/s3files/PRODFILE.py +0 -0
  99. {pyprod-0.1.0 → pyprod-0.2.0.post1}/sample/s3files/S3TEST.txt +0 -0
  100. {pyprod-0.1.0 → pyprod-0.2.0.post1}/src/pyprod/__init__.py +0 -0
  101. {pyprod-0.1.0 → pyprod-0.2.0.post1}/src/pyprod/__main__.py +0 -0
  102. {pyprod-0.1.0 → pyprod-0.2.0.post1}/src/pyprod/main.py +0 -0
  103. {pyprod-0.1.0 → pyprod-0.2.0.post1}/src/pyprod/utils.py +0 -0
  104. {pyprod-0.1.0 → pyprod-0.2.0.post1}/src/pyprod/venv.py +0 -0
  105. {pyprod-0.1.0 → pyprod-0.2.0.post1}/tests/__init__.py +0 -0
  106. {pyprod-0.1.0 → pyprod-0.2.0.post1}/tests/conftest.py +0 -0
  107. {pyprod-0.1.0 → pyprod-0.2.0.post1}/tests/test_prod.py +0 -0
  108. {pyprod-0.1.0 → pyprod-0.2.0.post1}/tests/test_prodfuncs.py +0 -0
  109. {pyprod-0.1.0 → pyprod-0.2.0.post1}/tests/test_rule.py +0 -0
  110. {pyprod-0.1.0 → pyprod-0.2.0.post1}/uv.lock +0 -0
@@ -0,0 +1,40 @@
1
+ name: Publish
2
+ on:
3
+ workflow_dispatch:
4
+ workflow_call:
5
+ push:
6
+ tags:
7
+ - "[0-9]+.[0-9]+.[0-9]+"
8
+ - "[0-9]+.[0-9]+.[0-9]+.post[0-9]+"
9
+
10
+ concurrency:
11
+ group: pyprod-deploy
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ publish:
16
+ name: Upload release to PyPI
17
+ runs-on: ubuntu-latest
18
+ environment:
19
+ name: pypi
20
+ url: https://pypi.org/p/pyprod
21
+ permissions:
22
+ id-token: write
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - name: Install uv
27
+ uses: astral-sh/setup-uv@v5
28
+
29
+ - run: uv build
30
+
31
+ - name: Store the distribution packages
32
+ uses: actions/upload-artifact@v4
33
+ with:
34
+ name: python-package-distributions
35
+ path: dist/
36
+
37
+ - name: Publish to PyPI
38
+ uses: pypa/gh-action-pypi-publish@release/v1
39
+ # with:
40
+ # repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,38 @@
1
+ name: Test
2
+
3
+ on:
4
+ workflow_call:
5
+ workflow_dispatch:
6
+ push:
7
+ branches: ["main"]
8
+ pull_request:
9
+ branches: ["main"]
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ python-version:
17
+ - "3.10"
18
+ - "3.11"
19
+ - "3.12"
20
+ - "3.13"
21
+
22
+ steps:
23
+ - name: Checkout repository
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Install uv
27
+ uses: astral-sh/setup-uv@v5
28
+
29
+ - name: Install uv and set the python version
30
+ uses: astral-sh/setup-uv@v5
31
+ with:
32
+ python-version: ${{ matrix.python-version }}
33
+
34
+ - name: Install the project
35
+ run: uv sync --all-extras --dev
36
+
37
+ - name: Run tests
38
+ run: uv run pytest tests
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyProd
3
- Version: 0.1.0
3
+ Version: 0.2.0.post1
4
4
  Summary: PyProd: More Makeable than Make
5
5
  Project-URL: Homepage, https://github.com/atsuoishimoto/pyprod
6
6
  Project-URL: Documentation, https://pyprod.readthedocs.io/en/latest/
@@ -17,12 +17,11 @@ Description-Content-Type: text/x-rst
17
17
  PyProd - More Makeable than Make
18
18
  =================================
19
19
 
20
- PyProd is a Python script that can be used as an alternative to Makefile. By leveraging Python's versatility, it enables you to define build rules and dependencies programmatically, allowing for dynamic configurations, integration with existing Python libraries, and custom build logic not easily achievable with traditional Makefiles. For detailed documentation, please refer to the `official documentation <https://example.com/pyprod-docs>`_.
20
+ PyProd is a Python script that can be used as an alternative to Makefile. By leveraging Python's versatility, it enables you to define build rules and dependencies programmatically, allowing for dynamic configurations, integration with existing Python libraries, and custom build logic not easily achievable with traditional Makefiles. For detailed documentation, please refer to the `official documentation <https://pyprod.readthedocs.io/en/latest/>`_.
21
21
 
22
22
 
23
23
  Features
24
24
  --------
25
-
26
25
  - Define build rules in Python: Use Python functions to create clear and concise build logic.
27
26
  - Specify dependencies for each rule: Automatically track and resolve dependencies between files, such as source files and headers.
28
27
  - Easily extendable with custom Python functions: Integrate custom logic for specialized tasks, like code linting or deployment.
@@ -30,7 +29,6 @@ Features
30
29
 
31
30
  Installation
32
31
  --------------
33
-
34
32
  To install PyProd, simply use pip:
35
33
 
36
34
  .. code-block:: sh
@@ -39,9 +37,7 @@ To install PyProd, simply use pip:
39
37
 
40
38
  Usage
41
39
  -----
42
-
43
- In PyProd, a traditional Makefile for C can be expressed as a Python script like this:
44
-
40
+ With PyProd, a traditional Makefile for C can be expressed as a Python script like this:
45
41
 
46
42
  .. code-block:: python
47
43
 
@@ -63,6 +59,7 @@ In PyProd, a traditional Makefile for C can be expressed as a Python script like
63
59
 
64
60
  all = "hello.exe"
65
61
 
62
+
66
63
  To run the build script, simply execute:
67
64
 
68
65
  .. code-block:: sh
@@ -72,5 +69,4 @@ To run the build script, simply execute:
72
69
 
73
70
  License
74
71
  -------
75
-
76
72
  PyProd is licensed under the MIT License. See the `LICENSE <LICENSE>`_ file for more details.
@@ -1,12 +1,11 @@
1
1
  PyProd - More Makeable than Make
2
2
  =================================
3
3
 
4
- PyProd is a Python script that can be used as an alternative to Makefile. By leveraging Python's versatility, it enables you to define build rules and dependencies programmatically, allowing for dynamic configurations, integration with existing Python libraries, and custom build logic not easily achievable with traditional Makefiles. For detailed documentation, please refer to the `official documentation <https://example.com/pyprod-docs>`_.
4
+ PyProd is a Python script that can be used as an alternative to Makefile. By leveraging Python's versatility, it enables you to define build rules and dependencies programmatically, allowing for dynamic configurations, integration with existing Python libraries, and custom build logic not easily achievable with traditional Makefiles. For detailed documentation, please refer to the `official documentation <https://pyprod.readthedocs.io/en/latest/>`_.
5
5
 
6
6
 
7
7
  Features
8
8
  --------
9
-
10
9
  - Define build rules in Python: Use Python functions to create clear and concise build logic.
11
10
  - Specify dependencies for each rule: Automatically track and resolve dependencies between files, such as source files and headers.
12
11
  - Easily extendable with custom Python functions: Integrate custom logic for specialized tasks, like code linting or deployment.
@@ -14,7 +13,6 @@ Features
14
13
 
15
14
  Installation
16
15
  --------------
17
-
18
16
  To install PyProd, simply use pip:
19
17
 
20
18
  .. code-block:: sh
@@ -23,9 +21,7 @@ To install PyProd, simply use pip:
23
21
 
24
22
  Usage
25
23
  -----
26
-
27
- In PyProd, a traditional Makefile for C can be expressed as a Python script like this:
28
-
24
+ With PyProd, a traditional Makefile for C can be expressed as a Python script like this:
29
25
 
30
26
  .. code-block:: python
31
27
 
@@ -47,6 +43,7 @@ In PyProd, a traditional Makefile for C can be expressed as a Python script like
47
43
 
48
44
  all = "hello.exe"
49
45
 
46
+
50
47
  To run the build script, simply execute:
51
48
 
52
49
  .. code-block:: sh
@@ -56,5 +53,4 @@ To run the build script, simply execute:
56
53
 
57
54
  License
58
55
  -------
59
-
60
56
  PyProd is licensed under the MIT License. See the `LICENSE <LICENSE>`_ file for more details.
@@ -26,10 +26,10 @@ html_theme = "sphinx_rtd_theme"
26
26
  html_static_path = ["_static"]
27
27
 
28
28
  html_logo = "pyprod2.png"
29
- html_favicon = 'pyprod2.png'
29
+ html_favicon = "pyprod2.png"
30
30
  html_context = {
31
- 'display_github': True,
32
- 'github_user': 'atsuoishimoto',
33
- 'github_repo': 'pyprod',
34
- 'github_version': 'main/docs/',
35
- }
31
+ "display_github": True,
32
+ "github_user": "atsuoishimoto",
33
+ "github_repo": "pyprod",
34
+ "github_version": "main/docs/",
35
+ }
@@ -15,17 +15,17 @@ A rule is defined using the ``@rule`` decorator, which takes the target file as
15
15
  Defines rule to build target files.
16
16
 
17
17
  :param target: The target file or files to be generated by the rule. Wildcards can be used in filenames, and exactly one % must be included in the filename.
18
- :type target: str|Path|list[str|Path]
18
+ :type target: str | Path|list[str | Path]
19
19
 
20
20
  :param pattern: Specify the pattern used to extract the stem of the target filename.
21
21
 
22
- :type pattern: str|Path|None
22
+ :type pattern: str | Path | None
23
23
 
24
24
  :param depends: Specify the dependencies of the target file. The target file will be rebuilt if any of the dependencies are newer than the target file.
25
- :type depends: str|Path|list[str|Path]
25
+ :type depends: str | Path | list[str | Path]
26
26
 
27
27
  :param uses: Specify the dependencies of the target file. Unlike the ``depends`` parameter, the target file will not be rebuilt if any of the dependencies are newer than the target file.
28
- :type uses: str|Path|list[str|Path]
28
+ :type uses: str | Path | list[str | Path]
29
29
 
30
30
  Build function
31
31
  ~~~~~~~~~~~~~~~~~~~
@@ -88,20 +88,19 @@ The rule decorator can also be used as a standalone function without being tied
88
88
  Checker definition
89
89
  ^^^^^^^^^^^^^^^^^^
90
90
 
91
- A checker is defined using the ``@check`` decorator, which takes the target file as an argument. The checker tests if the target is exists or not.
91
+ PyProd provides default checkers for common file types for files and directories. For non-file targets requiring specialized checks, you can define a custom checker to determine whether a build is needed.
92
+ A checker is defined using the ``@check`` decorator, which takes the target file as an argument.
92
93
 
93
94
  .. py:function:: @check(target)
94
95
 
95
96
  Defines a checker to get last modified time of the target.
96
97
 
97
98
  :param target: The target file to be checked. Wildcards can be used.
98
- :type target: str|Path
99
+ :type target: str | Path
99
100
 
100
101
  :return: Last modified time of the file if the target exists. Returns false or raise FileNotFoundError if the target does not exist.
101
102
  :rtype: false|float|datetime.datetime
102
103
 
103
- PyProd provides default checkers for common file types for files and directories.
104
- PyProd includes default checkers for common file types, applicable to both files and directories. For non-file targets requiring specialized checks, you can define a custom checker to determine whether a build is needed.
105
104
 
106
105
  For example, a checker to retrieve the last modified timestamp of a file on Amazon S3 can be defined as follows:
107
106
 
@@ -160,22 +159,22 @@ Example:
160
159
 
161
160
  .. py:function:: run(*args, echo=True, shell=None, stdout=None,cwd=None, text=True, check=True)
162
161
 
163
- Execute a command. This function is a wrapper around `subprocess.run()` and provides additional functionality for the build system.
162
+ Execute a command. This function is a wrapper around `subprocess.run() <https://docs.python.org/3/library/subprocess.html#subprocess.run>`_ and provides additional functionality for the build system.
164
163
 
165
164
  :param args: Command and arguments to execute. If first argument is a list, the first element is the command and the rest are arguments. Sequences specified for args are automatically flattened.
166
- :type args: str|Path|list[str|Path]
165
+ :type args: str | Path| list[str | Path]
167
166
 
168
- :echo: Print the command before executing it (default ``True``).
167
+ :param echo: Print the command before executing it (default ``True``).
169
168
  :type echo: bool
170
169
 
171
- :shell: Run the command in a shell. If None, the shell is used unless `arg` is sequence (default ``None``).
170
+ :param shell: Run the command in a shell. If None, the shell is used unless `arg` is sequence (default ``None``).
172
171
  :type shell: bool|None
173
172
 
174
- :stdout: Capture the output of the command (default ``False``).
173
+ :param stdout: Capture the output of the command (default ``False``).
175
174
  :type shell: bool
176
175
 
177
- :cwd: Change the current working directory before executing the command.
178
- :type shell: str|Path|None
176
+ :param cwd: Change the current working directory before executing the command.
177
+ :type shell: str | Path | None
179
178
 
180
179
  :param text: Use text mode for stdout and stderr (default ``True``).
181
180
  :type shell: bool
@@ -204,13 +203,13 @@ Example:
204
203
  :ref:`run <run>`.
205
204
 
206
205
  :param args: Command and arguments to execute. If first argument is a list, the first element is the command and the rest are arguments. Sequences specified for args are automatically flattened.
207
- :type args: str|Path|list[str|Path]
206
+ :type args: str | Path | list[str | Path]
208
207
 
209
208
  :echo: Print the command before executing it (default ``True``).
210
209
  :type echo: bool
211
210
 
212
211
  :cwd: Change the current working directory before executing the command.
213
- :type shell: str|Path|None
212
+ :type shell: str | Path | None
214
213
 
215
214
  :param check: Raise an exception if the command returns a non-zero exit code (default ``True``).
216
215
  :type shell: bool
@@ -235,10 +234,10 @@ Example:
235
234
  Glob the given relative pattern in the directory represented by this path. This function is a wrapper around `pathlib.Path.glob() <https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob>`_. Unlike ``pathlib.Path.glob()``, this function ignores files and directlies that start with a dot. Also, this function returns a list of Path objects.
236
235
 
237
236
  :param path: The file pattern to match.
238
- :type path: str|Path
237
+ :type path: str | Path
239
238
 
240
239
  :param dir: The directory to search in (default ``.``).
241
- :type dir: str|Path
240
+ :type dir: str | Path
242
241
 
243
242
  :return: A list of Path object.
244
243
  :rtype: list[Path]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PyProd"
3
- version = "0.1.0"
3
+ version = "0.2.0.post1"
4
4
  description = "PyProd: More Makeable than Make"
5
5
  readme = "README.rst"
6
6
  requires-python = ">=3.10"
@@ -12,13 +12,12 @@ OBJS = "hello.o main.o".split()
12
12
  def link(target, *src):
13
13
  run(CC, "-o", target, src)
14
14
 
15
+
15
16
  @rule("%.o", depends=("%.c", DEPS))
16
17
  def compile(target, src, *deps):
17
18
  run(CC, "-c -o", target, src, CFLAGS)
18
19
 
19
20
 
20
-
21
-
22
21
  def clean():
23
22
  run("rm", "-rf", OBJS, APP)
24
23
 
@@ -1,2 +1,2 @@
1
1
  objs/*
2
- app.txt
2
+ DOC.txt
@@ -3,6 +3,7 @@ import concurrent.futures
3
3
  import datetime
4
4
  import importlib
5
5
  import importlib.machinery
6
+ import importlib.util
6
7
  import logging
7
8
  import os
8
9
  import re
@@ -1,22 +0,0 @@
1
- name: Python application
2
-
3
- on:
4
- push:
5
- branches: ["main"]
6
- pull_request:
7
- branches: ["main"]
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - name: Checkout repository
15
- uses: actions/checkout@v4
16
-
17
- - name: Install uv
18
- uses: astral-sh/setup-uv@v5
19
-
20
- - name: Run tests
21
- run: |
22
- uv run pytest tests
@@ -1,5 +0,0 @@
1
- {
2
- "[yaml]": {
3
- "editor.tabSize": 2
4
- }
5
- }
@@ -1,2 +0,0 @@
1
- # Created by venv; see https://docs.python.org/3/library/venv.html
2
- *
@@ -1,248 +0,0 @@
1
- <#
2
- .Synopsis
3
- Activate a Python virtual environment for the current PowerShell session.
4
-
5
- .Description
6
- Pushes the python executable for a virtual environment to the front of the
7
- $Env:PATH environment variable and sets the prompt to signify that you are
8
- in a Python virtual environment. Makes use of the command line switches as
9
- well as the `pyvenv.cfg` file values present in the virtual environment.
10
-
11
- .Parameter VenvDir
12
- Path to the directory that contains the virtual environment to activate. The
13
- default value for this is the parent of the directory that the Activate.ps1
14
- script is located within.
15
-
16
- .Parameter Prompt
17
- The prompt prefix to display when this virtual environment is activated. By
18
- default, this prompt is the name of the virtual environment folder (VenvDir)
19
- surrounded by parentheses and followed by a single space (ie. '(.venv) ').
20
-
21
- .Example
22
- Activate.ps1
23
- Activates the Python virtual environment that contains the Activate.ps1 script.
24
-
25
- .Example
26
- Activate.ps1 -Verbose
27
- Activates the Python virtual environment that contains the Activate.ps1 script,
28
- and shows extra information about the activation as it executes.
29
-
30
- .Example
31
- Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
32
- Activates the Python virtual environment located in the specified location.
33
-
34
- .Example
35
- Activate.ps1 -Prompt "MyPython"
36
- Activates the Python virtual environment that contains the Activate.ps1 script,
37
- and prefixes the current prompt with the specified string (surrounded in
38
- parentheses) while the virtual environment is active.
39
-
40
- .Notes
41
- On Windows, it may be required to enable this Activate.ps1 script by setting the
42
- execution policy for the user. You can do this by issuing the following PowerShell
43
- command:
44
-
45
- PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
46
-
47
- For more information on Execution Policies:
48
- https://go.microsoft.com/fwlink/?LinkID=135170
49
-
50
- #>
51
- Param(
52
- [Parameter(Mandatory = $false)]
53
- [String]
54
- $VenvDir,
55
- [Parameter(Mandatory = $false)]
56
- [String]
57
- $Prompt
58
- )
59
-
60
- <# Function declarations --------------------------------------------------- #>
61
-
62
- <#
63
- .Synopsis
64
- Remove all shell session elements added by the Activate script, including the
65
- addition of the virtual environment's Python executable from the beginning of
66
- the PATH variable.
67
-
68
- .Parameter NonDestructive
69
- If present, do not remove this function from the global namespace for the
70
- session.
71
-
72
- #>
73
- function global:deactivate ([switch]$NonDestructive) {
74
- # Revert to original values
75
-
76
- # The prior prompt:
77
- if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
78
- Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
79
- Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
80
- }
81
-
82
- # The prior PYTHONHOME:
83
- if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
84
- Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
85
- Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
86
- }
87
-
88
- # The prior PATH:
89
- if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
90
- Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
91
- Remove-Item -Path Env:_OLD_VIRTUAL_PATH
92
- }
93
-
94
- # Just remove the VIRTUAL_ENV altogether:
95
- if (Test-Path -Path Env:VIRTUAL_ENV) {
96
- Remove-Item -Path env:VIRTUAL_ENV
97
- }
98
-
99
- # Just remove VIRTUAL_ENV_PROMPT altogether.
100
- if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
101
- Remove-Item -Path env:VIRTUAL_ENV_PROMPT
102
- }
103
-
104
- # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
105
- if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
106
- Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
107
- }
108
-
109
- # Leave deactivate function in the global namespace if requested:
110
- if (-not $NonDestructive) {
111
- Remove-Item -Path function:deactivate
112
- }
113
- }
114
-
115
- <#
116
- .Description
117
- Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
118
- given folder, and returns them in a map.
119
-
120
- For each line in the pyvenv.cfg file, if that line can be parsed into exactly
121
- two strings separated by `=` (with any amount of whitespace surrounding the =)
122
- then it is considered a `key = value` line. The left hand string is the key,
123
- the right hand is the value.
124
-
125
- If the value starts with a `'` or a `"` then the first and last character is
126
- stripped from the value before being captured.
127
-
128
- .Parameter ConfigDir
129
- Path to the directory that contains the `pyvenv.cfg` file.
130
- #>
131
- function Get-PyVenvConfig(
132
- [String]
133
- $ConfigDir
134
- ) {
135
- Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
136
-
137
- # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
138
- $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
139
-
140
- # An empty map will be returned if no config file is found.
141
- $pyvenvConfig = @{ }
142
-
143
- if ($pyvenvConfigPath) {
144
-
145
- Write-Verbose "File exists, parse `key = value` lines"
146
- $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
147
-
148
- $pyvenvConfigContent | ForEach-Object {
149
- $keyval = $PSItem -split "\s*=\s*", 2
150
- if ($keyval[0] -and $keyval[1]) {
151
- $val = $keyval[1]
152
-
153
- # Remove extraneous quotations around a string value.
154
- if ("'""".Contains($val.Substring(0, 1))) {
155
- $val = $val.Substring(1, $val.Length - 2)
156
- }
157
-
158
- $pyvenvConfig[$keyval[0]] = $val
159
- Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
160
- }
161
- }
162
- }
163
- return $pyvenvConfig
164
- }
165
-
166
-
167
- <# Begin Activate script --------------------------------------------------- #>
168
-
169
- # Determine the containing directory of this script
170
- $VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
171
- $VenvExecDir = Get-Item -Path $VenvExecPath
172
-
173
- Write-Verbose "Activation script is located in path: '$VenvExecPath'"
174
- Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
175
- Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
176
-
177
- # Set values required in priority: CmdLine, ConfigFile, Default
178
- # First, get the location of the virtual environment, it might not be
179
- # VenvExecDir if specified on the command line.
180
- if ($VenvDir) {
181
- Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
182
- }
183
- else {
184
- Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
185
- $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
186
- Write-Verbose "VenvDir=$VenvDir"
187
- }
188
-
189
- # Next, read the `pyvenv.cfg` file to determine any required value such
190
- # as `prompt`.
191
- $pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
192
-
193
- # Next, set the prompt from the command line, or the config file, or
194
- # just use the name of the virtual environment folder.
195
- if ($Prompt) {
196
- Write-Verbose "Prompt specified as argument, using '$Prompt'"
197
- }
198
- else {
199
- Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
200
- if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
201
- Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
202
- $Prompt = $pyvenvCfg['prompt'];
203
- }
204
- else {
205
- Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
206
- Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
207
- $Prompt = Split-Path -Path $venvDir -Leaf
208
- }
209
- }
210
-
211
- Write-Verbose "Prompt = '$Prompt'"
212
- Write-Verbose "VenvDir='$VenvDir'"
213
-
214
- # Deactivate any currently active virtual environment, but leave the
215
- # deactivate function in place.
216
- deactivate -nondestructive
217
-
218
- # Now set the environment variable VIRTUAL_ENV, used by many tools to determine
219
- # that there is an activated venv.
220
- $env:VIRTUAL_ENV = $VenvDir
221
-
222
- $env:VIRTUAL_ENV_PROMPT = $Prompt
223
-
224
- if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
225
-
226
- Write-Verbose "Setting prompt to '$Prompt'"
227
-
228
- # Set the prompt to include the env name
229
- # Make sure _OLD_VIRTUAL_PROMPT is global
230
- function global:_OLD_VIRTUAL_PROMPT { "" }
231
- Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
232
- New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
233
-
234
- function global:prompt {
235
- Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
236
- _OLD_VIRTUAL_PROMPT
237
- }
238
- }
239
-
240
- # Clear PYTHONHOME
241
- if (Test-Path -Path Env:PYTHONHOME) {
242
- Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
243
- Remove-Item -Path Env:PYTHONHOME
244
- }
245
-
246
- # Add the venv to the PATH
247
- Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
248
- $Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"