Skip to content

Commit

Permalink
Merge pull request #115 from uclahs-cds/aholmes-rename-project
Browse files Browse the repository at this point in the history
Rename BL_Python to Ligare
  • Loading branch information
aholmes authored Sep 24, 2024
2 parents 9754c73 + a2431d3 commit 30025e8
Show file tree
Hide file tree
Showing 176 changed files with 680 additions and 695 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/CICD-scripts/pyproject_dependency_rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@

import toml

# Import BL_Python.programming.cli.argparse.
# Import Ligare.programming.cli.argparse.
# This must be done this way as this script is not used within an
# environment in which BL_Python has been installed, and so
# environment in which Ligare has been installed, and so
# the modules cannot be imported the usual way.
programming_module_name = "BL_Python.programming.cli.argparse"
programming_module_name = "Ligare.programming.cli.argparse"
module_path = Path(
Path(__file__).parent,
"../../../src/programming/BL_Python/programming/cli/argparse.py",
"../../../src/programming/Ligare/programming/cli/argparse.py",
)
spec = importlib.util.spec_from_file_location(programming_module_name, str(module_path))
if spec is None or not spec.loader:
raise Exception(f"Could not find module `{programming_module_name}`.")
BL_Python_argparse = importlib.util.module_from_spec(spec)
sys.modules[programming_module_name] = BL_Python_argparse
spec.loader.exec_module(BL_Python_argparse)
Ligare_argparse = importlib.util.module_from_spec(spec)
sys.modules[programming_module_name] = Ligare_argparse
spec.loader.exec_module(Ligare_argparse)
# finish import


Expand All @@ -50,13 +50,13 @@ class RewriteArgs(Namespace):
"-c",
"--config",
type=Path,
action=BL_Python_argparse.PathExists,
action=Ligare_argparse.PathExists,
help="The path to the pyproject.toml file to rewrite. If not specified, all pyproject.toml under src/*/pyproject.toml, and pyproject.toml will be processed.",
required=False,
)
args = parser.parse_args(namespace=RewriteArgs)

BL_PYTHON = "BL_Python"
LIGARE = "Ligare"
WORKFLOW_DISPATCH_REWRITE_DEPENDENCIES = environ.get("REWRITE_DEPENDENCIES") or "true"
GIT_REF = environ.get("GITHUB_REF")

Expand Down Expand Up @@ -96,7 +96,7 @@ class RewriteArgs(Namespace):

for pyproject_file in pyproject_files:
print(
f"Rewriting BL_Python dependency specifications in {pyproject_file} for filesystem build."
f"Rewriting Ligare dependency specifications in {pyproject_file} for filesystem build."
)

data: dict[str, Any]
Expand All @@ -107,26 +107,26 @@ class RewriteArgs(Namespace):
dependencies_hash = hash(tuple(dependencies))

for idx, dependency in enumerate(dependencies):
if not dependency.startswith(BL_PYTHON):
if not dependency.startswith(LIGARE):
continue

dependency_match = re.match(r"(BL_Python\.[^=<!~\s]+)", dependency)
dependency_match = re.match(r"(Ligare\.[^=<!~\s]+)", dependency)
if dependency_match is None:
raise ValueError(f"BL_Python dependency name '{dependency}' is invalid.")
raise ValueError(f"Ligare dependency name '{dependency}' is invalid.")

dependency = dependency_match[0]

# e.g. "web" in "BL_Python.web"
# e.g. "web" in "Ligare.web"
sub_dep = dependency[dependency.index(".") + 1 :]
dep_path = WORKDIR + (
f"/{sub_dep}" if dependency == BL_PYTHON else f"/src/{sub_dep}"
f"/{sub_dep}" if dependency == LIGARE else f"/src/{sub_dep}"
)
new_dep = f"{dependency} @ file://{dep_path}"
dependencies[idx] = new_dep

# list has not changed?
if dependencies_hash == hash(tuple(dependencies)):
print(f"Skipped writing {pyproject_file}. No BL_Python dependencies in file.")
print(f"Skipped writing {pyproject_file}. No Ligare dependencies in file.")
continue

with open(pyproject_file, "w") as f:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/CICD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ on:
inputs:
rewrite_dependencies:
description:
If "true" or empty CICD will rewrite BL_Python dependencies,
If "true" or empty CICD will rewrite Ligare dependencies,
during the build only, to use the local filesystem checkout rather than PyPI.
If "false" CICD will not rewrite the BL_Python dependencies.
If "false" CICD will not rewrite the Ligare dependencies.
type: choice
options:
- true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
set -eo pipefail
tag="${GITHUB_REF#refs/*/}"

# This is the package name minus `BL_Python.`.
package_name=$(gawk 'match($0, /BL_Python\.?([^-]+)?/, m) { print s m[1]}' <<<$tag)
# This is the package name minus `Ligare.`.
package_name=$(gawk 'match($0, /Ligare\.?([^-]+)?/, m) { print s m[1]}' <<<$tag)

Check warning on line 6 in .github/workflows/PyPI-scripts/extract-package-details-from-tag.sh

View workflow job for this annotation

GitHub Actions / static-analysis

Double quote to prevent globbing and word splitting. [SC2086]
# `all` is the root of the repository and includes all other packages
if [ "$package_name" == "all" ]; then
package_directory=.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/PyPI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
on:
push:
tags:
- "BL_Python.*-v*"
- "Ligare.*-v*"
jobs:
build:
name: Build distribution 📦
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/BL_Python.${{ needs.build.outputs.package_name }}
url: https://pypi.org/p/Ligare.${{ needs.build.outputs.package_name }}
permissions:
id-token: write

Expand Down
82 changes: 41 additions & 41 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changelog
All notable changes to the BL_Python monorepo and individual packages contained within.
All notable changes to the Ligare monorepo and individual packages contained within.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

Expand All @@ -8,62 +8,62 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
---
## Unreleased

# `BL_Python.all` [0.3.0] - 2024-08-09
# `Ligare.all` [0.3.0] - 2024-08-09
### Changed
* Update many dependencies
* Abstract feature flag cache and refactor related code so using feature flags is simpler [8b858303](https://github.com/uclahs-cds/BL_Python/commit/8b858303d821354040c099f2bd7f29c23ca4735c)
* Abstract feature flag cache and refactor related code so using feature flags is simpler [8b858303](https://github.com/uclahs-cds/Ligare/commit/8b858303d821354040c099f2bd7f29c23ca4735c)

### Fixed
* Resolve failure in installing correct Pyright version during CICD [c7dddd65](https://github.com/uclahs-cds/BL_Python/commit/c7dddd65b000a3a5f102d52c369a4ee82ccf8e6d)
* Close SQLAlchemy session in Identity user loader when database operations are finished [c5620463](https://github.com/uclahs-cds/BL_Python/commit/c5620463abbd9931993761cc9ad2e9630d4daedd)
* Fix confusion in feature flag caching through refactor and docs update [8b858303](https://github.com/uclahs-cds/BL_Python/commit/8b858303d821354040c099f2bd7f29c23ca4735c)
* Fix interface error in feature flags regarding parameter mismatch and a lie about how database feature flags work [8b858303](https://github.com/uclahs-cds/BL_Python/commit/8b858303d821354040c099f2bd7f29c23ca4735c)
* Resolved several type and style errors arising from Pyright and Ruff updates [6f3675bd](https://github.com/uclahs-cds/BL_Python/commit/6f3675bd5def3d6700da01869f03d39841fc8049)
* Resolve failure in installing correct Pyright version during CICD [c7dddd65](https://github.com/uclahs-cds/Ligare/commit/c7dddd65b000a3a5f102d52c369a4ee82ccf8e6d)
* Close SQLAlchemy session in Identity user loader when database operations are finished [c5620463](https://github.com/uclahs-cds/Ligare/commit/c5620463abbd9931993761cc9ad2e9630d4daedd)
* Fix confusion in feature flag caching through refactor and docs update [8b858303](https://github.com/uclahs-cds/Ligare/commit/8b858303d821354040c099f2bd7f29c23ca4735c)
* Fix interface error in feature flags regarding parameter mismatch and a lie about how database feature flags work [8b858303](https://github.com/uclahs-cds/Ligare/commit/8b858303d821354040c099f2bd7f29c23ca4735c)
* Resolved several type and style errors arising from Pyright and Ruff updates [6f3675bd](https://github.com/uclahs-cds/Ligare/commit/6f3675bd5def3d6700da01869f03d39841fc8049)

### Security
* Add dependabot configuration for each BL_Python's Python dependencies [d36e8eda](https://github.com/uclahs-cds/BL_Python/commit/d36e8edaedd5af078be2f0e428790554bc94ab34)
* Add dependabot configuration for each Ligare's Python dependencies [d36e8eda](https://github.com/uclahs-cds/Ligare/commit/d36e8edaedd5af078be2f0e428790554bc94ab34)


## `BL_Python.AWS` [0.3.0] - 2024-08-09
- [BL_Python.AWS v0.3.0](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.AWS-v0.3.0/src/AWS/CHANGELOG.md#030---2024-08-09)
## `Ligare.AWS` [0.3.0] - 2024-08-09
- [Ligare.AWS v0.3.0](https://github.com/uclahs-cds/Ligare/blob/Ligare.AWS-v0.3.0/src/AWS/CHANGELOG.md#030---2024-08-09)

## `BL_Python.database` [0.2.1] - 2024-08-09
- [BL_Python.database v0.2.1](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.database-v0.2.1/src/database/CHANGELOG.md#021---2024-08-09)
## `Ligare.database` [0.2.1] - 2024-08-09
- [Ligare.database v0.2.1](https://github.com/uclahs-cds/Ligare/blob/Ligare.database-v0.2.1/src/database/CHANGELOG.md#021---2024-08-09)

## `BL_Python.platform` [0.3.0] - 2024-08-09
- [BL_Python.platform v0.3.0](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.platform-v0.3.0/src/platform/CHANGELOG.md#030---2024-08-09)
## `Ligare.platform` [0.3.0] - 2024-08-09
- [Ligare.platform v0.3.0](https://github.com/uclahs-cds/Ligare/blob/Ligare.platform-v0.3.0/src/platform/CHANGELOG.md#030---2024-08-09)

## `BL_Python.web` [0.2.5] - 2024-08-09
- [BL_Python.web v0.2.5](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.web-v0.2.5/src/web/CHANGELOG.md#025---2024-08-09)
## `Ligare.web` [0.2.5] - 2024-08-09
- [Ligare.web v0.2.5](https://github.com/uclahs-cds/Ligare/blob/Ligare.web-v0.2.5/src/web/CHANGELOG.md#025---2024-08-09)

# `BL_Python.all` [0.2.5] - 2024-05-30
## `BL_Python.web` [0.2.4] - 2024-05-30
- [BL_Python.web v0.2.4](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.web-v0.2.4/src/web/CHANGELOG.md#024---2024-05-30)
# `Ligare.all` [0.2.5] - 2024-05-30
## `Ligare.web` [0.2.4] - 2024-05-30
- [Ligare.web v0.2.4](https://github.com/uclahs-cds/Ligare/blob/Ligare.web-v0.2.4/src/web/CHANGELOG.md#024---2024-05-30)

# `BL_Python.all` [0.2.4] - 2024-05-17
# `Ligare.all` [0.2.4] - 2024-05-17

## `BL_Python.web` [0.2.3] - 2024-05-17
- [BL_Python.web v0.2.3](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.web-v0.2.3/src/web/CHANGELOG.md#023---2024-05-17)
## `Ligare.web` [0.2.3] - 2024-05-17
- [Ligare.web v0.2.3](https://github.com/uclahs-cds/Ligare/blob/Ligare.web-v0.2.3/src/web/CHANGELOG.md#023---2024-05-17)

# `BL_Python.all` [0.2.3] - 2024-05-16
- Contains all libraries up to v0.2.1, and `BL_Python.platform` v0.2.2 and `BL_Python.web` v0.2.2
# `Ligare.all` [0.2.3] - 2024-05-16
- Contains all libraries up to v0.2.1, and `Ligare.platform` v0.2.2 and `Ligare.web` v0.2.2

## `BL_Python.web` [0.2.2] - 2024-05-16
- [BL_Python.web v0.2.2](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.web-v0.2.2/src/web/CHANGELOG.md#022---2024-05-16)
## `Ligare.web` [0.2.2] - 2024-05-16
- [Ligare.web v0.2.2](https://github.com/uclahs-cds/Ligare/blob/Ligare.web-v0.2.2/src/web/CHANGELOG.md#022---2024-05-16)

## `BL_Python.platform` [0.2.2] - 2024-05-16
- [BL_Python.platform v0.2.2](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.platform-v0.2.2/src/platform/CHANGELOG.md#022---2024-05-16)
## `Ligare.platform` [0.2.2] - 2024-05-16
- [Ligare.platform v0.2.2](https://github.com/uclahs-cds/Ligare/blob/Ligare.platform-v0.2.2/src/platform/CHANGELOG.md#022---2024-05-16)

# [0.2.0] - 2024-05-14
### Added
- New package `BL_Python.identity` for SSO
- SAML2 support in `BL_Python.web`
- New package `Ligare.identity` for SSO
- SAML2 support in `Ligare.web`
- Package interconnectivity for managing user identities in a database and tying into SSO and SAML2
- User session support through `flask-login`
- A Makefile so developers can get started by running `make`
- Many `pytest` fixtures for more easily testing Connexion and Flask applications
- `FlaskContextMiddleware` to make it easier to alter all aspects of an ASGI application in any middleware that runs at any time
- Alembic database migration support in both `BL_Python.database` and scaffolded `BL_Python.web` applications
- Alembic database migration support in both `Ligare.database` and scaffolded `Ligare.web` applications

### Fixed
- Possible crash when using dependency injection in some middlewares
Expand All @@ -72,15 +72,15 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# [0.1.0] - 2024-02-16
### Added
- Setuptools package configurations for:
- `BL_Python`
- `BL_Python.AWS`
- `BL_Python.database`
- `BL_Python.development`
- `BL_Python.platform`
- `BL_Python.programming`
- `BL_Python.testing`
- `BL_Python.testing`
- `BL_Python.web`
- `Ligare`
- `Ligare.AWS`
- `Ligare.database`
- `Ligare.development`
- `Ligare.platform`
- `Ligare.programming`
- `Ligare.testing`
- `Ligare.testing`
- `Ligare.web`
- Flask application scaffolding
- SQLite support
- Various software development tools
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# BL_Python Contribution Guidelines
# Ligare Contribution Guidelines

Create a new pull request with an explanation of what the PR is fixing.
Create a new pull request with an explanation of what the PR is fixing.
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ endif
ACTIVATE_VENV := . $(VENV)/bin/activate
REPORT_VENV_USAGE := echo '\nActivate your venv with `. $(VENV)/bin/activate`'

PACKAGE_INSTALL_DIR := $(VENV)/lib/python*/site-packages/BL_Python
PACKAGE_INSTALL_DIR := $(VENV)/lib/python*/site-packages/Ligare

# used to suppress outputs of targets (see `test` and `clean-test`)
CMD_PREFIX=

PYPROJECT_FILES=./pyproject.toml $(wildcard src/*/pyproject.toml)
PACKAGE_PATHS=$(subst /pyproject.toml,,$(PYPROJECT_FILES))
PACKAGES=$(subst /pyproject.toml,,$(subst src/,BL_Python.,$(wildcard src/*/pyproject.toml)))
PACKAGES=$(subst /pyproject.toml,,$(subst src/,Ligare.,$(wildcard src/*/pyproject.toml)))


MAKE_ARTIFACT_DIRECTORY = .make
Expand All @@ -85,8 +85,8 @@ dev :
$(SETUP_DEV_SENTINEL): $(VENV) $(SETUP_DEPENDENCIES_SENTINEL) $(PYPROJECT_FILES_SENTINEL) | $(MAKE_ARTIFACT_DIRECTORY)
# `pip list` is multiple seconds faster than `pip show` ...
$(ACTIVATE_VENV) && \
if pip list -l --no-index | grep '^BL_Python\.all\s'; then \
echo "Package BL_Python.all is already built, skipping..."; \
if pip list -l --no-index | grep '^Ligare\.all\s'; then \
echo "Package Ligare.all is already built, skipping..."; \
else \
pip install -e .[dev-dependencies] && \
pip install -e src/database[postgres-binary] && \
Expand All @@ -101,24 +101,24 @@ cicd :
$(SETUP_CICD_SENTINEL): $(VENV) $(SETUP_DEPENDENCIES_SENTINEL) $(PYPROJECT_FILES_SENTINEL) | $(MAKE_ARTIFACT_DIRECTORY)
# `pip list` is multiple seconds faster than `pip show` ...
$(ACTIVATE_VENV) && \
if pip list -l --no-index | grep '^BL_Python\.all\s'; then \
echo "Package BL_Python.all is already built, skipping..."; \
if pip list -l --no-index | grep '^Ligare\.all\s'; then \
echo "Package Ligare.all is already built, skipping..."; \
else \
pip install .[dev-dependencies] && \
pip install src/database[postgres-binary]; \
fi
touch $@
@$(REPORT_VENV_USAGE)

.PHONY: BL_Python.all $(PACKAGES)
BL_Python.all: $(DEFAULT_TARGET)
$(PACKAGES) : BL_Python.%: src/%/pyproject.toml $(VENV) $(PYPROJECT_FILES_SENTINEL) | $(MAKE_ARTIFACT_DIRECTORY)
.PHONY: Ligare.all $(PACKAGES)
Ligare.all: $(DEFAULT_TARGET)
$(PACKAGES) : Ligare.%: src/%/pyproject.toml $(VENV) $(PYPROJECT_FILES_SENTINEL) | $(MAKE_ARTIFACT_DIRECTORY)
# `pip list` is multiple seconds faster than `pip show` ...
$(ACTIVATE_VENV) && \
if pip list -l --no-index | grep '^BL_Python\.$*\s'; then \
if pip list -l --no-index | grep '^Ligare\.$*\s'; then \
echo "Package $* is already built, skipping..."; \
else \
if [ "$@" = "BL_Python.database" ]; then \
if [ "$@" = "Ligare.database" ]; then \
pip install -e $(dir $<)[postgres-binary]; \
else \
pip install -e $(dir $<); \
Expand Down
Loading

0 comments on commit 30025e8

Please sign in to comment.