Skip to content

Commit 6ce2eb0

Browse files
n0tl3ssgraemerocher
andcommitted
Add Python guide support
Add Python samples, documentation, metadata, and guide build support for the Micronaut Guides Python branch. Co-authored-by: Graeme Rocher <graeme.rocher@oracle.com> Co-authored-by: Nemanja Mikic <n0t_l3ss@outlook.com> Co-authored-by: Nemanja Mikic <nemanja.mikic@oracle.com>
1 parent 7a8b617 commit 6ce2eb0

1,410 files changed

Lines changed: 33394 additions & 659 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/gradle.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ on:
33
push:
44
branches:
55
- master
6+
- python
67
pull_request:
78
branches:
89
- master
10+
- python
911
jobs:
1012
test_matrix:
1113
name: Generate Guide Test Matrix
@@ -17,6 +19,11 @@ jobs:
1719
- uses: actions/checkout@v6.0.2
1820
with:
1921
fetch-depth: 0
22+
- uses: actions/checkout@v6.0.2
23+
with:
24+
repository: micronaut-projects/micronaut-starter
25+
ref: 5.2.x
26+
path: micronaut-starter
2027
- name: Generate Guide Test Matrix
2128
id: test_matrix_step
2229
env:
@@ -45,6 +52,11 @@ jobs:
4552
- uses: actions/checkout@v6.0.2
4653
with:
4754
fetch-depth: 0
55+
- uses: actions/checkout@v6.0.2
56+
with:
57+
repository: micronaut-projects/micronaut-starter
58+
ref: 5.2.x
59+
path: micronaut-starter
4860
- uses: actions/cache@v5.0.5
4961
with:
5062
path: ~/.gradle/caches
@@ -62,3 +74,4 @@ jobs:
6274
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
6375
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
6476
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
77+
LOCAL_GIT_MICRONAUT_STARTER: ${{ github.workspace }}/micronaut-starter

‎.github/workflows/python-scripts.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ on:
33
push:
44
branches:
55
- master
6+
- python
67
paths:
78
- '.github/scripts/**'
89
- '.github/workflows/python-scripts.yml'
910
pull_request:
1011
branches:
1112
- master
13+
- python
1214
paths:
1315
- '.github/scripts/**'
1416
- '.github/workflows/python-scripts.yml'

‎buildSrc/build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ repositories {
3636
}
3737

3838
ext {
39-
micronautStarterVersion = "5.1.3"
39+
micronautStarterVersion = "5.2.0-SNAPSHOT"
4040
}
4141

4242
dependencies {

‎buildSrc/settings.gradle‎

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
mavenCentral()
5+
}
6+
}
7+
8+
rootProject.name = "micronaut-guides-buildsrc"
9+
10+
def micronautCoreModules = [
11+
'micronaut-aop',
12+
'micronaut-buffer-netty',
13+
'micronaut-context',
14+
'micronaut-context-propagation',
15+
'micronaut-context-python',
16+
'micronaut-core',
17+
'micronaut-core-bom',
18+
'micronaut-core-processor',
19+
'micronaut-core-reactive',
20+
'micronaut-discovery-core',
21+
'micronaut-function',
22+
'micronaut-function-client',
23+
'micronaut-function-web',
24+
'micronaut-graal',
25+
'micronaut-http',
26+
'micronaut-http-client',
27+
'micronaut-http-client-core',
28+
'micronaut-http-client-jdk',
29+
'micronaut-http-netty',
30+
'micronaut-http-netty-http3',
31+
'micronaut-http-server',
32+
'micronaut-http-server-netty',
33+
'micronaut-http-validation',
34+
'micronaut-inject',
35+
'micronaut-inject-groovy',
36+
'micronaut-inject-java',
37+
'micronaut-inject-kotlin',
38+
'micronaut-inject-python',
39+
'micronaut-jackson-core',
40+
'micronaut-jackson-databind',
41+
'micronaut-json-core',
42+
'micronaut-management',
43+
'micronaut-messaging',
44+
'micronaut-module-info',
45+
'micronaut-module-info-runtime',
46+
'micronaut-retry',
47+
'micronaut-router',
48+
'micronaut-runtime',
49+
'micronaut-runtime-osx',
50+
'micronaut-websocket'
51+
]
52+
53+
def micronautStarterModules = [
54+
'micronaut-starter-core': ':starter-core',
55+
'micronaut-starter-api': ':starter-api',
56+
'micronaut-starter-aws-cdk': ':starter-aws-cdk',
57+
'micronaut-starter-aws-lambda': ':starter-aws-lambda',
58+
'micronaut-starter-azure-function': ':starter-azure-function',
59+
'micronaut-starter-gcp-function': ':starter-gcp-function',
60+
'micronaut-starter-web-netty': ':starter-web-netty',
61+
'micronaut-starter-web-servlet': ':starter-web-servlet',
62+
'micronaut-cli': ':micronaut-cli'
63+
]
64+
65+
def pyronautModules = [
66+
'micronaut-pyronaut': ':micronaut-pyronaut',
67+
'micronaut-pyronaut-bom': ':micronaut-pyronaut-bom',
68+
'micronaut-pyronaut-config-model': ':micronaut-pyronaut-config-model',
69+
'micronaut-pyronaut-install': ':micronaut-pyronaut-install',
70+
'micronaut-pyronaut-logging': ':micronaut-pyronaut-logging',
71+
'micronaut-pyronaut-logback': ':micronaut-pyronaut-logback',
72+
'micronaut-pyronaut-native-build': ':micronaut-pyronaut-native-build',
73+
'micronaut-pyronaut-processor': ':micronaut-pyronaut-processor',
74+
'micronaut-pyronaut-pytest': ':micronaut-pyronaut-pytest',
75+
'micronaut-pyronaut-requests': ':micronaut-pyronaut-requests',
76+
'micronaut-pyronaut-run': ':micronaut-pyronaut-run',
77+
'micronaut-pyronaut-test': ':micronaut-pyronaut-test',
78+
'micronaut-pyronaut-test-resources-server': ':micronaut-pyronaut-test-resources-server',
79+
'micronaut-pyronaut-tui': ':micronaut-pyronaut-tui',
80+
'micronaut-pyronaut-validate-config': ':micronaut-pyronaut-validate-config'
81+
]
82+
83+
def localGitPath = { String propertyName, String environmentName ->
84+
providers.gradleProperty(propertyName).orNull ?:
85+
providers.environmentVariable(environmentName).orNull
86+
}
87+
88+
def discoverGraalPyBundleRepository = { File checkoutDir ->
89+
File bundleRoot = new File(checkoutDir, 'checkouts/maven-bundles/graalpy')
90+
if (!bundleRoot.isDirectory()) {
91+
return null
92+
}
93+
List<File> candidates = bundleRoot.listFiles()
94+
?.findAll { File file ->
95+
file.isDirectory() &&
96+
new File(file, 'org/graalvm/python/python').exists() &&
97+
new File(file, 'org/graalvm/python/python-embedding').exists()
98+
}
99+
?.sort { File left, File right -> right.lastModified() <=> left.lastModified() } ?: []
100+
candidates.isEmpty() ? null : candidates.first().absolutePath
101+
}
102+
103+
def isUsableGraalPyBundleRepository = { String repository ->
104+
repository != null &&
105+
new File(repository, 'org/graalvm/python/python').exists() &&
106+
new File(repository, 'org/graalvm/python/python-embedding').exists()
107+
}
108+
109+
def configureGraalPyBundleRepository = { File checkoutDir ->
110+
if (isUsableGraalPyBundleRepository(System.getProperty('micronaut.graalpy.bundle.repo'))) {
111+
return
112+
}
113+
String repository = discoverGraalPyBundleRepository(checkoutDir)
114+
if (repository != null) {
115+
System.setProperty('micronaut.graalpy.bundle.repo', repository)
116+
System.setProperty('pyronaut.graalpy.bundle.repo', repository)
117+
System.setProperty('org.gradle.project.micronaut.graalpy.bundle.repo', repository)
118+
System.setProperty('org.gradle.project.pyronaut.graalpy.bundle.repo', repository)
119+
}
120+
}
121+
122+
if (providers.gradleProperty('micronaut.include.graalpy.extensions').orNull == null &&
123+
System.getProperty('org.gradle.project.micronaut.include.graalpy.extensions') == null) {
124+
System.setProperty('org.gradle.project.micronaut.include.graalpy.extensions', 'false')
125+
}
126+
127+
def localMicronautCore = localGitPath(
128+
'local.git.micronaut-core',
129+
'LOCAL_GIT_MICRONAUT_CORE')
130+
File localMicronautCoreDir = localMicronautCore ? file(localMicronautCore) : null
131+
if (localMicronautCoreDir != null) {
132+
configureGraalPyBundleRepository(localMicronautCoreDir)
133+
}
134+
if (localMicronautCoreDir?.isDirectory() && new File(localMicronautCoreDir, '.git').exists()) {
135+
includeBuild(localMicronautCoreDir) {
136+
name = 'micronaut-core'
137+
dependencySubstitution {
138+
micronautCoreModules.each { moduleName ->
139+
substitute(module("io.micronaut:${moduleName}")).using(project(":${moduleName}"))
140+
}
141+
}
142+
}
143+
}
144+
145+
def localPyronaut = localGitPath(
146+
'local.git.pyronaut',
147+
'LOCAL_GIT_PYRONAUT')
148+
File localPyronautDir = localPyronaut ? file(localPyronaut) : null
149+
if (localPyronautDir != null) {
150+
configureGraalPyBundleRepository(localPyronautDir)
151+
}
152+
if (localPyronautDir?.isDirectory() && new File(localPyronautDir, '.git').exists()) {
153+
includeBuild(localPyronautDir) {
154+
name = 'pyronaut'
155+
dependencySubstitution {
156+
pyronautModules.each { artifactId, projectPath ->
157+
substitute(module("io.micronaut.pyronaut:${artifactId}")).using(project(projectPath))
158+
}
159+
}
160+
}
161+
}
162+
163+
def localMicronautStarter = localGitPath(
164+
'local.git.micronaut-starter',
165+
'LOCAL_GIT_MICRONAUT_STARTER')
166+
File localMicronautStarterDir = localMicronautStarter ? file(localMicronautStarter) : null
167+
if (localMicronautStarterDir?.isDirectory() && new File(localMicronautStarterDir, '.git').exists()) {
168+
includeBuild(localMicronautStarterDir) {
169+
name = 'micronaut-starter'
170+
dependencySubstitution {
171+
micronautStarterModules.each { artifactId, projectPath ->
172+
substitute(module("io.micronaut.starter:${artifactId}")).using(project(projectPath))
173+
}
174+
}
175+
}
176+
}

0 commit comments

Comments
 (0)