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

Detect newly created virtual environment's name correctly for uv 0.4.13+ #20

Closed
wants to merge 2 commits into from
Closed
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
12 changes: 4 additions & 8 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ ij_kotlin_field_annotation_wrap = normal
ij_kotlin_finally_on_new_line = false
ij_kotlin_if_rparen_on_new_line = true
ij_kotlin_import_nested_classes = false
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**
ij_kotlin_indent_before_arrow_on_new_line = true
ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
ij_kotlin_keep_blank_lines_before_right_brace = 1
ij_kotlin_keep_blank_lines_in_code = 2
Expand All @@ -82,9 +81,9 @@ ij_kotlin_method_call_chain_wrap = normal
ij_kotlin_method_parameters_new_line_after_left_paren = true
ij_kotlin_method_parameters_right_paren_on_new_line = true
ij_kotlin_method_parameters_wrap = on_every_item
ij_kotlin_name_count_to_use_star_import = 2147483647
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
ij_kotlin_packages_to_use_import_on_demand =
ij_kotlin_name_count_to_use_star_import = 100
ij_kotlin_name_count_to_use_star_import_for_members = 100
ij_kotlin_packages_to_use_import_on_demand = java.util.*, kotlinx.android.synthetic.**, io.ktor.**
ij_kotlin_parameter_annotation_wrap = normal
ij_kotlin_space_after_comma = true
ij_kotlin_space_after_extend_colon = true
Expand Down Expand Up @@ -148,9 +147,6 @@ ij_yaml_block_mapping_on_new_line = true
ij_yaml_indent_sequence_value = true
ij_yaml_keep_indents_on_empty_lines = true
ij_yaml_keep_line_breaks = true
ij_yaml_line_comment_add_space = false
ij_yaml_line_comment_add_space_on_reformat = false
ij_yaml_line_comment_at_first_column = true
ij_yaml_sequence_on_new_line = true
ij_yaml_space_before_colon = false
ij_yaml_spaces_within_braces = true
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
chmod +x ./gradlew
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
CHANGELOG="$(python scripts/changelog.py $VERSION)"
CHANGELOG="$(python .scripts/changelog.py $VERSION)"

echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python scripts/edit_releases.py ${{ needs.build.outputs.version }}
python .scripts/edit_releases.py ${{ needs.build.outputs.version }}

test:
name: Test
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
version: latest
-
name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v3.1.0
-
name: Set up Ruff
run: |
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
java-version: 21
-
name: Run Qodana
uses: JetBrains/[email protected]
uses: JetBrains/[email protected].3
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
with:
Expand Down Expand Up @@ -330,5 +330,5 @@ jobs:
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
run: |
chmod +x ./gradlew
NIGHTLY_VERSION=$(python scripts/modify_version_for_nightly.py)
NIGHTLY_VERSION=$(python .scripts/modify_version_for_nightly.py)
./gradlew publishPlugin -Pchannel=Nightly -PpluginVersion=${NIGHTLY_VERSION}
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
scripts/*
!scripts/changelog.py
!scripts/edit_releases.py
!scripts/modify_version_for_nightly.py
!scripts/command_specs.py
.scripts/*
!.scripts/changelog.py
!.scripts/edit_releases.py
!.scripts/modify_version_for_nightly.py
!.scripts/command_specs.py

.run/*
!.run/Build.run.xml
Expand All @@ -13,9 +13,9 @@ scripts/*
TODO.md
.credentials/

.venv/
.sources/
site/
venv/

pyrightconfig.json
ruff.toml
Expand Down
8 changes: 4 additions & 4 deletions .idea/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 24 additions & 24 deletions .run/Run Plugin.run.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Plugin" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="IDE logs" path="$PROJECT_DIR$/build/idea-sandbox/*/log/idea.log" show_all="true"/>
<ExternalSystemSettings>
<option name="executionName"/>
<option name="externalProjectPath" value="$PROJECT_DIR$"/>
<option name="externalSystemIdString" value="GRADLE"/>
<option name="scriptParameters" value=""/>
<option name="taskDescriptions">
<list/>
</option>
<option name="taskNames">
<list>
<option value="runIde"/>
</list>
</option>
<option name="vmOptions" value=""/>
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2"/>
</configuration>
</component>
<configuration default="false" name="Run Plugin" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIde" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
48 changes: 24 additions & 24 deletions .run/Run Tests.run.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log"/>
<ExternalSystemSettings>
<option name="executionName"/>
<option name="externalProjectPath" value="$PROJECT_DIR$"/>
<option name="externalSystemIdString" value="GRADLE"/>
<option name="scriptParameters" value=""/>
<option name="taskDescriptions">
<list/>
</option>
<option name="taskNames">
<list>
<option value="check"/>
</list>
</option>
<option name="vmOptions" value=""/>
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>true</RunAsTest>
<method v="2"/>
</configuration>
</component>
<configuration default="false" name="Run Tests" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="check" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>true</RunAsTest>
<method v="2" />
</configuration>
</component>
48 changes: 24 additions & 24 deletions .run/Run Verifications.run.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Verifications" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log"/>
<ExternalSystemSettings>
<option name="executionName"/>
<option name="externalProjectPath" value="$PROJECT_DIR$"/>
<option name="externalSystemIdString" value="GRADLE"/>
<option name="scriptParameters" value=""/>
<option name="taskDescriptions">
<list/>
</option>
<option name="taskNames">
<list>
<option value="verifyPlugin"/>
</list>
</option>
<option name="vmOptions" value=""/>
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2"/>
</configuration>
</component>
<configuration default="false" name="Run Verifications" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="verifyPlugin" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
File renamed without changes.
40 changes: 10 additions & 30 deletions scripts/command_specs.py → .scripts/command_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from __future__ import annotations

import json
import re
import subprocess
from pathlib import Path
from typing import Literal, Self
Expand All @@ -23,15 +22,7 @@
from nccsp import parse_commands
from pydantic import BaseModel, Field

type _Executable = Literal['ruff', 'uv', 'uvx', 'rye']


_rye_version_details = re.compile(
r'''(?mx)
^rye\s+(?P<version>\S+)\n
.*?(?P=version)\s*(?P<commit_and_date>.+)
'''
)
type _Executable = Literal['ruff', 'uv', 'uvx']


def _is_option(option_or_argument: nccsp.OptionOrArgument) -> bool:
Expand Down Expand Up @@ -63,31 +54,21 @@ def convert(cls, command: nccsp.Command) -> Self:


def _get_version(executable: _Executable) -> str:
match executable:
case 'ruff' | 'uv':
argument = 'version'
case 'uvx' | 'rye':
argument = '--version'
argument = 'version'

output = subprocess.check_output([executable, argument]).decode('utf-8').strip()
if executable == 'uvx':
argument = '--' + argument

if executable == 'rye':
version_details = _rye_version_details.search(output)
output = f'rye {version_details['version']} {version_details['commit_and_date']}'

return output
return subprocess.check_output([executable, argument]).decode('utf-8').strip()


def _get_data(executable: _Executable) -> list[nccsp.Command]:
match executable:
case 'ruff' | 'uv':
arguments = ['generate-shell-completion']
case 'uvx':
arguments = ['--generate-shell-completion']
case 'rye':
arguments = ['self', 'completion', '--shell']
argument = 'generate-shell-completion'

if executable == 'uvx':
argument = '--' + argument

output_stream = subprocess.check_output([executable, *arguments, 'nushell'])
output_stream = subprocess.check_output([executable, argument, 'nushell'])
output = output_stream.decode('utf-8')

return parse_commands(output)
Expand Down Expand Up @@ -138,7 +119,6 @@ def main() -> None: # noqa: D103
_get_and_dump_data('ruff')
_get_and_dump_data('uv')
_get_and_dump_data('uvx')
_get_and_dump_data('rye')


if __name__ == '__main__':
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ You can also download the ZIP files manually from [the <i>Releases</i> tab][10],
and follow the instructions described [here][13].

Currently supported versions:
2024.3 (build 243.15521.16) - 2024.3.* (build 243.*).
2024.2 (build 242.20224.347) - 2024.2.* (build 242.*).


## Credits
Expand Down
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ dependencies {

// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
intellijPlatform {
buildSearchableOptions = false

pluginConfiguration {
name = providers.gradleProperty("pluginName")
version = providers.gradleProperty("pluginVersion")
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RyeCharm is the all-in-one PyCharm plugin for Astral-backed Python tools:
[Ruff][1], [uv][2] and [Rye][3].

This plugin only supports the latest versions of the tools
and can only be installed on PyCharm 2024.3 and later.
and can only be installed on PyCharm 2024.2 and later.


## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/other-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ are replaced with the tools' logos:
## New terminal autocompletion

If the [new terminal][4] is used,
autocompletion will be provided for `ruff`, `uv`, `uvx` and `rye` commands.
autocompletion will be provided for `ruff`, `uv` and `uvx` commands.

![](./assets/features-new-terminal-autocompletion-demo.png)

Expand Down
Loading
Loading