Skip to content

Commit

Permalink
Clarify PEP621 (#113)
Browse files Browse the repository at this point in the history
* Clarify PEP621

* Add extra test to validate pip-dist works with pyproject.toml

* Use a newer python version on test

* Add new test folder

* Update pyproject

* Update pyproject

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

---------

Co-authored-by: marboledacci <[email protected]>
  • Loading branch information
LecrisUT and marboledacci authored Oct 10, 2024
1 parent b99fce6 commit daafb89
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ workflows:
name: If another python version is loaded - its broken - this verifies that it's broken
when: on_fail
command: python --version
- python/test:
filters: *filters
version: 3.11.4
name: job-test-pip-dist-pyproject
pkg-manager: pip-dist
cache-version: pip-dist-pyproject-<< pipeline.parameters.cache-version >>
app-dir: ~/project/sample_pip_pyproject
- orb-tools/pack:
filters: *filters
- orb-tools/publish:
Expand All @@ -270,6 +277,8 @@ workflows:
- job-test-poetry
- job-test-pipenv
- job-test-pip
- job-test-pip-dist
- job-test-pip-dist-pyproject
- job-auto-test-poetry
- job-auto-test-pipenv
- job-auto-test-pip
Expand Down
14 changes: 14 additions & 0 deletions sample_pip_pyproject/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Example toml for integration testing - this is not used by the orb in anyway
[project]
authors=[
{name="TEST", email="[email protected]"}
]
name="test"
description="none"
version = "0.0.1"
requires-python=">3.11"
dependencies=["pytest"]

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
1 change: 1 addition & 0 deletions sample_pip_pyproject/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
5 changes: 5 additions & 0 deletions sample_pip_pyproject/src/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


def add_func(x,y):
z = x+y
return z
Empty file.
11 changes: 11 additions & 0 deletions sample_pip_pyproject/tests/test_ex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from src import example

import unittest

class TestCase(unittest.TestCase):

def test_add1(self):
assert example.add_func(5,5) == 10

def test_add2(self):
assert example.add_func(5,10) == 15
7 changes: 7 additions & 0 deletions sample_pip_pyproject/tests/test_job.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

import unittest

class TestCase(unittest.TestCase):

def test_true(self):
assert True
6 changes: 3 additions & 3 deletions src/commands/install-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ parameters:
type: enum
enum: [auto, poetry, pipenv, pip, pip-dist]
default: auto
description: Which package management tool to use, pipenv, pip or poetry with dependency file. Use `pip-dist` to install with project setup.py.
description: Which package management tool to use, pipenv, pip or poetry with dependency file. Use `pip-dist` to install with project setup.py or PEP621 (pyproject.toml).
path-args:
type: string
default: "."
Expand All @@ -27,7 +27,7 @@ parameters:
default: requirements.txt
description: |
Name of the requirements file that needs to be installed with pip. Prepended with `app-dir`. If using pipenv or poetry, this is ignored.
If using `pip-dist`, use this to use the cache checksum against the `setup.py` if desired.
If using `pip-dist`, use this to use the cache checksum against the `setup.py` or `pyproject.toml` if desired.
If `pip-dependency-file` is set to an empty string, no dependency file is used in the `pip install` command.
app-dir:
type: string
Expand Down Expand Up @@ -164,7 +164,7 @@ steps:
equal: [pip-dist, << parameters.pkg-manager >>]
steps:
- run:
name: "Install dependencies with pip using project setup.py"
name: "Install dependencies with pip using project setup.py or pyproject.toml"
no_output_timeout: << parameters.no_output_timeout >>
working_directory: <<parameters.app-dir>>
command: |
Expand Down

0 comments on commit daafb89

Please sign in to comment.