Comments (4)
Have you tried using the requirementsFiles
and sortPaths
options to specify which requirements should be installed & then restrict import sorting to the relevant subdirectory? e.g.
name: Run isort
on:
- push
jobs:
lint-foo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: isort/isort-action@master
with:
requirementsFiles: "my-proj/sub-proj-foo/requirements.txt"
sortPaths: "my-proj/sub-proj-foo"
lint-bar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: isort/isort-action@master
with:
requirementsFiles: "my-proj/sub-proj-bar/requirements.txt"
sortPaths: "my-proj/sub-proj-bar"
from isort-action.
Ah I glossed over that. That works for some of our packages, others (that need to be published to an internal registry) use a setup.py
, so the pip install -r "$file"
in bin/install_packages
won't quite work. We also run some other steps in this workflow where it'd be convenient to not have the pip install
command be bundled with a linting step, but rather done separately with some auth handling for our internal registry. Or is there something else for running, say, a pip install . .[test]
?
from isort-action.
did a quick test, I loaded up a virtualenv and did the equivalent of:
(my-venv) $ cd my-proj
(my-venv) $ isort --check --diff --profile=black .
(my-venv) $ cd sub-proj-foo
(my-venv) $ isort --check --diff --profile=black .
and got different results. Keeping the venv constant should basically have the same effect as running bin/install_packages $PYTHON_VERSION sub-proj-foo/requirements.txt
right? So then maybe isort
itself is finicky about the path?
from isort-action.
We also run some other steps in this workflow where it'd be convenient to not have the pip install command be bundled with a linting step.
Should be totally possible with the current setup. Just exclude the requirementsFiles
input and perform whatever setup is required in an earlier step. e.g.
...
jobs:
lint-foo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: echo "Installed the required dependencies here..."
- uses: isort/isort-action@master
with:
sortPaths: "my-proj/sub-proj-foo"
... and got different results ... So then maybe isort itself is finicky about the path?
Out of curiosity, what were the differences? It would be easier to say definitively if there was a repro you could share.
Note that if each of the subdirectories has its own config file with different isort settings, the plugin would currently require you to override the default for the configuration
input. (Current default is --check-only --diff
, and you'd need to update it to something like --check-only --diff --settings-file=my-proj/sub-proj-foo/.isort.cfg
)
An alternative would be to add support for another option named something like workingDirectory
that would update the working directory of the step & all commands would be run from that relative path. (Which would avoid the need to leak config into the plugin via the configuration
input)
from isort-action.
Related Issues (16)
- Isort version is not optional if setting `requirementsFiles` HOT 4
- Isort fails with isort: command not found HOT 4
- install_packages redirects output to /dev/null HOT 2
- How to exclude specific path? HOT 1
- README typo: configuration default value
- Error: Unable to process file command 'output' successfully HOT 4
- Configuration parameters not parsed correctly
- @v1 HOT 2
- New release to quench the GitHub deprecation warning for `::set-output` HOT 2
- MacOS action + `md5sum` with 1.1.0
- How to run isort-action so that it auto-fixes the code? HOT 1
- Add test cases for problem matcher logic HOT 2
- Action fails due to missing dependency on `colorama` HOT 2
- No verbosity at all for succesful checks HOT 4
- ensure_python: No such file or directory HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from isort-action.