Skip to content

Commit 7ae3714

Browse files
authored
Merge pull request #12 from runemalm/feature/next-version
Feature/next version
2 parents 6174e1b + 5b46548 commit 7ae3714

File tree

14 files changed

+139
-436
lines changed

14 files changed

+139
-436
lines changed

.bumpversion.cfg

Lines changed: 0 additions & 12 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ docs/_build/
7272
# Project-specific files
7373
scratch
7474
env.make
75+
76+
# Docs
77+
docs/.venv

.readthedocs.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,12 @@ version: 2
99
build:
1010
os: ubuntu-22.04
1111
tools:
12-
python: "3.12"
13-
# You can also specify other tool versions:
14-
# nodejs: "19"
15-
# rust: "1.64"
16-
# golang: "1.19"
12+
python: "3.12.11"
1713

1814
# Build documentation in the "docs/" directory with Sphinx
1915
sphinx:
2016
configuration: docs/conf.py
2117

22-
# Optionally build your docs in additional formats such as PDF and ePub
23-
# formats:
24-
# - pdf
25-
# - epub
26-
2718
# Optional but recommended, declare the Python requirements required
2819
# to build your documentation
2920
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html

Makefile

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ SRC := $(PWD)/src
1212
TESTS := $(PWD)/tests
1313
DOCS := $(PWD)/docs
1414

15+
DOCS_PYTHON_VERSION := 3.12.11
16+
1517
# Load env file
1618
include env.make
1719
export $(shell sed 's/=.*//' env.make)
@@ -36,6 +38,10 @@ test: ## run test suite
3638
# RELEASE
3739
################################################################################
3840

41+
.PHONY: bump-version
42+
bump-version: ## bump the package version (uses VERSION)
43+
sed -i '' "s/__version__ = \".*\"/__version__ = \"$(VERSION)\"/" $(SRC)/dependency_injection/_version.py
44+
3945
.PHONY: build
4046
build: ## build the python package
4147
pipenv run python setup.py sdist bdist_wheel
@@ -48,10 +54,6 @@ clean: ## clean the build
4854
find . -type d -name __pycache__ -exec rm -rf {} +
4955
find . -type d -name '*.egg-info' -exec rm -rf {} +
5056

51-
.PHONY: bump_version
52-
bump_version: ## Bump the version
53-
pipenv run bump2version --dry-run release --allow-dirty --verbose
54-
5557
.PHONY: upload-test
5658
upload-test: ## upload package to testpypi repository
5759
TWINE_USERNAME=$(PYPI_USERNAME_TEST) TWINE_PASSWORD=$(PYPI_PASSWORD_TEST) pipenv run twine upload --repository testpypi --skip-existing --repository-url https://test.pypi.org/legacy/ dist/*
@@ -60,23 +62,45 @@ upload-test: ## upload package to testpypi repository
6062
upload: ## upload package to pypi repository
6163
TWINE_USERNAME=$(PYPI_USERNAME) TWINE_PASSWORD=$(PYPI_PASSWORD) pipenv run twine upload --skip-existing dist/*
6264

63-
.PHONY: sphinx-quickstart
64-
sphinx-quickstart: ## run the sphinx quickstart
65-
pipenv run docker run -it --rm -v $(PWD)/docs:/docs sphinxdoc/sphinx sphinx-quickstart
65+
################################################################################
66+
# DOCS
67+
################################################################################
68+
69+
.PHONY: sphinx-venv-init
70+
sphinx-venv-init: ## Init venv for docs (requires pyenv $(DOCS_PYTHON_VERSION))
71+
cd $(DOCS) && \
72+
command -v pyenv >/dev/null || { echo "pyenv not found"; exit 1; } && \
73+
pyenv versions --bare | grep -q "^$(DOCS_PYTHON_VERSION)$$" || { echo "pyenv $(DOCS_PYTHON_VERSION) not installed"; exit 1; } && \
74+
PYENV_PYTHON=$$(pyenv root)/versions/$(DOCS_PYTHON_VERSION)/bin/python && \
75+
$$PYENV_PYTHON -m venv .venv && \
76+
.venv/bin/pip install --upgrade pip && \
77+
.venv/bin/pip install -r requirements.txt
78+
79+
.PHONY: sphinx-venv-install
80+
sphinx-venv-install: ## Install or update docs venv from requirements.txt
81+
cd $(DOCS) && \
82+
[ -d .venv ] || { echo "Missing .venv — run sphinx-venv-init first."; exit 1; } && \
83+
.venv/bin/pip install -r requirements.txt
84+
85+
.PHONY: sphinx-venv-rm
86+
sphinx-venv-rm: ## Remove docs venv
87+
rm -rf $(DOCS)/.venv
6688

6789
.PHONY: sphinx-html
6890
sphinx-html: ## build the sphinx html
69-
pipenv run make -C docs html
91+
cd $(DOCS) && .venv/bin/sphinx-build -M html . _build
7092

7193
.PHONY: sphinx-rebuild
7294
sphinx-rebuild: ## re-build the sphinx docs
7395
cd $(DOCS) && \
74-
pipenv run make clean && pipenv run make html
96+
rm -rf _build/.doctrees && \
97+
.venv/bin/sphinx-build -M clean . _build && \
98+
.venv/bin/sphinx-build -M html . _build
7599

76100
.PHONY: sphinx-autobuild
77101
sphinx-autobuild: ## activate autobuild of docs
78102
cd $(DOCS) && \
79-
pipenv run sphinx-autobuild . _build/html --watch $(SRC)
103+
.venv/bin/sphinx-autobuild . _build/html --watch $(SRC)
80104

81105
################################################################################
82106
# PRE-COMMIT HOOKS
@@ -110,24 +134,24 @@ pre-commit-run: ## run the pre-commit hooks
110134
pipenv-rm: ## remove the virtual environment
111135
pipenv --rm
112136

113-
.PHONY: pipenv-install
114-
pipenv-install: ## setup the virtual environment
137+
.PHONY: pipenv-install-dev
138+
pipenv-install-dev: ## setup the virtual environment, with dev packages
115139
pipenv install --dev
116140

117141
.PHONY: pipenv-install-package
118142
pipenv-install-package: ## install a package (uses PACKAGE)
119143
pipenv install $(PACKAGE)
120144

121-
.PHONY: pipenv-install-package-dev
122-
pipenv-install-package-dev: ## install a dev package (uses PACKAGE)
145+
.PHONY: pipenv-install-dev-package
146+
pipenv-install-dev-package: ## install a dev package (uses PACKAGE)
123147
pipenv install --dev $(PACKAGE)
124148

125-
.PHONY: pipenv-packages-graph
126-
pipenv-packages-graph: ## Check installed packages
149+
.PHONY: pipenv-graph
150+
pipenv-graph: ## Check installed packages
127151
pipenv graph
128152

129-
.PHONY: pipenv-requirements-generate
130-
pipenv-requirements-generate: ## Check a requirements.txt
153+
.PHONY: pipenv-generate-requirements
154+
pipenv-generate-requirements: ## Check a requirements.txt
131155
pipenv lock -r > requirements.txt
132156

133157
.PHONY: pipenv-shell
@@ -146,7 +170,3 @@ pipenv-lock-and-install: ## Lock the pipfile and install (after updating Pipfile
146170
.PHONY: pipenv-pip-freeze
147171
pipenv-pip-freeze: ## Run pip freeze in the virtual environment
148172
pipenv run pip freeze
149-
150-
.PHONY: pipenv-setup-sync
151-
pipenv-setup-sync: ## Sync dependencies between Pipfile and setup.py
152-
pipenv run pipenv-setup sync

Pipfile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ name = "pypi"
66
[packages]
77

88
[dev-packages]
9-
pytest = "7.4.4"
10-
sphinx = "5.3.0"
11-
sphinx-rtd-theme = "2.0.0"
12-
sphinx-autobuild = "2021.3.14"
13-
sphinxcontrib-napoleon = "0.7"
14-
wheel = "0.41.2"
15-
pytest-xdist = "*"
16-
bump2version = "*"
179
black = "*"
1810
flake8 = "*"
1911
importlib-metadata = "==4.13.0"
2012
pre-commit = "*"
13+
pytest = "7.4.4"
14+
pytest-xdist = "*"
15+
typing-extensions = "*"
16+
wheel = "0.42.0"
2117

2218
[requires]
2319
python_version = "3.7.17"

0 commit comments

Comments
 (0)