Skip to content

270 build broken with poetry core 200 #272

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

Merged
merged 2 commits into from
Apr 8, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
udo
anchestors
13 changes: 13 additions & 0 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"cookiecutter": {
"_checkout": null,
"_output_dir": "/Users/c0fec0de/projects",
"_repo_dir": "/Users/c0fec0de/.cookiecutters/python-template",
"_template": "gh:nbiotcloud/python-template",
"name": "anytree",
"snake_name": "anytree",
"title": "Powerful and Lightweight Python Tree Data Structure with various plugins",
"user": "c0fec0de",
"year": "2016"
}
}
73 changes: 43 additions & 30 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,67 @@
name: test

name: main
on: [push, pull_request, release]

jobs:
build:

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-latest
os:
- "ubuntu-latest"
- "macos-latest"
# - "windows-latest"
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: astral-sh/setup-uv@v5
with:
version: "0.6.9"
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
sudo apt-get install -y graphviz
pip install tox "poetry>=1.4" coveralls
- name: TOX
run: tox
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install graphviz
run: sudo apt install -y graphviz || true
- name: Run all
run: make all
- name: Upload coverage data to coveralls.io
run: coveralls --service=github
run: uv run --frozen -- coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
COVERALLS_PARALLEL: true

coveralls:
name: Indicate completion to coveralls.io
needs: build
needs: test
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5
with:
version: "0.6.9"
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Upload coverage data to coveralls.io
run: uv run --frozen -- coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish:
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: coveralls
name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
- uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
- name: Publish package distributions to PyPI
run: pdm publish
21 changes: 15 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
*.egg-info/
*.xml
__pycache__
.*_cache/
.coverage
.tox
.venv
.coverage*
.DS_Store
.hypothesis
.mypy_cache
.nox/
.pdm-python
.test2ref
.tox
.venv*
*.egg-info/
*.pyc
*.xml
/.vscode
__pycache__
build
build/
dist/
docs/_readthedocs/
poetry.lock
report.xml
setup.py
48 changes: 48 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
exclude: ^tests/refdata/.*
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.11.2
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-xml
- id: debug-statements
- id: check-added-large-files
- id: check-merge-conflict
- id: mixed-line-ending

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: remove-tabs
args: [--whitespaces-count, "2"] # defaults to: 4
# - id: insert-license
# files: \.py$
# args:
# - --license-filepath
# - LICENSE
# - --use-current-year

- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
args:
- "--write-changes"
- "--ignore-words=.codespellignore"
additional_dependencies:
- tomli
exclude: '^uv\.lock$'
8 changes: 4 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.11"

commands:
- pip install --upgrade --no-cache-dir pip
- pip install --no-cache-dir "poetry>=1.4" "crashtest==0.4.1"
- poetry install --with=doc --without=test
- poetry run make html -C docs
- pip install --no-cache-dir uv
- make doc
- mkdir _readthedocs
- cp -r docs/build _readthedocs
77 changes: 54 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,72 @@
# Contribute
# CONTRIBUTING

## Branches
Please follow github workflow. Create a ticket and/or branch. Create a pull-request.

* `2.x.x` main line for `2.x.x`
* `3.x.x` main line for `3.x.x`
* documentation links refer to `3.x.x`
* 2.x.x can be merged to 3.x.x
* `main`
* 2.x.x can be merged to main
## Local Development

## Testing
### Installation

### Create Environment
Please install these tools:

Run these commands just the first time:
* [`uv` Installation](https://docs.astral.sh/uv/getting-started/installation/)
* [`make`](https://www.gnu.org/software/make/)
* [`git`](https://git-scm.com/)
* [Visual Studio Code](https://code.visualstudio.com/)
* [`graphviz`](https://graphviz.org/)


### Editor
Start Visual Studio Code:

```bash
# Ensure python3 is installed
python3 -m venv .venv
source .venv/bin/activate
pip install tox "poetry>=1.4" "crashtest==0.4.1"
make code
```

### Enter Environment
### Testing

Run this command once you open a new shell:
Run auto-formatting, linting, tests and documentation build:

```bash
source .venv/bin/activate
make all
```

### Test Your Changes
See `make help` for any further details.

Please note that `tests/refdata` contains reference data from test runs.
`make test2refdata` updates this directory.

## Project Structure

The project contains these files and directories:

| File/Directory | Description |
|---|---|
| `src/` | Python Package Sources - the files this is all about |
| `pyproject.toml` | Python Package Meta File. Also contains all tool settings |
| `.gitignore` | Lists of files and directories ignored by version control system |
| `.github/` | Github Settings |
| `.readthedocs.yaml` | Documentation Server Configuration |
| `.pre-commit-config.yaml` | Pre-Commit Check Configuration |
| `uv.lock` | File with resolved python package dependencies |

Next to that, there are some temporary files ignored by version control system.

| File/Directory | Description |
|---|---|
| `htmlcov/` | Test Execution Code Coverage Report in HTML format |
| `report.xml` | Test Execution Report |
| `.venv` | Virtual Environments |


## Branches

* `2.x.x` main line for `2.x.x`
* `3.x.x` main line for `3.x.x`
* documentation links refer to `3.x.x`
* 2.x.x can be merged to 3.x.x
* `main`
* 2.x.x can be merged to main

```bash
# test
tox
```

### Release

Expand Down
79 changes: 79 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
_GREEN:=\033[0;32m
_BLUE:=\033[0;34m
_BOLD:=\033[1m
_NORM:=\033[0m
ENV:=uv run --frozen --
PYTEST_OPTIONS=


.PHONY: help
help: ## [DEFAULT] Show this help
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?##"}; {printf "${_BLUE}${_BOLD}%-10s${_NORM} %s\n", $$1, $$2}'


.PHONY: all
all: ## Do everything taggged with [ALL] below
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep "\[ALL\]" | grep -v "^all" | awk 'BEGIN {FS = ":.*?##"}; {printf "%s ", $$1}' | xargs make
@echo "\n ${_GREEN}${_BOLD}PASS${_NORM}\n"


.PHONY: pre-commit
pre-commit: .venv/.valid .git/hooks/pre-commit ## [ALL] Run 'pre-commit' on all files
${ENV} pre-commit run --all-files

.git/hooks/pre-commit: .venv/.valid
${ENV} pre-commit install --install-hooks


.PHONY: test
test: .venv/.valid ## [ALL] Run Unittests via 'pytest' with {PYTEST_OPTIONS}
${ENV} pytest -vv ${PYTEST_OPTIONS}
@echo "See coverage report:\n\n file://${PWD}/htmlcov/index.html\n"


.PHONY: test2refdata
test2refdata: .venv/.valid ## Run Unittests via 'pytest' with {PYTEST_OPTIONS} and update tests/refdata
rm -rf tests/refdata
touch .test2ref
${ENV} pytest -vv ${PYTEST_OPTIONS}
@echo "See coverage report:\n\n file://${PWD}/htmlcov/index.html\n"
rm .test2ref


.PHONY: checktypes
checktypes: .venv/.valid ## [ALL] Run Type-Checking via 'mypy'
${ENV} mypy src


.PHONY: doc
doc: .venv/.valid ## [ALL] Build Documentation via 'mkdocs'
${ENV} make html -C docs


.PHONY: code
code: ## Start Visual Studio Code
code anytree.code-workspace &


.PHONY: clean
clean: ## Remove everything mentioned by '.gitignore' file
git clean -Xdf


.PHONY: distclean
distclean: ## Remove everything mentioned by '.gitignore' file and UNTRACKED files
git clean -xdf


.PHONY: shell
shell: ## Open a project specific SHELL. For leaving use 'exit'.
${ENV} ${SHELL}


# Helper
.venv/.valid: pyproject.toml uv.lock
uv sync --frozen
@touch $@

uv.lock:
uv lock
3 changes: 0 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
.. image:: https://coveralls.io/repos/github/c0fec0de/anytree/badge.svg
:target: https://coveralls.io/github/c0fec0de/anytree

.. image:: https://readthedocs.org/projects/anytree/badge/?version=stable
:target: https://anytree.readthedocs.io/en/stable

.. image:: https://api.codeclimate.com/v1/badges/e6d325d6fd23a93aab20/maintainability
:target: https://codeclimate.com/github/c0fec0de/anytree/maintainability
:alt: Maintainability
Expand Down
Loading