-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 99baec4
Showing
12 changed files
with
299 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Python CI | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
# make depends on uv | ||
- name: Install dependencies | ||
run: | | ||
pip install uv | ||
make install | ||
- name: Run linter and pytest | ||
run: | | ||
make check | ||
- name: Test & publish code coverage | ||
uses: paambaati/codeclimate-action@v9.0.0 | ||
if: github.ref_name == 'main' | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
with: | ||
coverageCommand: make test-coverage | ||
debug: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.egg-info | ||
__pycache__ | ||
dist/ | ||
*.pyc | ||
.venv | ||
.coverage | ||
coverage.xml | ||
*_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
install: | ||
uv sync | ||
|
||
run: | ||
uv run hexlet-python-package | ||
|
||
test: | ||
uv run pytest | ||
|
||
test-coverage: | ||
uv run pytest --cov=hexlet_python_package --cov-report xml | ||
|
||
lint: | ||
uv run ruff check | ||
|
||
check: test lint | ||
|
||
build: | ||
uv build | ||
|
||
.PHONY: install test lint selfcheck check build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# python-package | ||
|
||
[![Github Actions Status](https://github.com/hexlet-boilerplates/python-package/workflows/Python%20CI/badge.svg)](https://github.com/hexlet-boilerplates/python-package/actions) | ||
[![Maintainability](https://api.codeclimate.com/v1/badges/df66c0cbbeca7d822f23/maintainability)](https://codeclimate.com/github/hexlet-boilerplates/python-package/maintainability) | ||
[![Test Coverage](https://api.codeclimate.com/v1/badges/df66c0cbbeca7d822f23/test_coverage)](https://codeclimate.com/github/hexlet-boilerplates/python-package/test_coverage) | ||
|
||
### Links | ||
|
||
This project was built using these tools: | ||
|
||
| Tool | Description | | ||
|------------------------------------------------------------------------|---------------------------------------------------------| | ||
| [uv](https://docs.astral.sh/uv/) | "An extremely fast Python package and project manager, written in Rust" | | ||
| [Pytest](https://pytest.org) | "A mature full-featured Python testing tool" | | ||
| [ruff](https://docs.astral.sh/ruff/) | "An extremely fast Python linter and code formatter, written in Rust" | | ||
|
||
--- | ||
|
||
### Setup | ||
|
||
```bash | ||
make install | ||
``` | ||
|
||
|
||
### Run tests | ||
|
||
```bash | ||
make test | ||
``` | ||
|
||
[![Hexlet Ltd. logo](https://raw.githubusercontent.com/Hexlet/assets/master/images/hexlet_logo128.png)](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=python-package) | ||
|
||
This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=python-package). | ||
|
||
See most active contributors on [hexlet-friends](https://friends.hexlet.io/). |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def half(num): | ||
return num / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import sys | ||
|
||
from hexlet_python_package.half import half | ||
|
||
|
||
def main(): | ||
print(half(float(sys.argv[-1]))) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[project] | ||
authors = [ | ||
{name = "Hexlet team", email = "team@hexlet.io"}, | ||
] | ||
requires-python = "<4.0,>=3.12" | ||
name = "python-example-app" | ||
version = "0.1.0" | ||
description = "Example application" | ||
readme = "README.md" | ||
|
||
[tool.uv] | ||
dev-dependencies = [ | ||
"ruff>=0.7.1", | ||
"pytest>=8.3.3", | ||
"pytest-cov>=5.0.0", | ||
] | ||
|
||
[project.scripts] | ||
hexlet-python-package = "hexlet_python_package.scripts.main:main" | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["hexlet_python_package"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
line-length = 80 | ||
|
||
[lint.per-file-ignores] | ||
# init modules can contain the local imports, logic, unused imports | ||
"__init__.py" = ["F401"] | ||
|
||
[lint] | ||
preview = true | ||
select = ["E", "F", "I"] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from hexlet_python_package.half import half | ||
|
||
|
||
def test_half(): | ||
assert half(6) == 3 |
Large diffs are not rendered by default.
Oops, something went wrong.