Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#39 ⬆️ update default python version from 3.9.16 to 3.11.4 to… #42

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup Pyenv
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I (Informational): Need newer version of pyenv to install python 3.11.4

uses: gabrielfalcao/pyenv-action@v13
uses: gabrielfalcao/pyenv-action@v16
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Set up JDK 11
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ mvn clean install -Dhabushu.pythonVersion=3.10.4

The desired version of Python to use. Habushu delegates to `pyenv` for managing versions of Python depending on the configuration `usePyenv`.

Default: `3.9.13`
Default: `3.11.4`

#### usePyenv ####

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,35 @@ public class InitializeHabushuMojo extends AbstractHabushuMojo {
@Override
public void execute() throws MojoExecutionException, MojoFailureException {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I (Informational): recommend hiding whitespace

getLog().info("Validating Poetry-based project structure...");
PoetryCommandHelper poetryHelper = createPoetryCommandHelper();
poetryHelper.execute(Arrays.asList("check"));

String currentPythonPackageVersion = poetryHelper.execute(Arrays.asList("version", "-s"));
String pomVersion = project.getVersion();
String expectedPythonPackageVersion = getPythonPackageVersion(pomVersion, false, null);

if (!StringUtils.equals(currentPythonPackageVersion, expectedPythonPackageVersion)) {
if (overridePackageVersion) {
getLog().info(String.format("Setting Poetry package version to %s", expectedPythonPackageVersion));
getLog().info(
"If you do *not* want the Poetry package version to be automatically synced with the POM version, set <overridePackageVersion>false</overridePackageVersion> in the plugin's <configuration>");
poetryHelper.executeAndLogOutput(Arrays.asList("version", expectedPythonPackageVersion));
} else {
getLog().debug(String.format(
"Poetry package version set to %s in pyproject.toml does not align with expected POM-derived version of %s",
currentPythonPackageVersion, expectedPythonPackageVersion));
}

}
getLog().info("Validating Poetry-based project structure...");
PoetryCommandHelper poetryHelper = createPoetryCommandHelper();
try {
poetryHelper.execute(Arrays.asList("check"));
} catch (HabushuException e) {
Copy link
Contributor Author

@d-ryan-ashcraft d-ryan-ashcraft Aug 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to occur when you update the minimum python version in your pyproject.toml. It is easy to remiediate, so we catch the error and have poetry resync pypoject.toml and poetry.lock. If it were to fail during this, the error would be throw to the user.

getLog().debug("Failure encountered while running 'poetry check'!", e);
getLog().warn("poetry check failed (debug contains more details) - this is likely due to a "
+ "mismatch between your pyproject.toml and poetry.lock file - attempting to correct...");
poetryHelper.execute(Arrays.asList("lock", "--no-update"));
getLog().warn("Corrected - pyproject.toml and poetry.lock now synced");
}

String currentPythonPackageVersion = poetryHelper.execute(Arrays.asList("version", "-s"));
String pomVersion = project.getVersion();
String expectedPythonPackageVersion = getPythonPackageVersion(pomVersion, false, null);

if (!StringUtils.equals(currentPythonPackageVersion, expectedPythonPackageVersion)) {
if (overridePackageVersion) {
getLog().info(String.format("Setting Poetry package version to %s", expectedPythonPackageVersion));
getLog().info(
"If you do *not* want the Poetry package version to be automatically synced with the POM version, set <overridePackageVersion>false</overridePackageVersion> in the plugin's <configuration>");
poetryHelper.executeAndLogOutput(Arrays.asList("version", expectedPythonPackageVersion));
} else {
getLog().debug(String.format(
"Poetry package version set to %s in pyproject.toml does not align with expected POM-derived version of %s",
currentPythonPackageVersion, expectedPythonPackageVersion));
}

}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PyenvAndPoetrySetup {
* Specifies the semver compliant requirement for the default version of Python that
* must be installed and available for Habushu to use.
*/
static final String PYTHON_DEFAULT_VERSION_REQUIREMENT = "3.9.16";
static final String PYTHON_DEFAULT_VERSION_REQUIREMENT = "3.11.4";

/**
* Specifies the semver compliant requirement for the version of Poetry that
Expand Down
2 changes: 1 addition & 1 deletion habushu-mixology-consumer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Eric Konieczny <[email protected]>"]
license = "MIT License"

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.11"
habushu-mixology = {path = "../habushu-mixology", develop = true}

[tool.poetry.dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion habushu-mixology/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Eric Konieczny <[email protected]>"]
license = "MIT License"

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.11"
krausening = "17"
cryptography = "^41.0.3"
uvicorn = {version = "^0.18.0", extras = ["standard"]}
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<tag>HEAD</tag>
</scm>

<properties>
<!-- override parent POM until it is next upgrade (arguably, this property should not be in parent at all: -->
<version.python.default>3.11.4</version.python.default>
</properties>

<dependencyManagement>
<dependencies>
<!-- Explicitly upgrading transitive dependency for habushu-maven-plugin
Expand Down