-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hatch build and corresponding GH action
- Loading branch information
Showing
10 changed files
with
237 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Build and upload to PyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
# pull_request: | ||
# push: | ||
# branches: | ||
# - main | ||
release: | ||
types: | ||
- published | ||
|
||
env: | ||
CIBW_BUILD: cp310* cp311* cp312* cp313* | ||
CIBW_ARCHS_MACOS: auto universal2 | ||
CIBW_TEST_SKIP: "*universal2:arm64" | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
# macos-13 is an intel runner, macos-14 is apple silicon | ||
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-sdist | ||
path: dist/*.tar.gz | ||
|
||
upload_pypi: | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) | ||
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
# unpacks all CIBW artifacts into dist/ | ||
pattern: cibw-* | ||
path: dist | ||
merge-multiple: true | ||
|
||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_BLUESKY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from pathlib import Path | ||
from hatchling.builders.hooks.plugin.interface import BuildHookInterface | ||
|
||
from setuptools import Distribution, Extension | ||
from setuptools.command import build_ext | ||
|
||
def get_numpy_include(): | ||
import numpy | ||
return [numpy.get_include()] | ||
|
||
|
||
class CustomHook(BuildHookInterface): | ||
def initialize(self, version, build_data): | ||
print(version, build_data) | ||
extensions = [ | ||
Extension('bluesky.tools.geo._cgeo', ['bluesky/tools/geo/src_cpp/_cgeo.cpp']), | ||
Extension('bluesky.traffic.asas.cstatebased', ['bluesky/traffic/asas/src_cpp/cstatebased.cpp'], include_dirs=['bluesky/tools/geo/src_cpp'])] | ||
|
||
dist = Distribution(dict(name='extended', include_dirs=get_numpy_include(), | ||
ext_modules=extensions)) | ||
dist.package_dir = "extended" | ||
cmd = build_ext.build_ext(dist) | ||
cmd.verbose = True # type: ignore | ||
cmd.ensure_finalized() # type: ignore | ||
cmd.run() | ||
buildpath = Path(cmd.build_lib) | ||
|
||
# Provide locations of compiled modules | ||
force_include = {(buildpath / cmd.get_ext_filename('bluesky.tools.geo._cgeo')).as_posix(): cmd.get_ext_filename('bluesky.tools.geo._cgeo'), | ||
(buildpath / cmd.get_ext_filename('bluesky.traffic.asas.cstatebased')).as_posix(): cmd.get_ext_filename('bluesky.traffic.asas.cstatebased')} | ||
|
||
build_data['pure_python'] = False | ||
build_data['infer_tag'] = True | ||
build_data['force_include'].update(force_include) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[project] | ||
name = "bluesky-guidata" | ||
version = "1.0.0" | ||
|
||
authors = [ | ||
{ name="Joost Ellerbroek", email="[email protected]" }, | ||
{ name="Jacco Hoekstra", email="[email protected]" } | ||
] | ||
|
||
description = "Resources for the BlueSky Open ATM Simulator GUI" | ||
readme = "../../README.md" | ||
requires-python = ">=3.10" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"Development Status :: 4 - Beta", | ||
|
||
"Intended Audience :: Science/Research", | ||
"Topic :: Scientific/Engineering", | ||
|
||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", | ||
|
||
"Operating System :: OS Independent", | ||
] | ||
keywords = ['ATM', 'transport', 'simulation', 'aviation', 'aircraft'] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/TUDelft-CNS-ATM/bluesky" | ||
Issues = "https://github.com/TUDelft-CNS-ATM/bluesky/issues" | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.hatch.build.targets.sdist.force-include] | ||
"../../bluesky/resources/graphics" = "bluesky/resources/graphics" | ||
"../../bluesky/resources/html" = "bluesky/resources/html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
[project] | ||
name = "bluesky-simulator" | ||
# dynamic = ["version"] | ||
version = "1.0.0" | ||
dependencies = [ | ||
"numpy >= 2.0.0", | ||
"scipy >= 1.13.0", | ||
"matplotlib >= 3.9.0", | ||
"pandas >= 2.2.0", | ||
"msgpack >= 1.0.0", | ||
"zmq" | ||
] | ||
|
||
authors = [ | ||
{ name="Joost Ellerbroek", email="[email protected]" }, | ||
{ name="Jacco Hoekstra", email="[email protected]" } | ||
] | ||
|
||
description = "The Open Air Traffic Simulator." | ||
readme = "README.md" | ||
license = {file = "LICENSE"} | ||
requires-python = ">=3.10" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"Development Status :: 4 - Beta", | ||
|
||
"Intended Audience :: Science/Research", | ||
"Topic :: Scientific/Engineering", | ||
|
||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", | ||
|
||
"Operating System :: OS Independent", | ||
] | ||
keywords = ['ATM', 'transport', 'simulation', 'aviation', 'aircraft'] | ||
|
||
[project.optional-dependencies] | ||
pygame = ["pygame"] | ||
qt6 = [ | ||
"pyopengl", | ||
"PyQt6", | ||
"PyQt6-WebEngine", | ||
"bluesky-guidata" | ||
] | ||
console = ["textual"] | ||
full =[ | ||
"pygame", | ||
"pyopengl", | ||
"PyQt6", | ||
"PyQt6-WebEngine", | ||
"textual", | ||
"bluesky-guidata", | ||
] | ||
# For headless (server-only) bluesky environment: pip install bluesky-simulator[headless] | ||
headless = [ | ||
# no extra dependencies | ||
] | ||
|
||
[project.scripts] | ||
bluesky = "bluesky.__main__:main" | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/TUDelft-CNS-ATM/bluesky" | ||
Issues = "https://github.com/TUDelft-CNS-ATM/bluesky/issues" | ||
Documentation = "https://github.com/TUDelft-CNS-ATM/bluesky/wiki" | ||
Repository = "https://github.com/TUDelft-CNS-ATM/bluesky" | ||
# Changelog = "https://github.com/me/spam/blob/master/CHANGELOG.md" | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.hatch.build] | ||
include = [ | ||
"bluesky/*", | ||
] | ||
exclude = [ | ||
'docs', | ||
'utils', | ||
'bluesky/test', | ||
'bluesky/resources/graphics', | ||
'bluesky/resources/html' | ||
] | ||
|
||
|
||
[tool.hatch.build.targets.wheel.hooks.custom] | ||
dependencies = ["setuptools>=69.1.1", "numpy"] | ||
|
||
# [tool.hatch.build.targets.wheel.hooks.cython] | ||
# dependencies = ["hatch-cython"] | ||
|
||
# [tool.hatch.build.targets.wheel.hooks.cython.options] | ||
# # include .h or .cpp directories | ||
# includes = [] | ||
# # include numpy headers | ||
# include_numpy = true |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.