diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 87e9d4db..b8a4421b 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -32,6 +32,10 @@ jobs: - name: Install requirements run: python -m pip install -r env/requirements-style.txt + # Need to install Pooch to allow pylint to run + - name: Install Pooch + run: python -m pip install . + - name: List installed packages run: python -m pip freeze diff --git a/.gitignore b/.gitignore index bf37484c..77e7cf19 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ doc/api/generated *.egg-info MANIFEST .coverage.* -pooch/_version.py +src/pooch/_version.py diff --git a/MANIFEST.in b/MANIFEST.in index fc94b5de..9688f73c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -12,4 +12,3 @@ exclude Makefile exclude .gitignore exclude .gitattributes exclude environment.yml -include pooch/tests/data diff --git a/Makefile b/Makefile index 9d7ec156..60715fb2 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,11 @@ # Build, package, test, and clean PROJECT=pooch -TESTDIR=tmp-test-dir-with-unique-name -PYTEST_ARGS=--cov-config=../.coveragerc --cov-report=term-missing --cov=$(PROJECT) --doctest-modules -v --pyargs +TESTS=tests src/$(PROJECT) +PYTEST_ARGS=--cov-config=.coveragerc --cov-report=term-missing --cov=$(PROJECT) --doctest-modules -v --pyargs LINT_FILES=$(PROJECT) -CHECK_STYLE=$(PROJECT) doc +CHECK_STYLE=src/$(PROJECT) doc + +.PHONY: help build install test format check check-format check-style lint clean help: @echo "Commands:" @@ -24,11 +26,7 @@ install: python -m pip install --no-deps -e . test: - # Run a tmp folder to make sure the tests are run on the installed version - mkdir -p $(TESTDIR) - cd $(TESTDIR); pytest $(PYTEST_ARGS) $(PROJECT) - cp $(TESTDIR)/.coverage* . - rm -r $(TESTDIR) + pytest $(PYTEST_ARGS) $(TESTS) format: black $(CHECK_STYLE) @@ -50,5 +48,5 @@ clean: find . -name "*.pyc" -exec rm -v {} \; find . -name "*.orig" -exec rm -v {} \; find . -name ".coverage.*" -exec rm -v {} \; - rm -rvf build dist MANIFEST *.egg-info __pycache__ .coverage .cache .pytest_cache $(PROJECT)/_version.py - rm -rvf $(TESTDIR) dask-worker-space + rm -rvf build dist MANIFEST *.egg-info __pycache__ .coverage .cache .pytest_cache src/$(PROJECT)/_version.py + rm -rvf dask-worker-space diff --git a/pyproject.toml b/pyproject.toml index 1bfb3adb..32706f87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,8 +45,8 @@ xxhash = ["xxhash>=1.4.3"] "Bug Tracker" = "https://github.com/fatiando/pooch/issues" "Source Code" = "https://github.com/fatiando/pooch" -[tool.setuptools.packages] -find = {} # Scanning implicit namespaces is active by default +[tool.setuptools.packages.find] +where = ["src"] [tool.setuptools.package-data] "pooch.tests.data" = ["*.txt", "*.zip", "*.gz", "*.xz", "*.bz2"] @@ -60,7 +60,7 @@ build-backend = "setuptools.build_meta" [tool.setuptools_scm] version_scheme = "post-release" local_scheme = "node-and-date" -write_to = "pooch/_version.py" +write_to = "src/pooch/_version.py" [tool.pytest.ini_options] markers = [ diff --git a/pooch/__init__.py b/src/pooch/__init__.py similarity index 100% rename from pooch/__init__.py rename to src/pooch/__init__.py diff --git a/pooch/core.py b/src/pooch/core.py similarity index 100% rename from pooch/core.py rename to src/pooch/core.py diff --git a/pooch/downloaders.py b/src/pooch/downloaders.py similarity index 100% rename from pooch/downloaders.py rename to src/pooch/downloaders.py diff --git a/pooch/hashes.py b/src/pooch/hashes.py similarity index 100% rename from pooch/hashes.py rename to src/pooch/hashes.py diff --git a/pooch/processors.py b/src/pooch/processors.py similarity index 100% rename from pooch/processors.py rename to src/pooch/processors.py diff --git a/pooch/utils.py b/src/pooch/utils.py similarity index 100% rename from pooch/utils.py rename to src/pooch/utils.py diff --git a/pooch/tests/__init__.py b/tests/__init__.py similarity index 100% rename from pooch/tests/__init__.py rename to tests/__init__.py diff --git a/pooch/tests/data/large-data.txt b/tests/data/large-data.txt similarity index 100% rename from pooch/tests/data/large-data.txt rename to tests/data/large-data.txt diff --git a/pooch/tests/data/registry-custom-url.txt b/tests/data/registry-custom-url.txt similarity index 100% rename from pooch/tests/data/registry-custom-url.txt rename to tests/data/registry-custom-url.txt diff --git a/pooch/tests/data/registry-invalid.txt b/tests/data/registry-invalid.txt similarity index 100% rename from pooch/tests/data/registry-invalid.txt rename to tests/data/registry-invalid.txt diff --git a/pooch/tests/data/registry-spaces.txt b/tests/data/registry-spaces.txt similarity index 100% rename from pooch/tests/data/registry-spaces.txt rename to tests/data/registry-spaces.txt diff --git a/pooch/tests/data/registry.txt b/tests/data/registry.txt similarity index 100% rename from pooch/tests/data/registry.txt rename to tests/data/registry.txt diff --git a/pooch/tests/data/registry_comments.txt b/tests/data/registry_comments.txt similarity index 100% rename from pooch/tests/data/registry_comments.txt rename to tests/data/registry_comments.txt diff --git a/pooch/tests/data/store.tar.gz b/tests/data/store.tar.gz similarity index 100% rename from pooch/tests/data/store.tar.gz rename to tests/data/store.tar.gz diff --git a/pooch/tests/data/store.zip b/tests/data/store.zip similarity index 100% rename from pooch/tests/data/store.zip rename to tests/data/store.zip diff --git a/pooch/tests/data/store/subdir/tiny-data.txt b/tests/data/store/subdir/tiny-data.txt similarity index 100% rename from pooch/tests/data/store/subdir/tiny-data.txt rename to tests/data/store/subdir/tiny-data.txt diff --git a/pooch/tests/data/store/tiny-data.txt b/tests/data/store/tiny-data.txt similarity index 100% rename from pooch/tests/data/store/tiny-data.txt rename to tests/data/store/tiny-data.txt diff --git a/pooch/tests/data/tiny-data.tar.gz b/tests/data/tiny-data.tar.gz similarity index 100% rename from pooch/tests/data/tiny-data.tar.gz rename to tests/data/tiny-data.tar.gz diff --git a/pooch/tests/data/tiny-data.txt b/tests/data/tiny-data.txt similarity index 100% rename from pooch/tests/data/tiny-data.txt rename to tests/data/tiny-data.txt diff --git a/pooch/tests/data/tiny-data.txt.bz2 b/tests/data/tiny-data.txt.bz2 similarity index 100% rename from pooch/tests/data/tiny-data.txt.bz2 rename to tests/data/tiny-data.txt.bz2 diff --git a/pooch/tests/data/tiny-data.txt.gz b/tests/data/tiny-data.txt.gz similarity index 100% rename from pooch/tests/data/tiny-data.txt.gz rename to tests/data/tiny-data.txt.gz diff --git a/pooch/tests/data/tiny-data.txt.xz b/tests/data/tiny-data.txt.xz similarity index 100% rename from pooch/tests/data/tiny-data.txt.xz rename to tests/data/tiny-data.txt.xz diff --git a/pooch/tests/data/tiny-data.zip b/tests/data/tiny-data.zip similarity index 100% rename from pooch/tests/data/tiny-data.zip rename to tests/data/tiny-data.zip diff --git a/pooch/tests/test_core.py b/tests/test_core.py similarity index 98% rename from pooch/tests/test_core.py rename to tests/test_core.py index fceda0a0..8be7773b 100644 --- a/pooch/tests/test_core.py +++ b/tests/test_core.py @@ -15,13 +15,13 @@ import pytest -from ..core import create, Pooch, retrieve, download_action, stream_download -from ..utils import get_logger, temporary_file, os_cache -from ..hashes import file_hash, hash_matches +from pooch.core import create, Pooch, retrieve, download_action, stream_download +from pooch.utils import get_logger, temporary_file, os_cache +from pooch.hashes import file_hash, hash_matches # Import the core module so that we can monkeypatch some functions -from .. import core -from ..downloaders import HTTPDownloader, FTPDownloader +from pooch import core +from pooch.downloaders import HTTPDownloader, FTPDownloader from .utils import ( pooch_test_url, diff --git a/pooch/tests/test_downloaders.py b/tests/test_downloaders.py similarity index 99% rename from pooch/tests/test_downloaders.py rename to tests/test_downloaders.py index 14e32f92..0c084cfd 100644 --- a/pooch/tests/test_downloaders.py +++ b/tests/test_downloaders.py @@ -23,8 +23,8 @@ except ImportError: paramiko = None -from .. import Pooch -from ..downloaders import ( +from pooch import Pooch +from pooch.downloaders import ( HTTPDownloader, FTPDownloader, SFTPDownloader, @@ -35,7 +35,7 @@ DataverseRepository, doi_to_url, ) -from ..processors import Unzip +from pooch.processors import Unzip from .utils import ( pooch_test_url, check_large_data, diff --git a/pooch/tests/test_hashes.py b/tests/test_hashes.py similarity index 99% rename from pooch/tests/test_hashes.py rename to tests/test_hashes.py index cf6897e2..0db32504 100644 --- a/pooch/tests/test_hashes.py +++ b/tests/test_hashes.py @@ -22,8 +22,8 @@ xxhash = None XXHASH_MAJOR_VERSION = 0 -from ..core import Pooch -from ..hashes import ( +from pooch.core import Pooch +from pooch.hashes import ( make_registry, file_hash, hash_matches, diff --git a/pooch/tests/test_integration.py b/tests/test_integration.py similarity index 95% rename from pooch/tests/test_integration.py rename to tests/test_integration.py index 831a41f9..e09e02c9 100644 --- a/pooch/tests/test_integration.py +++ b/tests/test_integration.py @@ -14,8 +14,8 @@ import pytest -from .. import create, os_cache -from .. import __version__ as full_version +from pooch import create, os_cache +from pooch import __version__ as full_version from .utils import check_tiny_data, capture_log diff --git a/pooch/tests/test_processors.py b/tests/test_processors.py similarity index 99% rename from pooch/tests/test_processors.py rename to tests/test_processors.py index 1a2a1e2a..f4174099 100644 --- a/pooch/tests/test_processors.py +++ b/tests/test_processors.py @@ -13,8 +13,8 @@ import pytest -from .. import Pooch -from ..processors import Unzip, Untar, Decompress +from pooch import Pooch +from pooch.processors import Unzip, Untar, Decompress from .utils import pooch_test_url, pooch_test_registry, check_tiny_data, capture_log diff --git a/pooch/tests/test_utils.py b/tests/test_utils.py similarity index 99% rename from pooch/tests/test_utils.py rename to tests/test_utils.py index 71401297..09bad6a6 100644 --- a/pooch/tests/test_utils.py +++ b/tests/test_utils.py @@ -17,7 +17,7 @@ import pytest -from ..utils import ( +from pooch.utils import ( parse_url, make_local_storage, temporary_file, diff --git a/pooch/tests/test_version.py b/tests/test_version.py similarity index 100% rename from pooch/tests/test_version.py rename to tests/test_version.py diff --git a/pooch/tests/utils.py b/tests/utils.py similarity index 98% rename from pooch/tests/utils.py rename to tests/utils.py index a248ead7..fe0b8a4c 100644 --- a/pooch/tests/utils.py +++ b/tests/utils.py @@ -15,8 +15,8 @@ from pathlib import Path from contextlib import contextmanager -from .. import __version__ as full_version -from ..utils import check_version, get_logger +from pooch import __version__ as full_version +from pooch.utils import check_version, get_logger def check_tiny_data(fname):