Skip to content

Commit 1930d81

Browse files
committed
Fixed #1008 Support venv in test.sh
1 parent 0107d39 commit 1930d81

File tree

3 files changed

+34
-37
lines changed

3 files changed

+34
-37
lines changed

docs/Contribute.ipynb

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -86,41 +86,41 @@
8686
"cell_type": "markdown",
8787
"metadata": {},
8888
"source": [
89-
"## Make your Changes\n",
90-
"\n",
91-
"When working on a new project, there are often going to be dependencies. In order to isolate dependencies between different projects, it's a good practice to use a virtual environment. STUMPY supports both [venv](https://docs.python.org/3/library/venv.html) and [conda](https://docs.conda.io/en/latest/). After creating and activating either of these virtual environments, any dependencies you install will be isolated (so they don't break anything else on your system).\n",
92-
"\n",
93-
"First, install the dependencies using the [From Source Section](https://stumpy.readthedocs.io/en/latest/install.html#from-source) of the installation instructions. If you are building STUMPY within a conda environment, then you may consider using the `conda.sh` shell script which will automatically assist you in installing all of the required dependencies required for testing. \n",
89+
"## Adhere to CONTRIBUTING.md Guidance\n",
9490
"\n",
95-
"A good check to make sure everything is working 100% is to run the unit tests. For STUMPY, we have scripts to help you do that. You'll run `./setup.sh && ./test.sh`. In some cases, you may notice an uninstallation message for STUMPY but don't worry. This happens if you have had previously installed STUMPY as the `./setup.sh` command first uninstalls any existing version of STUMPY and then it will re-installs it from source (the local, cloned, development version). So, everything should be all set.\n",
91+
"One of the great benefits of open source is the ability to collaborate with developers from around the world. However, you can imagine that combining their contributions into one coherent codebase while maintaining consistency can be challenging. Luckily, recent gains in automated tooling have made this a lot easier. Remember [CONTRIBUTING.md](https://github.com/TDAmeritrade/stumpy/blob/master/CONTRIBUTING.md)? There are a couple of things we want to make sure we do before we submit a `pull request`.\n",
9692
"\n",
97-
"Ideally, you'll see the excellent STUMPY test coverage passing. If things start failing or breaking, then you may have a missing dependency problem. There's nothing worse than finding this out *after* you've made changes.\n",
93+
"First, if you implemented a new feature or changed an existing feature, then you are also responsible for providing the unit test. This can often be just as much work as the feature, so make sure you account for it.\n",
9894
"\n",
99-
"If all of the tests pass, then you know that you have a working copy of STUMPY to start your development on. Go ahead and implement your feature or change!\n",
95+
"Next, run `flake8` and `black`. [flake8](https://flake8.pycqa.org/en/latest/) is a linter that checks the style and quality of the code. [black](https://pypi.org/project/black/) makes any necessary changes to ensure consistent code format.\n",
10096
"\n",
10197
"Checklist: \n",
102-
"- [ ] Create a virtual environment \n",
103-
"- [ ] Install dependencies \n",
104-
"- [ ] Run the unit tests"
98+
"- [ ] Write/update any unit tests \n",
99+
"- [ ] Run `black --exclude=\".*\\.ipynb\" --extend-exclude=\".venv\" --diff ./` to reformat any python files you changed \n",
100+
"- [ ] Run `flake8 --extend-exclude=.venv ./` to identify any formatting errors before you submit your `pull request` \n",
101+
"- [ ] Run the unit tests. In STUMPY, you'll run `./setup.sh dev && ./test.sh`"
105102
]
106103
},
107104
{
108105
"cell_type": "markdown",
109106
"metadata": {},
110107
"source": [
111-
"## Adhere to CONTRIBUTING.md Guidance\n",
108+
"## Make your Changes\n",
112109
"\n",
113-
"One of the great benefits of open source is the ability to collaborate with developers from around the world. However, you can imagine that combining their contributions into one coherent codebase while maintaining consistency can be challenging. Luckily, recent gains in automated tooling have made this a lot easier. Remember [CONTRIBUTING.md](https://github.com/TDAmeritrade/stumpy/blob/master/CONTRIBUTING.md)? There are a couple of things we want to make sure we do before we submit a `pull request`.\n",
110+
"When working on a new project, there are often going to be dependencies. In order to isolate dependencies between different projects, it's a good practice to use a virtual environment. STUMPY supports both [venv](https://docs.python.org/3/library/venv.html) and [conda](https://docs.conda.io/en/latest/). After creating and activating either of these virtual environments, any dependencies you install will be isolated (so they don't break anything else on your system).\n",
114111
"\n",
115-
"First, if you implemented a new feature or changed an existing feature, then you are also responsible for providing the unit test. This can often be just as much work as the feature, so make sure you account for it.\n",
112+
"First, install the dependencies using the [From Source Section](https://stumpy.readthedocs.io/en/latest/install.html#from-source) of the installation instructions. If you are building STUMPY within a conda environment, then you may consider using the `conda.sh` shell script which will automatically assist you in installing all of the required dependencies required for testing. \n",
116113
"\n",
117-
"Next, run `flake8` and `black`. [flake8](https://flake8.pycqa.org/en/latest/) is a linter that checks the style and quality of the code. [black](https://pypi.org/project/black/) makes any necessary changes to ensure consistent code format.\n",
114+
"A good check to make sure everything is working 100% is to run the unit tests. For STUMPY, we have scripts to help you do that. You'll run `./setup.sh dev && ./test.sh`. In some cases, you may notice an uninstallation message for STUMPY but don't worry. This happens if you have had previously installed STUMPY as the `./setup.sh dev` command first uninstalls any existing version of STUMPY and then it will re-installs it from source (the local, cloned, development version). So, everything should be all set.\n",
115+
"\n",
116+
"Ideally, you'll see the excellent STUMPY test coverage passing. If things start failing or breaking, then you may have a missing dependency problem. There's nothing worse than finding this out *after* you've made changes.\n",
117+
"\n",
118+
"If all of the tests pass, then you know that you have a working copy of STUMPY to start your development on. Go ahead and implement your feature or change!\n",
118119
"\n",
119120
"Checklist: \n",
120-
"- [ ] Write/update any unit tests \n",
121-
"- [ ] Run `black` to reformat any python files you changed \n",
122-
"- [ ] Run `flake8` to identify any formatting errors before you submit your `pull request` \n",
123-
"- [ ] Run the unit tests. In STUMPY, you'll run `./setup.sh && ./test.sh`"
121+
"- [ ] Create a virtual environment \n",
122+
"- [ ] Install dependencies \n",
123+
"- [ ] Run the unit tests"
124124
]
125125
},
126126
{
@@ -157,15 +157,15 @@
157157
"- [ ] `git pull` \n",
158158
"- [ ] `git checkout branch_name` \n",
159159
"- [ ] `git merge main` \n",
160-
"- [ ] Run the unit tests: `./setup.sh && ./test.sh` \n",
160+
"- [ ] Run the unit tests: `./setup.sh dev && ./test.sh` \n",
161161
"\n",
162162
"Checklist (fetching upstream locally): \n",
163163
"- [ ] `git fetch upstream`\n",
164164
"- [ ] `git checkout main` \n",
165165
"- [ ] `git merge upstream/main` \n",
166166
"- [ ] `git checkout branch_name` \n",
167167
"- [ ] `git merge main` \n",
168-
"- [ ] Run the unit tests: `./setup.sh && ./test.sh` \n",
168+
"- [ ] Run the unit tests: `./setup.sh dev && ./test.sh` \n",
169169
"\n",
170170
"![Fetch Upstream Fork](images/fetch_upstream_fork.png) "
171171
]
@@ -180,7 +180,7 @@
180180
"\n",
181181
"Here's your next chance to communicate with the maintainers. Let them know what changes you made and if you need any help. This pull request will now be the running dialogue between you and the maintainers as you work on the issue.\n",
182182
"\n",
183-
"Continuous integration systems automatically determine the suitability of merging pull requests. They check the formatting, test coverage, and test success of your code. After you submit a pull request, you'll see these running (as comments in your pull request). If they fail, your code will not be merged until the failure is fixed. In STUMPY, locally passing `flake8`, `black`, and `./setup.sh && ./test.sh` should ensure your continuous integration tests pass.\n",
183+
"Continuous integration systems automatically determine the suitability of merging pull requests. They check the formatting, test coverage, and test success of your code. After you submit a pull request, you'll see these running (as comments in your pull request). If they fail, your code will not be merged until the failure is fixed. In STUMPY, locally passing `flake8`, `black`, and `./setup.sh dev && ./test.sh` should ensure your continuous integration tests pass.\n",
184184
"\n",
185185
"Checklist: \n",
186186
"- [ ] Create a Pull Request \n",
@@ -249,9 +249,9 @@
249249
"- [ ] Install dependencies \n",
250250
"- [ ] Run the unit tests \n",
251251
"- [ ] Write/update any unit tests \n",
252-
"- [ ] Run `black` to reformat any python files you changed \n",
253-
"- [ ] Run `flake8` to identify any formatting errors before you submit your `pull request` \n",
254-
"- [ ] Run the unit tests. In STUMPY, you'll run `./setup.sh && ./test.sh` \n",
252+
"- [ ] Run `black --exclude=\".*\\.ipynb\" --extend-exclude=\".venv\" --diff ./` to reformat any python files you changed \n",
253+
"- [ ] Run `flake8 --extend-exclude=.venv ./` to identify any formatting errors before you submit your `pull request` \n",
254+
"- [ ] Run the unit tests. In STUMPY, you'll run `./setup.sh dev && ./test.sh` \n",
255255
"- [ ] `git add your_file` \n",
256256
"- [ ] `git commit -m 'Great Commit Message'` \n",
257257
"- [ ] `git push` \n",
@@ -266,7 +266,7 @@
266266
],
267267
"metadata": {
268268
"kernelspec": {
269-
"display_name": "Python 3",
269+
"display_name": "Python 3 (ipykernel)",
270270
"language": "python",
271271
"name": "python3"
272272
},
@@ -280,7 +280,7 @@
280280
"name": "python",
281281
"nbconvert_exporter": "python",
282282
"pygments_lexer": "ipython3",
283-
"version": "3.9.5"
283+
"version": "3.12.4"
284284
}
285285
},
286286
"nbformat": 4,

setup.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,16 @@ echo "y" | python -m pip uninstall stumpy
88
# Parse command line arguments
99
for var in "$@"
1010
do
11-
if [[ $var == "dev" ]]; then
12-
echo 'Installing stumpy locally in "--editable" mode'
13-
mode="--editable"
11+
if [[ $var == "dev" ]] || [[ $var == "ci" ]]; then
12+
echo 'Installing stumpy locally with extra "ci" requirement'
13+
mode=""
14+
extra="[ci]"
1415
elif [[ $var == "edit" ]]; then
1516
echo 'Installing stumpy locally in "--editable" mode'
1617
mode="--editable"
1718
elif [[ $var == "-e" ]]; then
1819
echo 'Installing stumpy locally in "--editable" mode'
1920
mode="--editable"
20-
elif [[ $var == "ci" ]]; then
21-
echo 'Installing stumpy locally with extra "ci" requirement'
22-
mode=""
23-
extra="[ci]"
2421
else
2522
echo "Installing stumpy in site-packages"
2623
fi

test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ check_errs()
5757
check_black()
5858
{
5959
echo "Checking Black Code Formatting"
60-
black --check --exclude=".*\.ipynb" --diff ./
60+
black --check --exclude=".*\.ipynb" --extend-exclude=".venv" --diff ./
6161
check_errs $?
6262
}
6363

6464
check_isort()
6565
{
6666
echo "Checking iSort Import Formatting"
67-
isort --profile black --check-only ./
67+
isort --profile black --skip .venv --check-only ./
6868
check_errs $?
6969
}
7070

@@ -78,7 +78,7 @@ check_docstrings()
7878
check_flake()
7979
{
8080
echo "Checking Flake8 Style Guide Enforcement"
81-
flake8 ./
81+
flake8 --extend-exclude=.venv ./
8282
check_errs $?
8383
}
8484

0 commit comments

Comments
 (0)