Repository: nschloe/pyfoobar (language: python)

Issue:
isort upgrade
On running `make lint`
```bash
isort -rc .
Skipped 1 files
/home/rohan/anaconda3/envs/nbdev/lib/python3.8/site-packages/isort/main.py:1233: UserWarning: W0501: The following deprecated CLI flags were used and ignored: -rc!
  warn(
/home/rohan/anaconda3/envs/nbdev/lib/python3.8/site-packages/isort/main.py:1237: UserWarning: W0500: Please see the 5.0.0 Upgrade guide: https://pycqa.github.io/isort/docs/upgrade_guides/5.0.0.html
  warn(

```

https://pycqa.github.io/isort/docs/upgrade_guides/5.0.0.html



Discussion / hints:

Fix patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 111ab1b..be23eee 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -6,11 +6,8 @@ jobs:
       - image: circleci/python:3
     steps:
       - checkout
-      - run: pip3 install black flake8 isort
-      # isort isn't compatible with black yet:
-      # https://github.com/timothycrosley/isort/issues/694
-      # https://github.com/python/black/issues/333
-      # - run: isort --check -rc .
+      - run: pip install black flake8 isort
+      - run: isort --check .
       - run: black --check .
       - run: flake8 .
   build:
@@ -18,13 +15,11 @@ jobs:
     docker:
       - image: circleci/python:3
     steps:
-      - run: pip3 install pytest pytest-cov
+      - run: pip install tox
       - checkout
-      - run: pip3 install .[all]
       # The tests
       - run:
-          command: pytest --cov pyfoobar
-          working_directory: test/
+          command: tox -- --cov pyfoobar --cov-report xml --cov-report term
           env:
             MPLBACKEND: Agg
       # submit to codecov
diff --git a/.codecov.yml b/.codecov.yml
index 0421fdf..a052f98 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -1,7 +1,1 @@
 comment: no
-# https://github.com/codecov/support/issues/396#issuecomment-300879528
-codecov:
-  disable_default_path_fixes: true
-fixes:
-  - ".*/dist-packages/::"
-  - ".*/site-packages/::"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1618cd8..a471597 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,18 +12,12 @@ jobs:
   lint:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/setup-python@v2
-      with:
-        python-version: "3.x"
-    - uses: actions/checkout@v2
-    - name: Lint with flake8
-      run: |
-        pip install flake8
-        flake8 .
-    - name: Lint with black
-      run: |
-        pip install black
-        black --check .
+      - name: Check out repo
+        uses: actions/checkout@v2
+      - name: Set up Python
+        uses: actions/setup-python@v2
+      - name: Run pre-commit
+        uses: pre-commit/action@v2.0.3
 
   build:
     runs-on: ubuntu-latest
@@ -38,7 +32,7 @@ jobs:
     - name: Test with tox
       run: |
         pip install tox
-        tox
+        tox -- --cov pyfoobar --cov-report xml --cov-report term
     - name: Submit to codecov
       uses: codecov/codecov-action@v1
       if: ${{ matrix.python-version == '3.9' }}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..d9d495b
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,16 @@
+repos:
+  - repo: https://github.com/PyCQA/isort
+    rev: 5.9.1
+    hooks:
+      - id: isort
+
+  - repo: https://github.com/psf/black
+    rev: 21.6b0
+    hooks:
+      - id: black
+        language_version: python3
+
+  - repo: https://gitlab.com/pycqa/flake8
+    rev: 3.9.2
+    hooks:
+      - id: flake8
diff --git a/.travis.yml b/.travis.yml
index 17cc8c5..f19fef9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,9 @@
 language: python
 python:
-  - "3.6"
+  - "3.9"
 
-# command to install dependencies
 install:
-  - pip3 install .
+  - pip install tox
 
-# command to run tests
 script:
-  - cd test/
-  - pytest
+  - tox
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index bd735ee..f0deae5 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -68,10 +68,10 @@ members of the project's leadership.
 ## Attribution
 
 This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
-available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct/
 
 [homepage]: https://www.contributor-covenant.org
 
 For answers to common questions about this code of conduct, see
-https://www.contributor-covenant.org/faq
+https://www.contributor-covenant.org/faq/
 
diff --git a/Makefile b/Makefile
deleted file mode 100644
index f0ac654..0000000
--- a/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-VERSION=$(shell python3 -c "from configparser import ConfigParser; p = ConfigParser(); p.read('setup.cfg'); print(p['metadata']['version'])")
-
-default:
-	@echo "\"make publish\"?"
-
-# https://packaging.python.org/distributing/#id72
-upload:
-	# Make sure we're on the main branch
-	@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
-	rm -f dist/*
-	# python3 setup.py sdist bdist_wheel
-	# https://stackoverflow.com/a/58756491/353337
-	python3 -m build --sdist --wheel .
-	twine upload dist/*
-
-tag:
-	@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
-	# Always create a github "release"; this automatically creates a Git tag, too.
-	curl -H "Authorization: token `cat $(HOME)/.github-access-token`" -d '{"tag_name": "v$(VERSION)"}' https://api.github.com/repos/nschloe/pyfoobar/releases
-
-publish: tag upload
-
-clean:
-	@find . | grep -E "(__pycache__|\.pyc|\.pyo$\)" | xargs rm -rf
-	@rm -rf *.egg-info/ build/ dist/ MANIFEST .pytest_cache/
-
-format:
-	isort -rc .
-	black .
-
-lint:
-	isort --check -rc .
-	black --check .
-	flake8 .
diff --git a/README.md b/README.md
index c08b09c..3a1ffb5 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,13 @@
 # pyfoobar
 
-[![PyPi Version](https://img.shields.io/pypi/v/pyfoobar.svg?style=flat-square)](https://pypi.org/project/pyfoobar)
-[![PyPI pyversions](https://img.shields.io/pypi/pyversions/pyfoobar.svg?style=flat-square)](https://pypi.org/pypi/pyfoobar/)
+[![PyPi Version](https://img.shields.io/pypi/v/pyfoobar.svg?style=flat-square)](https://pypi.org/project/pyfoobar/)
+[![PyPI pyversions](https://img.shields.io/pypi/pyversions/pyfoobar.svg?style=flat-square)](https://pypi.org/project/pyfoobar/)
 [![GitHub stars](https://img.shields.io/github/stars/nschloe/pyfoobar.svg?style=flat-square&logo=github&label=Stars&logoColor=white)](https://github.com/nschloe/pyfoobar)
 [![PyPi downloads](https://img.shields.io/pypi/dm/pyfoobar.svg?style=flat-square)](https://pypistats.org/packages/pyfoobar)
 
 [![gh-actions](https://img.shields.io/github/workflow/status/nschloe/pyfoobar/ci?style=flat-square)](https://github.com/nschloe/pyfoobar/actions?query=workflow%3Aci)
-[![CircleCI](https://img.shields.io/circleci/project/github/nschloe/pyfoobar/main.svg?style=flat-square)](https://circleci.com/gh/nschloe/pyfoobar/tree/main)
-[![travis](https://img.shields.io/travis/nschloe/pyfoobar.svg?style=flat-square)](https://travis-ci.org/nschloe/pyfoobar)
+[![CircleCI](https://img.shields.io/circleci/build/github/nschloe/pyfoobar/main.svg?style=flat-square)](https://circleci.com/gh/nschloe/pyfoobar/tree/main)
+[![travis](https://img.shields.io/travis/nschloe/pyfoobar.svg?style=flat-square)](https://travis-ci.com/nschloe/pyfoobar)
 [![codecov](https://img.shields.io/codecov/c/github/nschloe/pyfoobar.svg?style=flat-square)](https://codecov.io/gh/nschloe/pyfoobar)
 [![LGTM](https://img.shields.io/lgtm/grade/python/github/nschloe/pyfoobar.svg?style=flat-square)](https://lgtm.com/projects/g/nschloe/pyfoobar)
 [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)
@@ -27,19 +27,18 @@ for your new Python project.
 * Your package should be a **one-trick pony**. Nobody wants to install a huge toolbox if
   all they need is the image converter in it.
 
-* After `import yourpackagename`, people should be able to call
-  `yourpackagename.__version__`. This helps with debugging.
-
 * Choose a **license** for your code and provide a `LICENSE[.txt]` in the root level of
   your package as well as a statement in your main README.
   [choosealicense.com](https://choosealicense.com/) can help you make a decision.
 
 * Use **linting and formatting**, include those in your integration tests.
-    - [black](https://github.com/python/black) is a formatter that I like because you
+    - [black](https://github.com/psf/black) is a formatter that I like because you
       cannot configure it -- black is black.
     - Good linters are [flake8](http://flake8.pycqa.org/en/latest/) and
       [pylint](https://www.pylint.org/).
     - [isort](https://pypi.org/project/isort/) sorts your imports.
+    - [pre-commit](https://pre-commit.com/) has gained some popularity. It runs your
+      linters and formatters on every commit. Not more "lint fix" commits.
 
 * Once you have tests in order, make sure they are executed with every git push.
   Popular **CI services** that run your tests are [GitHub
@@ -52,7 +51,7 @@ for your new Python project.
   administrators_. Development happens in pull requests, this makes sure that nobody --
   including yourself -- ever accidentally pushes something broken to main.
 
-* Use a tool for measuring **test coverage**. [codecov](https://codecov.io/) is one, and
+* Use a tool for measuring **test coverage**. [codecov](https://about.codecov.io/) is one, and
   your CI provider submits the data to it.
 
 * If you have CI set up, want to show test coverage, or advertise
@@ -62,36 +61,35 @@ for your new Python project.
 * Include [**contributing guidelines**](CONTRIBUTING.md) and a [**code of
   conduct**](CODE_OF_CONDUCT.md) (edit to add appropriate
   [enforcement](CODE_OF_CONDUCT.md#enforcement) contacts or [use a
-  template](https://help.github.com/en/articles/adding-a-code-of-conduct-to-your-project))
+  template](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-code-of-conduct-to-your-project))
   to help foster a community.
 
 ### What you can do with this template
 
 First run
 ```
-find . -type f -print0 -name "*.py" -o -name Makefile -o -name "*.yml" | xargs -0 sed -i 's/pyfoobar/your-project-name/g'
+find . -type f -print0 -name "*.py" -o -name "*.yml" | xargs -0 sed -i 's/pyfoobar/your-project-name/g'
 ```
-and rename the folder `pyfoobar` to customize the name.
+and rename the folder `src/pyfoobar` to customize the name.
 
-There is a simple `Makefile` that can help you with certain tasks:
-  * Run `make format` to apply formatting.
-  * Run `make lint` to check formatting and style.
-  * Run `make publish` to
-     - tag your project on git (`make tag`)
-     - upload your package to PyPi (`make upload`)
+There is a simple [`justfile`](https://github.com/casey/just) that can help you with
+certain tasks:
+  * Run `just format` to apply formatting.
+  * Run `just lint` to check formatting and style.
+  * Run `just publish` to
+     - tag your project on git (`just tag`)
+     - upload your package to PyPi (`just upload`)
 
     After publishing, people can install your package with
     ```
-    pip3 install pyfoobar
+    pip install pyfoobar
     ```
 
 ### Testing
-
 To run the pyfoobar unit tests, check out this repository and do
 ```
 tox
 ```
 
 ### License
-
 pyfoobar is published under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).
diff --git a/justfile b/justfile
new file mode 100644
index 0000000..d8b8f7c
--- /dev/null
+++ b/justfile
@@ -0,0 +1,31 @@
+version := `python3 -c "from configparser import ConfigParser; p = ConfigParser(); p.read('setup.cfg'); print(p['metadata']['version'])"`
+name := `python3 -c "from configparser import ConfigParser; p = ConfigParser(); p.read('setup.cfg'); print(p['metadata']['name'])"`
+
+
+default:
+	@echo "\"just publish\"?"
+
+tag:
+	@if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
+	curl -H "Authorization: token `cat ~/.github-access-token`" -d '{"tag_name": "{{version}}"}' https://api.github.com/repos/nschloe/{{name}}/releases
+
+upload: clean
+	@if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
+	# https://stackoverflow.com/a/58756491/353337
+	python3 -m build --sdist --wheel .
+	twine upload dist/*
+
+publish: tag upload
+
+clean:
+	@find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
+	@rm -rf src/*.egg-info/ build/ dist/ .tox/
+
+format:
+	isort .
+	black .
+	blacken-docs README.md
+
+lint:
+	black --check .
+	flake8 .
diff --git a/pyproject.toml b/pyproject.toml
index 8fe2f47..3c2aae9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,6 @@
 [build-system]
 requires = ["setuptools>=42", "wheel"]
 build-backend = "setuptools.build_meta"
+
+[tool.isort]
+profile = "black"
diff --git a/setup.cfg b/setup.cfg
index b91a84d..a720f98 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = pyfoobar
-version = 0.0.5
+version = 0.0.6
 author = Nico Schlömer
 author_email = nico.schloemer@gmail.com
 description = Best practices for Python projects
@@ -16,7 +16,6 @@ project_urls =
 long_description = file: README.md
 long_description_content_type = text/markdown
 license = MIT
-license_file = LICENSE
 # See <https://pypi.org/classifiers/> for all classifiers.
 classifiers =
     Development Status :: 4 - Beta
@@ -32,10 +31,15 @@ classifiers =
     Topic :: Utilities
 
 [options]
+package_dir =
+    =src
 packages = find:
 install_requires =
     importlib_metadata;python_version<"3.8"
-python_requires = >=3.5
+python_requires = >=3.6
+
+[options.packages.find]
+where=src
 
 [options.entry_points]
 console_scripts =
diff --git a/pyfoobar/__about__.py b/src/pyfoobar/__about__.py
similarity index 100%
rename from pyfoobar/__about__.py
rename to src/pyfoobar/__about__.py
diff --git a/pyfoobar/__init__.py b/src/pyfoobar/__init__.py
similarity index 100%
rename from pyfoobar/__init__.py
rename to src/pyfoobar/__init__.py
diff --git a/pyfoobar/cli.py b/src/pyfoobar/cli.py
similarity index 100%
rename from pyfoobar/cli.py
rename to src/pyfoobar/cli.py
diff --git a/pyfoobar/main.py b/src/pyfoobar/main.py
similarity index 100%
rename from pyfoobar/main.py
rename to src/pyfoobar/main.py
diff --git a/tox.ini b/tox.ini
index e98047f..42fdd9b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,7 +5,8 @@ isolated_build = True
 [testenv]
 deps =
     pytest
+    pytest-codeblocks
     pytest-cov
 extras = all
 commands =
-    pytest --cov {envsitepackagesdir}/pyfoobar --cov-report xml --cov-report term
+    pytest {posargs} --codeblocks


Test patch:
diff --git a/test/test_cli.py b/tests/test_cli.py
similarity index 100%
rename from test/test_cli.py
rename to tests/test_cli.py
diff --git a/test/test_solve.py b/tests/test_solve.py
similarity index 100%
rename from test/test_solve.py
rename to tests/test_solve.py