Skip to content

Commit b4d85dd

Browse files
authored
Package config (#57)
* Package config * Github workflows Co-authored-by: TJ Murphy <[email protected]>
1 parent 154b017 commit b4d85dd

File tree

7 files changed

+120
-59
lines changed

7 files changed

+120
-59
lines changed

Diff for: .github/workflows/build-and-release.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build and release the Python Package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- version.md
9+
workflow_call:
10+
secrets:
11+
PYPI_USERNAME:
12+
required: true
13+
PYPI_PASSWORD:
14+
required: true
15+
16+
jobs:
17+
bump-version:
18+
name: Bump package version
19+
if: "!contains(github.event.head_commit.message, 'Bump version')"
20+
runs-on: ubuntu-20.04
21+
steps:
22+
- name: actions/checkout
23+
uses: actions/checkout@v4
24+
with:
25+
persist-credentials: false
26+
- name: current_version
27+
run: echo "current_version=$(grep '# version' version.md | cut -d ' ' -f3)" >> $GITHUB_ENV
28+
- name: FragileTech/bump-version
29+
uses: FragileTech/bump-version@main
30+
with:
31+
current_version: "${{ env.current_version }}"
32+
files: version.md
33+
commit_name: Titan Systems Bot
34+
commit_email: [email protected]
35+
login: titan-systems-bot
36+
token: "${{ secrets.BOT_TOKEN }}"
37+
38+
create-tag:
39+
needs: bump-version
40+
runs-on: ubuntu-20.04
41+
steps:
42+
- name: actions/checkout
43+
uses: actions/checkout@v4
44+
- name: Create Tag
45+
run: |
46+
new_version=$(grep '# version' version.md | cut -d ' ' -f3)
47+
git tag v$new_version
48+
git push origin v$new_version
49+
50+
build-and-upload:
51+
needs: create-tag
52+
runs-on: ubuntu-20.04
53+
steps:
54+
- name: actions/checkout
55+
uses: actions/checkout@v4
56+
- name: Set up Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: '3.9'
60+
- name: Build and upload to PyPI
61+
run: |
62+
make submit
63+
env:
64+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
65+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

Diff for: .github/workflows/bump-version.yml

-30
This file was deleted.

Diff for: .github/workflows/python-package.yml renamed to .github/workflows/run-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test and Lint Python Package
1+
name: Run Tests
22

33
on:
44
push:

Diff for: MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include version.md

Diff for: Makefile

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,10 @@ docs:
3131
python tools/generate_resource_docs.py
3232

3333
coverage: clean
34-
python tools/check_resource_coverage.py
34+
python tools/check_resource_coverage.py
35+
36+
package: clean
37+
python -m build
38+
39+
submit: package
40+
python -m twine upload dist/*

Diff for: setup.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
from setuptools import find_packages, setup
22

3+
34
setup(
4-
name="titan",
5+
name="titan-core",
6+
# Package version is managed by the string inside version.md. By default,
7+
# setuptools doesnt copy this file into the build package. So we direct
8+
# setuptools to include it using the `include_package_data=True` option
9+
# as well as the MANIFEST.in file which has the `include version.md` directive.
510
version=open("version.md", encoding="utf-8").read().split(" ")[2],
11+
include_package_data=True,
612
description="Titan Core: Snowflake infrastructure as code",
713
long_description=open("README.md", encoding="utf-8").read(),
814
long_description_content_type="text/markdown",
915
url="https://github.com/Titan-Systems/titan",
1016
author="TJ Murphy",
1117
packages=find_packages(include=["titan", "titan.*"]),
1218
python_requires=">=3.9",
19+
project_urls={
20+
"Homepage": "https://github.com/Titan-Systems/titan",
21+
},
1322
classifiers=[
14-
"Development Status :: 3 - Alpha",
23+
"Development Status :: 4 - Beta",
24+
"License :: OSI Approved :: Apache Software License",
1525
"Intended Audience :: Developers",
1626
"Operating System :: OS Independent",
1727
"Programming Language :: Python :: 3 :: Only",
1828
"Programming Language :: SQL",
1929
"Topic :: Database",
20-
"Framework :: Titan",
2130
],
2231
install_requires=[
2332
"click>=8.1.7",
@@ -31,6 +40,7 @@
3140
extras_require={
3241
"dev": [
3342
"black",
43+
"build",
3444
"codespell==2.2.6",
3545
"pytest-cov",
3646
"pytest-profiling",
@@ -39,6 +49,7 @@
3949
"ruff",
4050
"snowflake-cli-labs",
4151
"tabulate",
52+
"twine!=5.1.0",
4253
]
4354
},
4455
)

0 commit comments

Comments
 (0)