Skip to content

Commit

Permalink
refactor(internal): switch to src dir (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie authored Sep 22, 2024
1 parent f4beb25 commit 0bf95f9
Show file tree
Hide file tree
Showing 17 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


def main() -> None:
path = Path(__file__).parent.parent.parent / 'pyright' / '_version.py'
path = Path(__file__).parent.parent.parent / 'src' / 'pyright' / '_version.py'
contents = path.read_text()
match = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', contents, re.MULTILINE)
if match is None:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
paths:
- "pyright/_version.py"
- "src/pyright/_version.py"
workflow_dispatch:

jobs:
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
line-length = 120
output-format = "grouped"
target-version = "py37"
extend-exclude = ["pyright/_mureq.py"]
extend-exclude = ["src/pyright/_mureq.py"]

[tool.ruff.lint]
select = [
Expand Down Expand Up @@ -42,11 +42,11 @@ docstring-code-format = true

[tool.pyright]
include = [
"pyright",
"src",
"tests",
]
exclude = [
"pyright/_mureq.py"
"src/pyright/_mureq.py"
]
pythonVersion = "3.9"

Expand Down
12 changes: 8 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# -*- coding: utf-8 -*-
import re

from setuptools import setup
from setuptools import setup, find_packages

with open('README.md', 'r') as f:
readme = f.read()

version = ''
with open('pyright/_version.py') as f:
with open('src/pyright/_version.py') as f:
match = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE)
if not match:
raise RuntimeError('version is not set')
Expand Down Expand Up @@ -41,9 +41,13 @@
install_requires=requirements,
long_description=readme,
long_description_content_type='text/markdown',
packages=['pyright'],
python_requires='>=3.7',
packages=find_packages(
where='src',
include=['pyright', 'pyright.*'],
),
package_dir={'': 'src'},
package_data={'': ['py.typed']},
python_requires='>=3.7',
include_package_data=True,
zip_safe=False,
entry_points={
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.
4 changes: 2 additions & 2 deletions version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def get_pyright_version() -> str:
with open('pyright/_version.py') as f:
with open('src/pyright/_version.py') as f:
match = re.search(r'^__pyright_version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE)
if not match:
raise RuntimeError('version is not set')
Expand All @@ -19,7 +19,7 @@ def compare(ver: str) -> bool:


def set_pyright_ver(ver: str):
with fileinput.input('pyright/_version.py', inplace=True) as f:
with fileinput.input('src/pyright/_version.py', inplace=True) as f:
for line in f:
line = re.sub(
r'^__pyright_version__\s*=\s*[\'"]([^\'"]*)[\'"]',
Expand Down

0 comments on commit 0bf95f9

Please sign in to comment.