Skip to content

Commit

Permalink
Add ability to build sdist (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv authored Feb 27, 2023
1 parent ecf6238 commit c0d4f80
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install
run: |
pip install -e .
pip install pytest meson-python ninja
pip install pytest meson-python ninja build
- name: Library tests
env:
PYTHONPATH: "."
Expand All @@ -44,6 +44,7 @@ jobs:
cd example_pkg
./dev.py build
./dev.py test
./dev.py sdist
- name: Patch Windows runner
if: matrix.os == 'windows-latest'
run: |
Expand All @@ -57,3 +58,4 @@ jobs:
cd example_pkg
python dev.py build
python dev.py test
python dev.py sdist
6 changes: 6 additions & 0 deletions example_pkg/.devpy/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ def example(flag):
print("Flag provided is:", flag)
print("Tool config is:")
print(config["tool.devpy"])


@click.command()
def sdist():
"""📦 Build a source distribution in `dist/`."""
util.run(["python", "-m", "build", ".", "--sdist"])
2 changes: 2 additions & 0 deletions example_pkg/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.* export-ignore
.devpy -export-ignore
2 changes: 2 additions & 0 deletions example_pkg/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
build
build-install
.mesonpy-native-file.ini
dist/
10 changes: 8 additions & 2 deletions example_pkg/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
[project]
name = "devpy-example"
name = "example_pkg"
version = "0.0dev0"
requires-python = ">=3.7"
description = "DevPy Example Package"

[build-system]
build-backend = "mesonpy"
requires = [
"meson-python>=0.13.0rc0",
]

[tool.devpy]
package = 'example_pkg'

Expand All @@ -12,6 +18,6 @@ package = 'example_pkg'
#
# commands = ["devpy.build", "devpy.test", "devpy.shell", "devpy.ipython", "devpy.python", "custom/cmds.py:example"]

"Build" = ["devpy.build", "devpy.test"]
"Build" = ["devpy.build", "devpy.test", ".devpy/cmds.py:sdist"]
"Environments" = ["devpy.shell", "devpy.ipython", "devpy.python"]
"Extensions" = [".devpy/cmds.py:example"]

0 comments on commit c0d4f80

Please sign in to comment.