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

feature/prepare switch to pdm #9

Merged
merged 2 commits into from
Mar 12, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dist/
downloads/
eggs/
.eggs/
.pdm-python
lib/
lib64/
parts/
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changes

- improve prompt for project name
- prepare switch from poetry to pdm

### Deprecated

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ components of the MEx project are open-sourced under the same license as well.
- on unix, consider using pyenv https://github.com/pyenv/pyenv
- get pyenv `curl https://pyenv.run | bash`
- install 3.11 `pyenv install 3.11`
- use version `pyenv global 3.11`
- switch version `pyenv global 3.11`
- run `pip install cruft`
- on windows, see https://python-poetry.org/docs/managing-environments
- install `python3.11` in your preferred way
- on windows, consider using pyenv-win https://pyenv-win.github.io/pyenv-win/
- follow https://pyenv-win.github.io/pyenv-win/#quick-start
- install 3.11 `pyenv install 3.11`
- switch version `pyenv global 3.11`
- run `pip install cruft`

## usage
Expand Down
2 changes: 2 additions & 0 deletions mex-{{ cookiecutter.project_name }}/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ dmypy.json
.bandit
.isort.cfg
.mypy.ini
.pdm-python
.pre-commit-config.yaml
.pydocstyle
Makefile
mex.bat
pdm.lock
poetry.lock
poetry.toml
pytest.ini
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
cache-name: cache-trivy
with:
path: ~/.cache/trivy
{% raw %}key: ${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}{% endraw %}
{% raw %}key: ${{ env.cache-name }}-${{ hashFiles('*.lock') }}{% endraw %}
restore-keys: |
{% raw %}${{ env.cache-name }}-{% endraw %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ jobs:
restore-keys: |
{% raw %}${{ env.cache-name }}-{% endraw %}

- name: Cache poetry
- name: Cache environment
uses: actions/cache@v4
env:
cache-name: cache-poetry
cache-name: cache-environment
with:
path: ~/.cache/pip
{% raw %}key: ${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}{% endraw %}
{% raw %}key: ${{ env.cache-name }}-${{ hashFiles('*.lock') }}{% endraw %}
restore-keys: |
{% raw %}${{ env.cache-name }}-{% endraw %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ jobs:
restore-keys: |
{% raw %}${{ env.cache-name }}-{% endraw %}

- name: Cache poetry
- name: Cache environment
uses: actions/cache@v4
env:
cache-name: cache-poetry
cache-name: cache-environment
with:
path: ~/.cache/pip
{% raw %}key: ${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}{% endraw %}
{% raw %}key: ${{ env.cache-name }}-${{ hashFiles('*.lock') }}{% endraw %}
restore-keys: |
{% raw %}${{ env.cache-name }}-{% endraw %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ jobs:
restore-keys: |
{% raw %}${{ env.cache-name }}-{% endraw %}

- name: Cache poetry
- name: Cache environment
uses: actions/cache@v4
env:
cache-name: cache-poetry
cache-name: cache-environment
with:
path: ~/.cache/pip
{% raw %}key: ${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}{% endraw %}
{% raw %}key: ${{ env.cache-name }}-${{ hashFiles('*.lock') }}{% endraw %}
restore-keys: |
{% raw %}${{ env.cache-name }}-{% endraw %}

Expand Down
1 change: 1 addition & 0 deletions mex-{{ cookiecutter.project_name }}/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dist/
downloads/
eggs/
.eggs/
.pdm-python
lib/
lib64/
parts/
Expand Down
2 changes: 1 addition & 1 deletion mex-{{ cookiecutter.project_name }}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ hooks:
fi; \

install: setup hooks
# run the poetry installation with embedded virtual environment
# install packages from lock file in local virtual environment
@ echo installing package; \
poetry install --no-interaction --sync; \

Expand Down
19 changes: 9 additions & 10 deletions mex-{{ cookiecutter.project_name }}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ components of the MEx project are open-sourced under the same license as well.
- on unix, consider using pyenv https://github.com/pyenv/pyenv
- get pyenv `curl https://pyenv.run | bash`
- install 3.11 `pyenv install 3.11`
- create env `pyenv virtualenv 3.11 mex`
- go to repo root
- use env `pyenv local mex`
- switch version `pyenv global 3.11`
- run `make install`
- on windows, see https://python-poetry.org/docs/managing-environments
- install `python3.11` in your preferred way
- go to repo root
- on windows, consider using pyenv-win https://pyenv-win.github.io/pyenv-win/
- follow https://pyenv-win.github.io/pyenv-win/#quick-start
- install 3.11 `pyenv install 3.11`
- switch version `pyenv global 3.11`
- run `.\mex.bat install`

### linting and testing
Expand All @@ -71,16 +70,16 @@ components of the MEx project are open-sourced under the same license as well.
### updating dependencies

- update boilerplate files with `cruft update`
- update global dependencies in `requirements.txt` manually
- update global requirements in `requirements.txt` manually
- update git hooks with `pre-commit autoupdate`
- show outdated dependencies with `poetry show --outdated`
- update dependencies in poetry using `poetry update --lock`
- update github actions manually in `.github/workflows/*.yml`
- update github actions in `.github/workflows/*.yml` manually

### creating release

- update version, eg `poetry version minor`
- commit update `git commit --message "..." pyproject.toml`
- update version in `pyproject.toml` and `CHANGELOG.md`
- commit update `git commit --message "..."`
- create a tag `git tag ...`
- push `git push --follow-tags`

Expand Down
2 changes: 1 addition & 1 deletion mex-{{ cookiecutter.project_name }}/mex.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if "%CI%"=="" (
if %errorlevel% neq 0 exit /b %errorlevel%
)

@REM run the poetry installation with embedded virtual environment
@REM install packages from lock file in local virtual environment
echo installing package
poetry install --no-interaction --sync
exit /b %errorlevel%
Expand Down