I created a list of almost 300 projects that can be built with the Fortran Package Manager by searching my list of Fortran codes on GitHub for fpm.toml files with a
Python script
import os
os.environ[‘PYTHONIOENCODING’] = ‘utf-8’
import re
import requests
import time
t0 = time.time()
def check_url_exists(url):
try:
# Make a HEAD request to get headers and avoid downloading the content
response = requests.head(url, allow_redirects=True)
# Check if the response status code is in the range of 200-299 (success)
if response.status_code in range(200, 300):
return True, response.status_code
else:
return False, response.status_code
except requests.RequestException as e:
# Handle exceptions like network errors, invalid URLs, etc.
return False, str(e)
infile = “fcog_readme_20240204.md” # version from 2024-02-04
max_lines = 10**6
debug = False
with open(infile, “r”, encoding=“utf-8”) as fp:
for i, text in enumerate(fp):
if i > max_lines:
break
if text.startswith(““) or text.startswith(”##"): # category marker
print(text)
continue
# text in parentheses after first after first set of brackets
match = re.search(r’[.?]((.*?))', text)
# Extract the match, if it exists
extracted_text = match.group(1) if match else None
if extracted_text:
if debug:
print(”\n", i)
print(text.strip())
print(extracted_text)
fpm_link = extracted_text + “/blob/master/fpm.toml”
exists, status_or_error = check_url_exists(fpm_link)
if exists:
try:
print(text)
except UnicodeEncodeError as e:
# Handle the error: for example, print a placeholder text or encode the text in ‘utf-8’ and print
print("An encoding error occurred: ", e)
if debug:
print(fpm_link)
print(“time elapsed (s):”, “%0.2f”%(time.time() - t0))
There are lots of FPM projects for “utilities” and numerical methods, and few or zero in scientific domains such as Climate & Weather or Earth Science. Codes in those domains may be large and not be entirely in Fortran, which could be preventing FPM use. Please submit PRs or issues for missing FPM projects. The Python code reading the markdown file of the broader list does have trouble with names such as Ondřej Čertík and Jiří Fürst, even though the code has lines such as
import os
os.environ['PYTHONIOENCODING'] = 'utf-8'
...
with open(infile, "r", encoding="utf-8") as fp
fpm is a great tool. I really enjoy the simplicity and I use it occasionally to check that my code runs with different compilers (gfortran and ifort mainly). I almost never use it as a package manager though, but rather as a build system.
From my own experience, there are few limitations with fpm today that makes it unusable for large projects. I have a large project (hundreds of files), organized in multiple libraries (~100) in a big monorepo:
I did not find a way to link easily local dependencies and other projects that are not in the same repo/folder.
So I keep using it for small test programs, because I really think it’s a great tool. And I am looking forward to the new versions and seeing these issues resolved with time.
I find your list of fortran codes grouped by field/area really interesting. I searched the list looking for the ICON fortran package, bu did not find it (appologies if I missed the entry and it is in the list):
Are you interested in growing your list? Should we suggest fortran packages to be added?
Would it save time to query the topics on the github site and possibly use those to auto-categorize some of the sites? I do not know how much attention everyone pays to their topics on their repositories but even if your list flagged whether their topics included “fortran-package-manager · GitHub Topics · GitHub” the “fortran-package-manager” topic would be a nice addition to your list for me.
Are there recommendations for the Fortran community on github on what topics to use that are Fortran-related? A lot of sites do not even seem to set the topics. When sites do I find them quite useful myself.
I just picked a basic topic like date and time and all four entries in your list had fpm.toml files but three did not have a topic of “fortran-package-manager” which would make it much easier for someone to find via fortran-package-manager · GitHub Topics · GitHub at least until the fpm registry is production. I would encourage anyone with an fpm(1) package on github to share to add that topic to their repository.
I have found a good number of times that the fact the github topics are clickable does not seem to be well known. Everyone using fpm(1) should browse that topic list at least once if only to appreciate all the nice eye-candy that has been created. It has the effect of making the list look much more alive and up-to-date to me. I think that is the most eye-appealing list related to Fortran.
PS: Huge fan of your list @Beliavsky ; by the way.