Skip to content

Commit

Permalink
feature/prepare switch to pdm (#9)
Browse files Browse the repository at this point in the history
# Changes
- prepare switch from poetry to pdm
  • Loading branch information
cutoffthetop authored Mar 12, 2024
1 parent 5007775 commit e562a36
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 25 deletions.
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

0 comments on commit e562a36

Please sign in to comment.