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 all 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
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include README.rst
include LONG_DESCRIPTION.rst
include CODE_OF_CONDUCT.md CONTRIBUTING.md
include test-requirements.txt
include trio/py.typed
recursive-include trio/_tests/test_ssl_certs *.pem
include src/trio/py.typed
recursive-include src/trio/_tests/test_ssl_certs *.pem
recursive-include docs *
prune docs/build
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 trio; then
if ! black --check src/trio; then
echo "* Black found issues" >> "$GITHUB_STEP_SUMMARY"
EXIT_STATUS=1
black --diff trio
black --diff 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 trio
isort trio
black src/trio
ruff check 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"))

# Enable reloading with `typing.TYPE_CHECKING` being True
os.environ["SPHINX_AUTODOC_RELOAD_MODULES"] = "1"
Expand Down
23 changes: 10 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ Changelog = "https://trio.readthedocs.io/en/latest/history.html"
# doesn't look like a source file, so long as it appears in MANIFEST.in:
include-package-data = true

[tool.setuptools.packages]
find = {namespaces = false}

[tool.setuptools.dynamic]
version = {attr = "trio._version.__version__"}

Expand All @@ -84,15 +81,14 @@ force-exclude = '''
ignore-words-list = 'astroid,crasher,asend'

[tool.ruff]
target-version = "py38"
respect-gitignore = true
fix = true

allowed-confusables = ["–"]

# The directories to consider when resolving first vs. third-party imports.
# Does not control what files to include/exclude!
src = ["trio", "notes-to-self"]
src = ["src/trio", "notes-to-self"]

select = [
"RUF", # Ruff-specific rules
Expand Down Expand Up @@ -124,13 +120,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 @@ -184,6 +180,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 Expand Up @@ -228,7 +225,7 @@ showcontent = true

[tool.coverage.run]
branch = true
source = ["trio"]
source_pkgs = ["trio"]
omit = [
# These are run in subprocesses, but still don't work. We follow
# coverage's documentation to no avail.
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 @@ -313,7 +313,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.