Skip to content

Commit

Permalink
Get rid of noxfile & setup try using helper script instead
Browse files Browse the repository at this point in the history
  • Loading branch information
arjxn-py committed May 30, 2024
1 parent c396b55 commit bd65487
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 68 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,19 @@ jobs:
with:
python-version: "3.10"

- name: Install pipx
run: python -m pip install --user pipx

- name: Install build using pipx
run: pipx install build

- name: Set BUILD_RAGNA_BASE environment variable
- name: Install build dependencies
run: |
if [ "${{ matrix.package }}" == "ragna-base" ]; then
echo "BUILD_RAGNA_BASE=1" >> $GITHUB_ENV
else
echo "BUILD_RAGNA_BASE=" >> $GITHUB_ENV
fi
python -m pip install --upgrade pip
python -m pip install build toml
- name: Modify pyproject.toml
run: python scripts/build_helper.py ${{ matrix.package }}

- name: Build distribution
run: |
echo "Building package: ${{ matrix.package }}"
pipx run build
python -m build
echo "Build complete for ${{ matrix.package }}"
- name: Verify package
run: |
Expand Down
27 changes: 0 additions & 27 deletions noxfile.py

This file was deleted.

30 changes: 30 additions & 0 deletions scripts/build_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import toml


def modify_pyproject(package_name):
with open("pyproject.toml", "r") as f:
pyproject_data = toml.load(f)

pyproject_data["project"]["name"] = package_name

if package_name == "ragna-base":
pyproject_data["tool"]["setuptools"]["dynamic"]["dependencies"] = {
"file": ["requirements-base.txt"]
}
else:
pyproject_data["tool"]["setuptools"]["dynamic"]["dependencies"] = {
"file": ["requirements.txt"]
}

with open("pyproject.toml", "w") as f:
toml.dump(pyproject_data, f)


if __name__ == "__main__":
import sys

package_name = sys.argv[1]
if package_name not in ["ragna", "ragna-base"]:
print("Invalid package name. Must be 'ragna' or 'ragna-base'.")
sys.exit(1)
modify_pyproject(package_name)
28 changes: 0 additions & 28 deletions setup.py

This file was deleted.

0 comments on commit bd65487

Please sign in to comment.