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 src-layout. #2798

Merged
merged 24 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b813917
Move to src-layout.
apollo13 Sep 13, 2023
68ace3a
Merge branch 'src-layout' of https://github.com/apollo13/trio into ap…
CoolCat467 Oct 21, 2023
8bb2b84
Merge branch 'apollo13-src-layout' into src-layout
CoolCat467 Oct 21, 2023
9055147
Fix missing src changes I missed
CoolCat467 Oct 21, 2023
bd979b1
Update ruff per-file ignores to account for different directory
CoolCat467 Oct 21, 2023
8296248
Move type_tests into src directory
CoolCat467 Oct 21, 2023
700b3eb
Mypy uses module level things apparently
CoolCat467 Oct 21, 2023
e4d029c
Merge branch 'master' into src-layout
CoolCat467 Oct 25, 2023
f911587
Merge remote-tracking branch 'origin/master' into src-layout
CoolCat467 Oct 26, 2023
61476f7
Merge branch 'master' into src-layout
CoolCat467 Oct 31, 2023
5226321
Merge remote-tracking branch 'origin/master' into src-layout
CoolCat467 Nov 3, 2023
dda9935
Merge remote-tracking branch 'origin/master' into src-layout
CoolCat467 Nov 4, 2023
fe66133
Merge remote-tracking branch 'origin/master' into src-layout
jakkdl Nov 4, 2023
17b1999
Merge remote-tracking branch 'origin/master' into src-layout
CoolCat467 Nov 6, 2023
4a7ec59
Re-add long description, I thought the pull to remove it had been merged
CoolCat467 Nov 6, 2023
458496b
Path updates and remove language version specifier from ruff
CoolCat467 Nov 6, 2023
8954d8b
Update path listing and enable namespace discovery
CoolCat467 Nov 6, 2023
48bf58b
Delete `.coveragerc` (not sure how survived merge)
CoolCat467 Nov 6, 2023
b03ffe9
Try changing coverage source
CoolCat467 Nov 6, 2023
5fbec0b
Revert "Try changing coverage source"
CoolCat467 Nov 6, 2023
0ca87fd
Merge branch 'master' into src-layout
CoolCat467 Nov 10, 2023
df3dbff
Try changing coverage `source`
CoolCat467 Nov 10, 2023
196300a
Try changing coverage to use `source_pkgs`
CoolCat467 Nov 10, 2023
3b582ca
Remove src prefix in coverage config
CoolCat467 Nov 11, 2023
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
5 changes: 5 additions & 0 deletions .coveragerc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to move this to pyproject.toml

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, you're still creating .coveragerc

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ omit=
# this doesn't corrupt the coverage files
parallel=True

[paths]
source =
src/trio
**/site-packages/trio

[report]
precision = 1
skip_covered = True
Expand Down
24 changes: 12 additions & 12 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi

# Test if the generated code is still up to date
echo "::group::Generate Exports"
python ./trio/_tools/gen_exports.py --test \
python ./src/trio/_tools/gen_exports.py --test \
|| EXIT_STATUS=$?
echo "::endgroup::"

Expand All @@ -23,10 +23,10 @@ echo "::endgroup::"
# autoflake --recursive --in-place .
# pyupgrade --py3-plus $(find . -name "*.py")
echo "::group::Black"
if ! black --check setup.py trio; then
if ! black --check setup.py src/trio; then
echo "* Black found issues" >> "$GITHUB_STEP_SUMMARY"
EXIT_STATUS=1
black --diff setup.py trio
black --diff setup.py src/trio
echo "::endgroup::"
echo "::error:: Black found issues"
else
Expand Down Expand Up @@ -57,16 +57,16 @@ echo "::group::Mypy"
rm -f mypy_annotate.dat
# Pipefail makes these pipelines fail if mypy does, even if mypy_annotate.py succeeds.
set -o pipefail
mypy trio --show-error-end --platform linux | python ./trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Linux \
mypy src/trio --show-error-end --platform linux | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Linux \
|| { echo "* Mypy (Linux) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; }
# Darwin tests FreeBSD too
mypy trio --show-error-end --platform darwin | python ./trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Mac \
mypy src/trio --show-error-end --platform darwin | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Mac \
|| { echo "* Mypy (Mac) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; }
mypy trio --show-error-end --platform win32 | python ./trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Windows \
mypy src/trio --show-error-end --platform win32 | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Windows \
|| { echo "* Mypy (Windows) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; }
set +o pipefail
# Re-display errors using Github's syntax, read out of mypy_annotate.dat
python ./trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat
python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat
# Then discard.
rm -f mypy_annotate.dat
echo "::endgroup::"
Expand Down Expand Up @@ -97,11 +97,11 @@ fi
codespell || EXIT_STATUS=$?

echo "::group::Pyright interface tests"
python trio/_tests/check_type_completeness.py --overwrite-file || EXIT_STATUS=$?
if git status --porcelain trio/_tests/verify_types*.json | grep -q "M"; then
python src/trio/_tests/check_type_completeness.py --overwrite-file || EXIT_STATUS=$?
if git status --porcelain src/trio/_tests/verify_types*.json | grep -q "M"; then
echo "* Type completeness changed, please update!" >> "$GITHUB_STEP_SUMMARY"
echo "::error::Type completeness changed, please update!"
git --no-pager diff --color trio/_tests/verify_types*.json
git --no-pager diff --color src/trio/_tests/verify_types*.json
EXIT_STATUS=1
fi

Expand All @@ -118,8 +118,8 @@ Problems were found by static analysis (listed above).
To fix formatting and see remaining errors, run

pip install -r test-requirements.txt
black setup.py trio
isort setup.py trio
black setup.py src/trio
isort setup.py src/trio
./check.sh

in your local checkout.
Expand Down
2 changes: 1 addition & 1 deletion ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ else
# when installing, and then running 'certmgr.msc' and exporting the
# certificate. See:
# http://www.migee.com/2010/09/24/solution-for-unattendedsilent-installs-and-would-you-like-to-install-this-device-software/
certutil -addstore "TrustedPublisher" trio/_tests/astrill-codesigning-cert.cer
certutil -addstore "TrustedPublisher" src/trio/_tests/astrill-codesigning-cert.cer
# Double-slashes are how you tell windows-bash that you want a single
# slash, and don't treat this as a unix-style filename that needs to
# be replaced by a windows-style filename.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# For our local_customization module
sys.path.insert(0, os.path.abspath("."))
# For trio itself
sys.path.insert(0, os.path.abspath("../.."))
sys.path.insert(0, os.path.abspath("../../src"))

# https://docs.readthedocs.io/en/stable/builds.html#build-environment
if "READTHEDOCS" in os.environ:
Expand Down
15 changes: 8 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ extend-exclude = [
]

[tool.ruff.per-file-ignores]
'trio/__init__.py' = ['F401']
'trio/_core/__init__.py' = ['F401']
'trio/_core/_tests/test_multierror_scripts/*' = ['F401']
'trio/abc.py' = ['F401']
'trio/lowlevel.py' = ['F401']
'trio/socket.py' = ['F401']
'trio/testing/__init__.py' = ['F401']
'src/trio/__init__.py' = ['F401']
'src/trio/_core/__init__.py' = ['F401']
'src/trio/_core/_tests/test_multierror_scripts/*' = ['F401']
'src/trio/abc.py' = ['F401']
'src/trio/lowlevel.py' = ['F401']
'src/trio/socket.py' = ['F401']
'src/trio/testing/__init__.py' = ['F401']

[tool.ruff.isort]
combine-as-imports = true
Expand Down Expand Up @@ -116,6 +116,7 @@ issue_format = "`#{issue} <https://github.com/python-trio/trio/issues/{issue}>`_
# - At release time after bumping version number, run: towncrier
# (or towncrier --draft)
package = "trio"
package_dir = "src"
underlines = ["-", "~", "^"]

[[tool.towncrier.type]]
Expand Down
5 changes: 3 additions & 2 deletions setup.py
CoolCat467 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__version__ = "0.0.0" # Overwritten from _version.py below, needed for linter to identify that this variable is defined.

with open("trio/_version.py", encoding="utf-8") as version_code:
with open("src/trio/_version.py", encoding="utf-8") as version_code:
exec(version_code.read())

LONG_DESC = """\
Expand Down Expand Up @@ -83,7 +83,8 @@
author_email="njs@pobox.com",
url="https://github.com/python-trio/trio",
license="MIT OR Apache-2.0",
packages=find_packages(),
packages=find_packages(where="src"),
package_dir={"": "src"},
install_requires=[
# attrs 19.2.0 adds `eq` option to decorators
# attrs 20.1.0 adds @frozen
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.
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.
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.
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.
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def main() -> None: # pragma: no cover
source_root = Path.cwd()
# Double-check we found the right directory
assert (source_root / "LICENSE").exists()
core = source_root / "trio/_core"
core = source_root / "src/trio/_core"
to_wrap = [
File(core / "_run.py", "runner", imports=IMPORTS_RUN),
File(
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.
File renamed without changes.