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

Switch to hatchling commands and remove scripts #281

Merged
merged 4 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ jobs:
with:
python-version: 3.9
- name: "Install dependencies"
run: "scripts/install"
run: pip install hatch
- name: "Build package & docs"
run: "scripts/build"
run: |
hatch build
hatch run docs
- name: "Publish"
run: "scripts/publish"
run: hatch publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
14 changes: 8 additions & 6 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,25 @@ jobs:
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
run: "scripts/install"
run: pip install hatch
- name: "Run linting checks"
run: "scripts/check"
run: hatch run check
- name: "Build package & docs"
run: "scripts/build"
run: |
hatch build
hatch run docs
- name: "Run tests with SQLite"
env:
TEST_DATABASE_URI_SYNC: "sqlite:///test.db?check_same_thread=False"
TEST_DATABASE_URI_ASYNC: "sqlite+aiosqlite:///test.db?check_same_thread=False"
run: "scripts/test"
run: hatch run test
- name: "Run tests with PostgreSQL"
env:
TEST_DATABASE_URI_SYNC: "postgresql+psycopg2://username:password@localhost:5432/test_db"
TEST_DATABASE_URI_ASYNC: "postgresql+asyncpg://username:password@localhost:5432/test_db"
run: "scripts/test"
run: hatch run test
- name: "Enforce coverage"
run: "scripts/coverage"
run: hatch run cov
- name: "Upload Coverage"
uses: codecov/codecov-action@v3
with:
Expand Down
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ Ready to contribute? Here's how to set up `sqladmin` for local development.
$ git clone git@github.com:your_name_here/sqladmin.git
```

3. Install dependencies by running the script:
3. Install [`Hatch`](https://hatch.pypa.io/latest/install/) for project management:

```
$ ./scripts/install
$ pip install hatch
```

4. Create a branch for local development:
Expand All @@ -72,13 +72,14 @@ Ready to contribute? Here's how to set up `sqladmin` for local development.
5. Apply linting and formatting, if not already done:

```
$ ./scripts/lint
$ hatch run lint
```

6. When you're done making changes, check that your changes pass the tests:

```
$ ./scripts/test
$ hatch run check
$ hatch run test
```

7. Commit your changes and push your branch to GitHub:
Expand Down
59 changes: 58 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ dependencies = [
dynamic = ["version"]

[project.urls]
Documentation = "https://github.com/aminalaee/sqladmin#readme"
Documentation = "https://aminalaee.dev/sqladmin"
Issues = "https://github.com/aminalaee/sqladmin/issues"
Source = "https://github.com/aminalaee/sqladmin"

[tool.hatch.version]
path = "sqladmin/__init__.py"

[tool.hatch.build.targets.wheel]
[tool.hatch.build.targets.sdist]
include = [
"/sqladmin",
Expand All @@ -50,3 +51,59 @@ include = [
exclude = [
"tests/*",
]

[tool.hatch.envs.default]
dependencies = [
Copy link

Choose a reason for hiding this comment

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

Does dependabot work on those?

Copy link

Choose a reason for hiding this comment

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

No

Copy link

Choose a reason for hiding this comment

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

this project uses dependabot, so I guess it should replace by https://github.com/renovatebot/renovate ?

Copy link

Choose a reason for hiding this comment

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

"aiosqlite==0.17.0",
"asyncpg==0.26.0",
"autoflake==1.4",
"babel==2.10.3",
"black==22.6.0",
"build==0.8.0",
"coverage==6.4.2",
"email-validator==1.2.1",
"greenlet==1.1.2",
"httpx==0.23.0",
"isort==5.10.1",
"itsdangerous==2.1.2",
"mkdocs-material==8.3.9",
"mkdocs==1.3.1",
"mkdocstrings==0.18.1",
"mypy==0.971",
"pre-commit==2.20.0",
"psycopg2==2.9.3",
"pytest==7.1.2",
"sqlalchemy_utils==0.38.3",
"sqlmodel==0.0.6",
]
[tool.hatch.envs.default.scripts]
check = "isort --check --project=sqladmin . && black --check . && mypy sqladmin"
clean = "rm -r dist site"
cov = "coverage report --show-missing --skip-covered --fail-under=99 && coverage xml"
docs = "mkdocs build"
lint = "autoflake --in-place --recursive .s && isort --project=sqladmin . && black ."
test = "python -m coverage run --concurrency=thread,greenlet -m pytest"

[tool.mypy]
disallow_untyped_defs = true
ignore_missing_imports = true
show_error_codes = true

[tool.isort]
profile = "black"
combine_as_imports = true

[tool.coverage.run]
source_pkgs = [
"sqladmin",
"tests",
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"pragma: nocover",
"except NotImplementedError",
"raise NotImplementedError",
"if TYPE_CHECKING:",
]
32 changes: 0 additions & 32 deletions requirements.txt

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/build

This file was deleted.

14 changes: 0 additions & 14 deletions scripts/check

This file was deleted.

19 changes: 0 additions & 19 deletions scripts/clean

This file was deleted.

12 changes: 0 additions & 12 deletions scripts/coverage

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/docs

This file was deleted.

18 changes: 0 additions & 18 deletions scripts/install

This file was deleted.

14 changes: 0 additions & 14 deletions scripts/lint

This file was deleted.

24 changes: 0 additions & 24 deletions scripts/publish

This file was deleted.

18 changes: 0 additions & 18 deletions scripts/test

This file was deleted.

28 changes: 0 additions & 28 deletions setup.cfg

This file was deleted.