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

Features: DEV-3305 Migrate to Poetry, Python 3.9, PyTorch 1.12 #22

Merged
merged 12 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from 11 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
35 changes: 17 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
PYTHON_VERSION = 3.6.9
PYTHON_VERSION = 3.9.13

PIP = env/bin/pip
PYTHON = env/bin/python
VIRTUALENV = $(PYENV_ROOT)/versions/$(PYTHON_VERSION)/bin/virtualenv
PIP = poetry run pip
PYTHON = poetry run python

VERSION := $(shell sed -rn 's/^__version__\s*=\s*"(.+)"/\1/p' yolov5/__init__.py)

env:
pyenv install -s $(PYTHON_VERSION) # make sure expected python version is available
$(PYENV_ROOT)/versions/$(PYTHON_VERSION)/bin/pip install virtualenv # ensure virtualenv is installed for given python
if [ ! "$(shell $(PYTHON) -V)" = "Python $(PYTHON_VERSION)" ]; then \
echo "WARNING: python version mismatch => reset virtualenv" && rm -rf env/; \
fi
if [ ! -d env/ ]; then \
$(VIRTUALENV) env/; \
fi
# make sure expected python version is available
PYTHON_CONFIGURE_OPTS=--enable-shared pyenv install -s $(PYTHON_VERSION)
pyenv local $(PYTHON_VERSION)
poetry install --with dev
$(PIP) install -qU pip


init:
$(PIP) install -Ur requirements-dev.txt

Expand All @@ -34,17 +32,18 @@ test:
env/bin/pytest

dist: clean
#check-manifest
$(PYTHON) setup.py sdist bdist_wheel
ls -l dist
env/bin/twine check dist/*
poetry check
ifneq ($(VERSION),$(strip $(shell poetry version | cut -d " " -f 2 )))
$(error Package and code versions mismatch, please try poetry install)
endif
poetry build

tag:
git tag -f -a -m "Auto-generated tag" `sed -rn 's/^__version__\s*=\s*"(.+)"/\1/p' yolov5/__init__.py`
git tag -f -a -m "Auto-generated tag" $(VERSION)
git push --tags --force

release: clean dist tag
env/bin/twine upload dist/* --repository-url https://pypi.psycle.dev/
poetry publish -r psycle

lint:
env/bin/black . --exclude '/(env)/'
Expand Down
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Fork of YOLOv5

## About the package

\# TODO

## Package management

### Makefile

Poetry `~1.2` is required to run the Makefile.
Mindstan marked this conversation as resolved.
Show resolved Hide resolved

Install the environment:

```bash
make env
```

Build the source and wheel distribution:

```bash
make dist
```

Build and release the package to the private PyPI (requires to setup Poetry auth), and tag this commit:
```bash
make release
```

Remove all temporary files (cached Python code)
```bash
make clean
```

### Poetry

This package is using Poetry. Here are some usefull commands.

```bash
# Install current package environment
poetry install

# Install current package environment with dev dependencies
poetry install --with dev

# Run a command inside the virtualenv
poetry run my_command

# Enter the virtualenv (exit with exit command or <CTRL+D>)
poetry shell

# Update dependances
poetry lock

# Refresh lock file without looking for updated packages
poetry lock --no-update
```
Loading