Skip to content

Commit

Permalink
refactoring pyproject.toml to pass tox local tests (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxochicale committed Aug 23, 2023
1 parent ac52a2a commit bf61ec1
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 14 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
python -m pip install tox>=4
- name: Run tests
run: |
python -m pytest -v -s -rs tests/
run: tox
27 changes: 18 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,30 @@ How to use

::

conda mamba create -n ssptVE python=3.8 pip cookiecutter -c conda-forge
conda create -n ssptVE pip -c conda-forge
conda activate ssptVE
pip install cookiecutter tox>=4

2. Run Cookiecutter with the URL of this template.

2. Test template using `tox` and `pytest`

::

conda activate ssptVE
tox

3. Run Cookiecutter with the URL of this template.
Alternatively, you can run it in the same path of this repository if you are developing a new feature for this template.

::

cookiecutter https://github.com/SciKit-Surgery/PythonTemplate.git
cookiecutter .

3. Answer the questions to configure your template (press enter to choose defaults), for further details on available answers.
4. Answer the questions to configure your template (press enter to choose defaults), for further details on available answers.
See "List of parameters for cookiecutter" below.

4. Create a local git repository for your new project and commit the files.
5. Create a local git repository for your new project and commit the files.

::

Expand All @@ -130,20 +139,20 @@ See "List of parameters for cookiecutter" below.

Note: make sure you use "git add ." not "git add * " to pick up hidden files like `.gitlab-ci.yml`.

5. Create a new project on GitHub, making sure the URL matches what you set in step 3.
6. Create a new project on GitHub, making sure the URL matches what you set in step 3.

6. Add a remote in order to link your local repository to your GitHub repository and push the files across.
7. Add a remote in order to link your local repository to your GitHub repository and push the files across.
**NOTE**: use the `SSH`_ form of the repository URL for SSH key authentication (so you don't have to enter a username and password).

::

git remote add origin [email protected]:GITHUB_USERNAME/MyNewProject.git
git push origin master

7. If using GitHub, and assuming your URLs are all correct, GitHub Actions should automatically
8. If using GitHub, and assuming your URLs are all correct, GitHub Actions should automatically
run tests for your project.

8. You can verify your project has been set up correctly by installing and running tox.
9. You can verify your project has been set up correctly by installing and running tox.

::

Expand All @@ -161,7 +170,7 @@ These can also be run independently:
python -m pytest
pylint --rcfile=tests/pylintrc mynewproject

9. Install your package in editable mode and build your package
10. Install your package in editable mode and build your package

::

Expand Down
24 changes: 23 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,26 @@ homepage = "https://https://github.com/SciKit-Surgery/PythonTemplate"

[tool.setuptools.packages.find]
include=[""]
exclude=["doc", "tests"]
exclude=["doc", "tests"]

[tool.pytest.ini_options]
addopts = "--color=yes -v"
testpaths = [
"tests",
]

[tool.tox]
legacy_tox_ini = """
[testenv]
skip_install = true
description =
Test package creation
deps =
cookiecutter
pytest
commands =
pytest -v -s -rs tests/
[tox]
env_list = py3{8,9,10,11,12}
"""
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parameterized
pylint
pytest
pyinstaller
tox
tox>=4
tox-conda
build
six
Expand Down

0 comments on commit bf61ec1

Please sign in to comment.