Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to a src-layout #427

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ doc/api/generated
*.egg-info
MANIFEST
.coverage.*
pooch/_version.py
src/pooch/_version.py
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ exclude Makefile
exclude .gitignore
exclude .gitattributes
exclude environment.yml
include pooch/tests/data
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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:"
Expand All @@ -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)
Expand All @@ -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
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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 = [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions pooch/tests/test_core.py → tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions pooch/tests/test_downloaders.py → tests/test_downloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions pooch/tests/test_hashes.py → tests/test_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions pooch/tests/test_integration.py → tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions pooch/tests/test_processors.py → tests/test_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pooch/tests/test_utils.py → tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import pytest

from ..utils import (
from pooch.utils import (
parse_url,
make_local_storage,
temporary_file,
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions pooch/tests/utils.py → tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading