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

2.0.0b5 #351

Open
wants to merge 46 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d982127
beta5, players prop, demoparser upgrade
pnxenopoulos Sep 16, 2024
a7b724f
new lockfile
pnxenopoulos Sep 16, 2024
8968b04
ruff parse demo
pnxenopoulos Sep 16, 2024
2abd918
velocity as a default prop
pnxenopoulos Sep 16, 2024
aea1034
update demoparser2
pnxenopoulos Nov 24, 2024
09ad0d9
add 3.13 to build matrix
pnxenopoulos Nov 24, 2024
455cb42
poetry lock updated
pnxenopoulos Nov 24, 2024
5e4bd63
approve 3.13 in pyproject, change ruff lint settings
pnxenopoulos Nov 24, 2024
a2b280d
redo the pyproject.toml
pnxenopoulos Nov 25, 2024
926613e
Nav mesh parsing (#358)
pnxenopoulos Jan 5, 2025
13227b4
add requests
pnxenopoulos Jan 5, 2025
332a725
fix test
pnxenopoulos Jan 5, 2025
efbbcb4
under 3.13
pnxenopoulos Jan 5, 2025
9036754
nav command
pnxenopoulos Jan 6, 2025
1d62689
fix naming
pnxenopoulos Jan 6, 2025
0b311b6
fix nav test
pnxenopoulos Jan 6, 2025
92abe5c
i can see clearly now
pnxenopoulos Jan 6, 2025
113ea77
vis tests
pnxenopoulos Jan 6, 2025
96afbb7
fix code
pnxenopoulos Jan 6, 2025
7a8cf22
increase capacity
pnxenopoulos Jan 6, 2025
0d3cbce
faster read
pnxenopoulos Jan 6, 2025
e4aba32
fix tests
pnxenopoulos Jan 6, 2025
77b73bc
maybe 3.13
pnxenopoulos Jan 7, 2025
4ada526
remove 3.13 support
pnxenopoulos Jan 7, 2025
6d3a6e0
Fixed plot bugs, added functionality, updated images (#353)
ventsiR Jan 8, 2025
b5a4292
test 3.13
pnxenopoulos Jan 9, 2025
1d04f38
uv
pnxenopoulos Jan 9, 2025
337cfd4
precommit
pnxenopoulos Jan 9, 2025
42874f7
fix the readme
pnxenopoulos Jan 9, 2025
5ecdce0
ignore long line
pnxenopoulos Jan 9, 2025
2562da4
fix
pnxenopoulos Jan 9, 2025
6801a6b
Add extraction of spawn points. (#359)
JanEricNitschke Jan 13, 2025
1d594ea
small changes
pnxenopoulos Jan 13, 2025
1d8ca33
fix spacing
pnxenopoulos Jan 13, 2025
153a29e
log into steam
pnxenopoulos Jan 13, 2025
97a6fa3
source artifacts
pnxenopoulos Jan 13, 2025
fcdf8eb
one liner
pnxenopoulos Jan 13, 2025
7eb44c3
bash
pnxenopoulos Jan 13, 2025
9371cf1
pc
pnxenopoulos Jan 14, 2025
917964f
make run
pnxenopoulos Jan 14, 2025
0ed193e
move awpy install
pnxenopoulos Jan 14, 2025
a98f2d7
fix space
pnxenopoulos Jan 14, 2025
0dc08ee
new scripts
pnxenopoulos Jan 14, 2025
28c4d45
cleaning up
pnxenopoulos Jan 14, 2025
8417b6c
updated import
pnxenopoulos Jan 14, 2025
18b118f
scripts
pnxenopoulos Jan 14, 2025
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
9 changes: 4 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

about: Create an Awpy bug report
title: ""
labels: ""
assignees: ""
---

**Describe the bug**
Expand Down
9 changes: 4 additions & 5 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest a feature for awpy
title: ''
labels: ''
assignees: ''

about: Suggest an Awpy feature
title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# This workflow will create game artifacts used in Awpy

name: artifacts

on:
pull_request:
branches: [main]
paths:
- "awpy/**"
- "tests/**"
- "pyproject.toml"
workflow_dispatch:

# on:
# push:
# branches: [main]
# schedule:
# - cron: "49 1 * * *"
# workflow_dispatch:

env:
PYTHON_VERSION: 3.13
SOURCE2_VIEWER_URL: https://github.com/ValveResourceFormat/ValveResourceFormat/releases/download/11.1/cli-windows-x64.zip
CS2_APP_ID: 730

jobs:
generate-artifacts:
runs-on: windows-latest
steps:
- name: Checkout awpy library
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
run: |
uv python install ${{ env.PYTHON_VERSION }}

- name: Install awpy
shell: bash
run: |
uv sync --group dev --group test
uv tool install .

- name: Setup SteamCMD
uses: CyberAndrii/setup-steamcmd@v1

- name: Install Counter-Strike 2
run: |
$csDir = Join-Path (Get-Location) "cs_go"
steamcmd +force_install_dir $csDir +login anonymous +app_update ${{ env.CS2_APP_ID }} +quit

- name: Get Counter-Strike 2 Version
run: |
$csDir = Join-Path (Get-Location) "cs_go"
$csVersion = Get-Content "$csDir\game\csgo\steam.inf" | Select-String -Pattern "ClientVersion" | ForEach-Object { $_ -replace "ClientVersion=", "" }
echo "Counter-Strike 2 Version: $csVersion"

- name: Install Source2Viewer-CLI
run: |
Invoke-WebRequest -Uri ${{ env.SOURCE2_VIEWER_URL }} -OutFile ".\cli-windows-x64.zip"
Expand-Archive -Path .\cli-windows-x64.zip -DestinationPath . -Force

- name: Generate Triangles
run: |
Get-ChildItem -Force
.\scripts\generate-tris.ps1 -inputPath "cs_go\game\csgo\maps"

- name: Generate Map Images
run: |
Get-ChildItem -Force
.\scripts\generate-map-images.ps1 -inputPath "cs_go\game\csgo\pak01_dir.vpk"

- name: Generate Map Data
run: |
Get-ChildItem -Force
.\scripts\generate-map-data.ps1 -inputPath "cs_go\game\csgo\pak01_dir.vpk"

- name: Generate Nav
run: |
Get-ChildItem -Force
.\scripts\generate-navs.ps1 -inputPath "cs_go\game\csgo\maps"

- name: Generate Spawns
run: |
Get-ChildItem -Force
.\scripts\generate-spawns.ps1 -inputPath "cs_go\game\csgo\maps"
55 changes: 14 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will run the tests for the awpy Python library
# This workflow will run the Awpy test suite

name: build

Expand All @@ -17,8 +17,8 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"] # Add 3.12 when pxr updates
timeout-minutes: 15
python-version: ["3.10", "3.11", "3.12", "3.13"]
timeout-minutes: 30
steps:
- name: Checkout awpy library
uses: actions/checkout@v4
Expand All @@ -37,55 +37,28 @@ jobs:
# then this could cause issues. So do not do that!
restore-keys: cache-test-demos-

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
poetry.lock
pyproject.toml

- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Setup a local virtual environment for poetry
shell: bash
- name: Set up Python
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local

- uses: actions/cache@v4
name: Cache awpy dependencies
with:
path: ./.venv
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
uv python install ${{ matrix.python-version }}

- name: Install awpy
shell: bash
run: |
poetry install --no-interaction
uv sync --group dev --group test
uv tool install .

- name: Formatting + Lint
shell: bash
run: |
poetry run ruff check . --fix --exit-zero
poetry run ruff check .

# - name: Run pyright
# run: poetry run pyright

# - name: Thorough check with pylint
# run: poetry run pylint awpy
uv run ruff check . --fix --exit-zero
uv run ruff check .

- name: Test
shell: bash
run: |
poetry run coverage run -m pytest --durations=10
poetry run coverage report -m

# - name: Archive code coverage results
# uses: actions/upload-artifact@v4
# with:
# name: code-coverage-report-${{ github.run_id }}
# path: htmlcov/
uv run awpy get tri
uv run coverage run -m pytest --durations=10
uv run coverage report -m
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install awpy
run: |
poetry install --no-interaction

- name: Publish to PyPI
run: |
poetry publish --build --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} -vvv
poetry publish --build --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} -vvv
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ dmypy.json
# pytype static type analyzer
.pytype/

# counter strike demofiles
# counter strike files
*.dem
*.zip
*.nav
*.vphys
*.tri

# vscode
*code-workspace
.vscode/

# AREA_DIST_MATRICES (too large)
awpy/data/nav/area_distance_matrix*.json
30 changes: 4 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,18 @@ repos:
- id: check-builtin-literals
language: python
- repo: 'https://github.com/charliermarsh/ruff-pre-commit'
rev: v0.0.291
rev: v0.8.6
hooks:
- id: ruff
args:
- '--fix'
- '--exit-non-zero-on-fix'
- repo: 'https://github.com/psf/black'
rev: 23.9.1
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.8
hooks:
- id: black
language: python
- id: uv-lock
- repo: https://github.com/crate-ci/typos
rev: v1.16.13
hooks:
- id: typos
args: []
- repo: local
hooks:
- id: pyright
name: pyright
entry: pyright
language: system
types: [python]
pass_filenames: false
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint awpy
language: system
types: [python]
pass_filenames: false
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
]
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
17 changes: 7 additions & 10 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ build:
os: "ubuntu-22.04"
tools:
python: "3.10"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- python -m pip install poetry
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install
commands:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- uv sync --extra docs --frozen
- uv run -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html

sphinx:
configuration: docs/conf.py
configuration: docs/conf.py
34 changes: 18 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
# Contributing to Awpy

Hi! We're happy to have you here. Thank you in advance for your contribution to Awpy.
Hi! We're happy to have you here. Thank you for considering contributing to Awpy.

## Python code

To make sure that Awpy code stays readable and works correctly, we are making use of a variety of helpful tools.

We use the following tools:

- [black](https://github.com/psf/black): An uncompromising Python code formatter.
- [uv](https://docs.astral.sh/uv/): An extremely fast Python package and project manager, written in Rust.
- [ruff](https://github.com/astral-sh/ruff): An extremely fast Python linter, written in Rust.
- [pyright](https://github.com/microsoft/pyright): A static type checker for Python.
- [pylint](https://github.com/pylint-dev/pylint): A static code analyser for Python.
- [pytest](https://docs.pytest.org): A mature full-featured Python testing tool.
- [pre-commit](https://pre-commit.com/): A framework for managing and maintaining multi-language pre-commit hooks.

Please install these tools before you open a pull request to ensure that your contributions are easy to review.
Please install these tools before you begin to develop. After you've installed `uv`, you can run

To install the aforementioned tools, simply run the following:
```shell
pip install -r tests/requirements.txt
pre-commit install --install-hooks
uv sync --all-groups
uv tool install .
```

To install the dependencies. If you want to run Awpy cli commands, you'd do `uv run awpy ...`. To run other commands, you can do `uv run ruff format .` or `uv run pytest .`

To install the pre-commit hooks, you can run `uv run pre-commit install`

After you have made your changes locally, use these tools to surface bugs or code smells by running the following:

```shell
pre-commit run --all-files --show-diff-on-failure # ruff, black, typos, pyright, pylint
coverage run -m pytest --durations=10 # python tests
coverage report -m # produces text-based coverage report
uv run pre-commit run --all-files --show-diff-on-failure # ruff, typos, uv
uv run coverage run -m pytest --durations=10 # python tests
uv run coverage report -m # produces text-based coverage report
```

The coverage run -m pytest --durations=10 command, which runs the Python tests, can take a while as it has to not only download a handful of demos but also parse them. These tests must pass for a pull request to be merged into the main branch.
The coverage run -m pytest --durations=10 command, which runs the Python tests, can take a while as it has to not only download a handful of demos but also parse them. These tests *must pass* for a pull request to be merged into the main branch.

If you do not have the time or bandwidth, you can omit running the test command locally, since Github actions will run them, as well.

### Testing/Coverage

If you are fixing a bug or adding a new feature make sure to also add [unit tests](https://en.wikipedia.org/wiki/Unit_testing) that cover the original bug or your new functionality. If you are new to writing unit tests, look at the aforementioned link, or check out the [tests](tests) directory in Awpy to see how our existing tests are built.
If you are fixing a bug or adding a new feature, we highly recommend you add [unit tests](https://en.wikipedia.org/wiki/Unit_testing) that cover the original bug or your new functionality. If you are new to writing unit tests, look at the aforementioned link, or check out the [tests](tests) directory in Awpy to see how our existing tests are built.

If you are adding a test that requires a specific demo, please let us know so that we can include them in our set of testing demos.
While developing, you can also edit the [test_data.json](/tests/test_data.json) file to include wherever you are hosting the test demo file.
If you are adding a test that requires a specific demo, please let us know so that we can include them in our set of testing demos, which is located in the [test_data.json](/tests/test_data.json) file.

### Game Updates
During game updates, we may need to update .nav, .tri, map images and map data. The scripts to do these are located in `scripts/` and depend on the [Source2Viewer CLI](https://valveresourceformat.github.io/).

## Thanks

With all this you are now ready to make contributions to Awpy. We look forward to your contributions!
With all this you are now ready to make contributions to Awpy. Many users depend on your contributions! We look forward to your help!
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2024 Peter Xenopoulos
Copyright (c) 2020-2025 Peter Xenopoulos

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading
Loading