Skip to main content

uf90

CI Python 3.10+ License: MIT

uf90 traduz identificadores matemáticos escritos em arquivos *.f90u para Fortran ASCII portátil. O resultado é um arquivo *.f90 comum, compilável com fpm e compiladores Fortran existentes.

! src/physics.f90u
program physics
  real :: α, Δt, T₁₀₀, 
  print *, "α =", α
end program physics

gera:

! src/physics.f90
program physics
  real :: uc_alpha, uc_deltat, T_100, c_p2
  print *, "α =", uc_alpha
end program physics

Strings e comentários são preservados por padrão.

Instalação

Depois da primeira publicação no PyPI, a instalação recomendada será:

pipx install uf90

Enquanto a primeira release não estiver publicada, instale diretamente do GitHub:

pipx install git+https://github.com/nnardoto/uf90.git

Para desenvolvimento local:

python3 -m pip install -e '.[test]'

A instalação fornece o comando uf90 e o plugin fpm-uf90. O fpm descobre plugins pelo padrão de executáveis fpm-<nome>; com o diretório de scripts do Python no PATH, o plugin pode ser chamado como fpm uf90.

Uso com fpm

Em um projeto que contenha fpm.toml e fontes *.f90u:

fpm uf90 build
fpm uf90 run
fpm uf90 test
fpm uf90 install --prefix ~/.local

O plugin executa duas etapas:

  1. sincroniza recursivamente os arquivos *.f90u com os respectivos *.f90;
  2. encaminha o comando e seus argumentos para o executável fpm instalado.

Por exemplo, fpm uf90 build --profile release equivale a:

uf90 sync
fpm build --profile release

O comando antigo continua disponível para compatibilidade:

uf90 fpm build
fpm-unicode build

Comandos diretos

uf90 sync [diretório]
uf90 check [diretório]
uf90 translate arquivo.f90u [-o arquivo.f90]
uf90 fpm <comando-fpm> [argumentos]

uf90 sync mantém o cache incremental .uf90-manifest.json. uf90 check não modifica arquivos e retorna status 1 quando alguma saída precisa ser regenerada.

Exemplos executáveis

A pasta examples contém seis projetos fpm progressivos, de escalares a uma simulação numérica multifonte. Para traduzir, compilar e executar todos:

python3 examples/run_all.py

Mapeamento atual

  • letras gregas: αuc_alpha, Δtuc_deltat;
  • subscritos numéricos: T₁₀₀T_100;
  • subscritos alfanuméricos: EₙE_n, AᵢⱼA_ij, vₙ₁v_n1;
  • sobrescritos: c_p2.

O Unicode não define uma forma subscrita para todas as letras. O uf90 aceita as formas latinas disponíveis ₐ ₑ ₕ ᵢ ⱼ ₖ ₗ ₘ ₙ ₒ ₚ ᵣ ₛ ₜ ᵤ ᵥ ₓ, além de (schwa), dos dígitos e das variantes gregas ᵦ ᵧ ᵨ ᵩ ᵪ.

Nesta etapa o projeto é deliberadamente um tradutor fonte-a-fonte. Ele não introduz semântica nova na linguagem e não depende de LLVM, MLIR ou de um compilador específico.

Publicação

O procedimento de release com PyPI Trusted Publishing está documentado em docs/RELEASING.md.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uf90-0.1.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uf90-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file uf90-0.1.0.tar.gz.

File metadata

  • Download URL: uf90-0.1.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for uf90-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51ce4aff831dcb051fa6dcf464126325e696567715d4d34b303cd2d5aab2dec3
MD5 aafb7343d7c442edc7da7a24cdeeb826
BLAKE2b-256 0e05e4dc0415563e9dd3efe2d24c9bd77a3d4f6b61142a5c7bc26b0736e50d29

See more details on using hashes here.

Provenance

The following attestation bundles were made for uf90-0.1.0.tar.gz:

Publisher: publish.yml on nnardoto/uf90

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uf90-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: uf90-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for uf90-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd9b86c49e9220d97e3e6aa07c5bea84df64f1f793a3abdcd23ccd8e2e85dc50
MD5 bb725554289a206aa401d4a98ed84b62
BLAKE2b-256 7100ca009a29188e45ca4c84d7ce8cea45538b5677cba08ad75fedcd7be9b391

See more details on using hashes here.

Provenance

The following attestation bundles were made for uf90-0.1.0-py3-none-any.whl:

Publisher: publish.yml on nnardoto/uf90

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.1

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page