Skip to content

Use RegEx to detect poetry's dependencies sections to support custom groups #5

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ An extension for managing Python dependencies. At the moment it only supports py

![2021-02-28 16 40 01](https://user-images.githubusercontent.com/667029/109424385-b2d87780-79e3-11eb-85e9-6931063f4210.gif)


## ❤️ Contributing

- Fork and clone repository:

```shell
[email protected]:<your-fork>/python-dependencies-vscode.git
cd python-dependencies-vscode
```
- Install dependencies
```shell

npm install
```
- Run extension using VS Code's "Run and Debug" menu, select `Run Extension` option


## Roadmap

- [ ] Add support for updating dependencies
Expand Down
6 changes: 2 additions & 4 deletions src/utils/parsing/toml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ export const findDependencies = (text: string) => {
if (line.startsWith("[")) {
lastSection = line.replace(/^\[/, "").replace(/\]$/, "");
} else {
const poetryDependenciesRe = new RegExp("^tool\.poetry\..*dependencies$")
if (
[
"tool.poetry.dependencies",
"tool.poetry.dev-dependencies",
].includes(lastSection)
poetryDependenciesRe.test(lastSection)
) {
const dep = parseDependency(line, index);

Expand Down